langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
changeset 21040 3e32f68d2151
parent 21018 95d225149128
child 21041 99f5e5e97425
equal deleted inserted replaced
21039:fe603c712085 21040:3e32f68d2151
    47 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry;
    47 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntry;
    48 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntryKind;
    48 import com.sun.tools.javac.code.TypeAnnotationPosition.TypePathEntryKind;
    49 import com.sun.tools.javac.code.Symbol.VarSymbol;
    49 import com.sun.tools.javac.code.Symbol.VarSymbol;
    50 import com.sun.tools.javac.code.Symbol.MethodSymbol;
    50 import com.sun.tools.javac.code.Symbol.MethodSymbol;
    51 import com.sun.tools.javac.comp.Annotate;
    51 import com.sun.tools.javac.comp.Annotate;
    52 import com.sun.tools.javac.comp.Annotate.Annotator;
    52 import com.sun.tools.javac.comp.Annotate.Worker;
    53 import com.sun.tools.javac.comp.Attr;
    53 import com.sun.tools.javac.comp.Attr;
    54 import com.sun.tools.javac.comp.AttrContext;
    54 import com.sun.tools.javac.comp.AttrContext;
    55 import com.sun.tools.javac.comp.Env;
    55 import com.sun.tools.javac.comp.Env;
    56 import com.sun.tools.javac.tree.JCTree;
    56 import com.sun.tools.javac.tree.JCTree;
    57 import com.sun.tools.javac.tree.TreeInfo;
    57 import com.sun.tools.javac.tree.TreeInfo;
   114      * Separate type annotations from declaration annotations and
   114      * Separate type annotations from declaration annotations and
   115      * determine the correct positions for type annotations.
   115      * determine the correct positions for type annotations.
   116      * This version only visits types in signatures and should be
   116      * This version only visits types in signatures and should be
   117      * called from MemberEnter.
   117      * called from MemberEnter.
   118      * The method takes the Annotate object as parameter and
   118      * The method takes the Annotate object as parameter and
   119      * adds an Annotator to the correct Annotate queue for
   119      * adds an Annotate.Worker to the correct Annotate queue for
   120      * later processing.
   120      * later processing.
   121      */
   121      */
   122     public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
   122     public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
   123         annotate.afterRepeated( new Annotator() {
   123         annotate.afterRepeated( new Worker() {
   124             @Override
   124             @Override
   125             public void enterAnnotation() {
   125             public void run() {
   126                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
   126                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
   127 
   127 
   128                 try {
   128                 try {
   129                     new TypeAnnotationPositions(true).scan(tree);
   129                     new TypeAnnotationPositions(true).scan(tree);
   130                 } finally {
   130                 } finally {
   133             }
   133             }
   134         } );
   134         } );
   135     }
   135     }
   136 
   136 
   137     public void validateTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
   137     public void validateTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
   138         annotate.validate(new Annotator() { //validate annotations
   138         annotate.validate(new Worker() { //validate annotations
   139             @Override
   139             @Override
   140             public void enterAnnotation() {
   140             public void run() {
   141                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
   141                 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
   142 
   142 
   143                 try {
   143                 try {
   144                     attr.validateTypeAnnotations(tree, true);
   144                     attr.validateTypeAnnotations(tree, true);
   145                 } finally {
   145                 } finally {