FELIX-2853 : Deprecate javadoc tags

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1077961 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
index daab888..f3ed7a3 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
@@ -26,6 +26,7 @@
 import org.apache.felix.scrplugin.om.*;
 import org.apache.felix.scrplugin.om.metatype.*;
 import org.apache.felix.scrplugin.tags.*;
+import org.apache.felix.scrplugin.tags.annotation.AnnotationJavaClassDescription;
 import org.apache.felix.scrplugin.tags.qdox.QDoxJavaClassDescription;
 import org.apache.felix.scrplugin.xml.ComponentDescriptorIO;
 import org.apache.felix.scrplugin.xml.MetaTypeIO;
@@ -240,6 +241,13 @@
             final JavaTag tag = javaSources[i].getTagByName( Constants.COMPONENT );
             if ( tag != null )
             {
+                // FELIX-2853 : Deprecate javadoc tags.
+                // This is not the most clever way of doing this, but it is the least intrusive...
+                if ( javaSources[i] instanceof QDoxJavaClassDescription
+                     && !(javaSources[i] instanceof AnnotationJavaClassDescription)) {
+                    iLog.addDeprecationWarning("Class " + javaSources[i].getName() + " is using deprecated javadoc tags ",
+                            tag.getSourceLocation(), tag.getLineNumber());
+                }
                 this.logger.debug( "Processing service class " + javaSources[i].getName() );
                 // check if there is more than one component tag!
                 if ( javaSources[i].getTagsByName( Constants.COMPONENT, false ).length > 1 )
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/IssueLog.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/IssueLog.java
index f861beb..210b42d 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/IssueLog.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/IssueLog.java
@@ -18,9 +18,7 @@
  */
 package org.apache.felix.scrplugin.helper;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 import org.apache.felix.scrplugin.Log;
 
@@ -35,6 +33,8 @@
 
     private final List<Entry> warnings = new ArrayList<Entry>();
 
+    private final List<Entry> deprecationWarnings = new ArrayList<Entry>();
+
     public IssueLog(final boolean strictMode) {
         this.strictMode = strictMode;
     }
@@ -44,7 +44,8 @@
     }
 
     public boolean hasErrors() {
-        return errors.size() > 0 || (this.strictMode && warnings.size() > 0 );
+        return errors.size() > 0 ||
+               (this.strictMode && (warnings.size() > 0 || this.deprecationWarnings.size() > 0));
     }
 
     public void addError(final String message, final String location, final int lineNumber) {
@@ -55,10 +56,40 @@
         warnings.add( new Entry( message, location, lineNumber ) );
     }
 
+    public void addDeprecationWarning(final String message, final String location, final int lineNumber) {
+        deprecationWarnings.add( new Entry( message, location, lineNumber ) );
+    }
+
     public void logMessages( final Log log )
     {
         // now log warnings and errors (warnings first)
         // in strict mode everything is an error!
+        final Iterator<Entry> depWarnings = this.deprecationWarnings.iterator();
+        while ( depWarnings.hasNext() )
+        {
+            final Entry entry = depWarnings.next();
+            if ( strictMode )
+            {
+                log.error( entry.message, entry.location, entry.lineNumber);
+            }
+            else
+            {
+                log.warn( entry.message, entry.location, entry.lineNumber);
+            }
+        }
+        if ( this.deprecationWarnings.size() > 0 ) {
+            final String msg = "It is highly recommended to fix these problems, as future versions might not " +
+             "support these features anymore.";
+            if ( strictMode )
+            {
+                log.error( msg );
+            }
+            else
+            {
+                log.warn( msg );
+            }
+        }
+
         final Iterator<Entry> warnings = this.warnings.iterator();
         while ( warnings.hasNext() )
         {
@@ -81,14 +112,6 @@
         }
     }
 
-    public Iterator<String> getWarnings() {
-        return null; // warnings.iterator();
-    }
-
-    public Iterator<String> getErrors() {
-        return null; // errors.iterator();
-    }
-
     private static class Entry
     {
         final String message;