src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java

Print this page

        

@@ -71,10 +71,20 @@
 import com.sun.tools.javac.util.ListBuffer;
 import com.sun.tools.javac.util.Log;
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Options;
 
+/***************************************************
+ *                                                 *
+ *           ! ! I M P O R T A N T ! !             *
+ *                                                 *
+ *    All code in this file is now considered      *
+ *   deprecated, and will be removed in a very     *
+ *  short timeline.  DO NOT modify this file, or   *
+ *  introduce code that relies on it in any way    *
+ *                                                 *
+ ***************************************************/
 /**
  * Contains operations specific to processing type annotations.
  * This class has two functions:
  * separate declaration from type annotations and insert the type
  * annotations to their types;

@@ -143,15 +153,12 @@
                 }
             }
         } );
     }
 
-    /**
-     * This version only visits types in bodies, that is, field initializers,
-     * top-level blocks, and method bodies, and should be called from Attr.
-     */
-    public void organizeTypeAnnotationsBodies(JCClassDecl tree) {
+    // Deprecated, no longer used, no longer functional, and slated for removal
+    public void organizeTypeAnnotationsBodies(JCTree tree) {
         new TypeAnnotationPositions(false).scan(tree);
     }
 
     public enum AnnotationType { DECLARATION, TYPE, BOTH }
 

@@ -387,12 +394,10 @@
         // As a side effect the method sets the type annotation position of "annotations".
         // Note that it is assumed that all annotations share the same position.
         private Type typeWithAnnotations(final JCTree typetree, final Type type,
                 final List<Attribute.TypeCompound> annotations,
                 final List<Attribute.TypeCompound> onlyTypeAnnotations) {
-            //System.err.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n",
-            //         typetree, type, annotations, onlyTypeAnnotations);
             if (annotations.isEmpty()) {
                 return type;
             }
             if (type.hasTag(TypeTag.ARRAY)) {
                 Type.ArrayType arType = (Type.ArrayType) type;

@@ -490,16 +495,16 @@
                         // If the annotations are also declaration annotations, they are
                         // illegal as type annotations but might be legal as declaration annotations.
                         // The normal declaration annotation checks make sure that the use is valid.
                         break;
                     case 1:
-                        log.error(typetree.pos(), "cant.type.annotate.scoping.1",
-                                onlyTypeAnnotations);
+                        //log.error(typetree.pos(), "cant.type.annotate.scoping.1",
+                        //        onlyTypeAnnotations);
                         break;
                     default:
-                        log.error(typetree.pos(), "cant.type.annotate.scoping",
-                                onlyTypeAnnotations);
+                        //log.error(typetree.pos(), "cant.type.annotate.scoping",
+                        //        onlyTypeAnnotations);
                     }
                     return type;
                 }
 
                 // At this point we have visited the part of the nested

@@ -568,11 +573,10 @@
          * @return A copy of type that contains the annotations.
          */
         private Type typeWithAnnotations(final Type type,
                 final Type stopAt,
                 final List<Attribute.TypeCompound> annotations) {
-            //System.err.println("typeWithAnnotations " + type + " " + annotations + " stopAt " + stopAt);
             Visitor<Type, List<TypeCompound>> visitor =
                     new Type.Visitor<Type, List<Attribute.TypeCompound>>() {
                 @Override
                 public Type visitClassType(ClassType t, List<TypeCompound> s) {
                     // assert that t.constValue() == null?

@@ -940,11 +944,11 @@
                                                      frame.pos);
                             }
                         case EXCEPTION_PARAMETER:
                             return TypeAnnotationPosition
                                 .exceptionParameter(location.toList(),
-                                                    currentLambda,
+                                                    currentLambda, 0,
                                                     frame.pos);
                         case RESOURCE_VARIABLE:
                             return TypeAnnotationPosition
                                 .resourceVariable(location.toList(),
                                                   currentLambda,

@@ -1382,11 +1386,11 @@
                 TypeAnnotationPosition position) {
             for (JCAnnotation anno : annotations) {
                 // attribute might be null during DeferredAttr;
                 // we will be back later.
                 if (anno.attribute != null) {
-                    ((Attribute.TypeCompound) anno.attribute).position = position;
+                    //((Attribute.TypeCompound) anno.attribute).position = position;
                 }
             }
         }
 
         @Override