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

Print this page

        

*** 71,80 **** --- 71,90 ---- 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,157 **** } } } ); } ! /** ! * 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) { new TypeAnnotationPositions(false).scan(tree); } public enum AnnotationType { DECLARATION, TYPE, BOTH } --- 153,164 ---- } } } ); } ! // 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,398 **** // 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; --- 394,403 ----
*** 490,505 **** // 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); break; default: ! log.error(typetree.pos(), "cant.type.annotate.scoping", ! onlyTypeAnnotations); } return type; } // At this point we have visited the part of the nested --- 495,510 ---- // 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); break; default: ! //log.error(typetree.pos(), "cant.type.annotate.scoping", ! // onlyTypeAnnotations); } return type; } // At this point we have visited the part of the nested
*** 568,578 **** * @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? --- 573,582 ----
*** 940,950 **** frame.pos); } case EXCEPTION_PARAMETER: return TypeAnnotationPosition .exceptionParameter(location.toList(), ! currentLambda, frame.pos); case RESOURCE_VARIABLE: return TypeAnnotationPosition .resourceVariable(location.toList(), currentLambda, --- 944,954 ---- frame.pos); } case EXCEPTION_PARAMETER: return TypeAnnotationPosition .exceptionParameter(location.toList(), ! currentLambda, 0, frame.pos); case RESOURCE_VARIABLE: return TypeAnnotationPosition .resourceVariable(location.toList(), currentLambda,
*** 1382,1392 **** 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; } } } @Override --- 1386,1396 ---- 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; } } } @Override