Fixes issue 2104 - emit a warning for uses of the gwt.typeArgs javadoc annotation.  TypeOracle will emit the warning any time that it is built or refreshed for any type that uses gwt.typeArgs, whether that type has changed or not.  This is a side effect of the way that the TypeOracle refrehes itself.  The TypeOracle will need to be refactored, as part of a separate commit, so that it only emits the warning for types that changed.  

Also deprecated the methods on the HasMetaData interface.

Review by: jat


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1882 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java
index 1ef3c46..b1b9615 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/HasMetaData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Google Inc.
+ * Copyright 2008 Google Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
@@ -23,6 +23,8 @@
  * whether a doc comment was used or (in the future) a concrete instantiation of
  * a generic type was used. The same idea could be useful for to exposing
  * attributes as metadata.
+ * 
+ * This API has been deprecated in favor of proper Java annotations.
  */
 package com.google.gwt.core.ext.typeinfo;
 
@@ -55,16 +57,33 @@
 public interface HasMetaData {
   /**
    * Adds additional metadata.
+   * 
+   * @deprecated Javadoc comment metadata has been deprecated in favor of proper
+   *             Java annotations. The only way to add a Java annotation is via
+   *             the source code.
    */
+  @Deprecated
   void addMetaData(String tagName, String[] values);
 
   /**
    * Gets each list of metadata for the specified tag name.
+   * 
+   * @deprecated Javadoc comment metadata has been deprecated in favor of proper
+   *             Java annotations. See
+   *             {@link HasAnnotations#getAnnotation(Class)} for equivalent
+   *             functionality.
    */
+  @Deprecated
   String[][] getMetaData(String tagName);
 
   /**
    * Gets the name of available metadata tags.
+   * 
+   * @deprecated Javadoc comment metadata has been deprecated in favor of proper
+   *             Java annotations. The {@link HasAnnotations} interface does not
+   *             support a mechanism to enumerate all of the annotations on a
+   *             member; the type of the desired annotation must be known.
    */
+  @Deprecated
   String[] getMetaDataTags();
 }
diff --git a/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java b/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java
index 5352f8c..29d08a7 100644
--- a/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java
+++ b/dev/core/src/com/google/gwt/core/ext/typeinfo/TypeOracle.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * Copyright 2008 Google Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
@@ -664,8 +664,12 @@
   }
 
   private void consumeTypeArgMetaData(TreeLogger logger) {
-    logger = logger.branch(TreeLogger.DEBUG, "Examining " + TAG_TYPEARGS
-        + " tags", null);
+    logger = logger.branch(
+        TreeLogger.DEBUG,
+        "Scanning source for uses of the deprecated "
+            + TAG_TYPEARGS
+            + " javadoc annotation; Please use Java parameterized types instead",
+        null);
     consumeTypeArgMetaData(logger, getTypes());
   }
 
@@ -712,6 +716,12 @@
         JType fieldType = field.getType();
         String[] token = tokensArray[tokensArray.length - 1];
         JType resultingType = determineActualType(branch, fieldType, token, 0);
+
+        branch.log(TreeLogger.WARN, "Deprecated use of " + TAG_TYPEARGS
+            + " for field " + field.getName() + "; Please use "
+            + resultingType.getParameterizedQualifiedSourceName()
+            + " as the field's type", null);
+        
         field.setType(resultingType);
       } catch (UnableToCompleteException e) {
         // Continue; the problem will have been logged.
@@ -760,6 +770,11 @@
               JType resultingType = determineActualType(branch,
                   param.getType(), tokens, 1);
               param.setType(resultingType);
+
+              branch.log(TreeLogger.WARN, "Deprecated use of " + TAG_TYPEARGS
+                  + " for parameter " + param.getName() + "; Please use "
+                  + resultingType.getParameterizedQualifiedSourceName()
+                  + " as the parameter's type", null);
               paramsAlreadySet.add(param);
             } else {
               // This parameter type has already been set.
@@ -776,6 +791,11 @@
               JType resultingType = determineActualType(branch,
                   method.getReturnType(), tokens, 0);
               method.setReturnType(resultingType);
+
+              branch.log(TreeLogger.WARN, "Deprecated use of " + TAG_TYPEARGS
+                  + " for the return type; Please use "
+                  + resultingType.getParameterizedQualifiedSourceName()
+                  + " as the method's return type", null);
               returnTypeHandled = true;
             } else {
               // The return type has already been set.