equal
deleted
inserted
replaced
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.Annotator; |
|
53 import com.sun.tools.javac.comp.Attr; |
53 import com.sun.tools.javac.comp.AttrContext; |
54 import com.sun.tools.javac.comp.AttrContext; |
54 import com.sun.tools.javac.comp.Env; |
55 import com.sun.tools.javac.comp.Env; |
55 import com.sun.tools.javac.tree.JCTree; |
56 import com.sun.tools.javac.tree.JCTree; |
56 import com.sun.tools.javac.tree.TreeInfo; |
57 import com.sun.tools.javac.tree.TreeInfo; |
57 import com.sun.tools.javac.tree.JCTree.JCBlock; |
58 import com.sun.tools.javac.tree.JCTree.JCBlock; |
93 |
94 |
94 final Log log; |
95 final Log log; |
95 final Names names; |
96 final Names names; |
96 final Symtab syms; |
97 final Symtab syms; |
97 final Annotate annotate; |
98 final Annotate annotate; |
|
99 final Attr attr; |
98 private final boolean typeAnnoAsserts; |
100 private final boolean typeAnnoAsserts; |
99 |
101 |
100 protected TypeAnnotations(Context context) { |
102 protected TypeAnnotations(Context context) { |
101 context.put(typeAnnosKey, this); |
103 context.put(typeAnnosKey, this); |
102 names = Names.instance(context); |
104 names = Names.instance(context); |
103 log = Log.instance(context); |
105 log = Log.instance(context); |
104 syms = Symtab.instance(context); |
106 syms = Symtab.instance(context); |
105 annotate = Annotate.instance(context); |
107 annotate = Annotate.instance(context); |
|
108 attr = Attr.instance(context); |
106 Options options = Options.instance(context); |
109 Options options = Options.instance(context); |
107 typeAnnoAsserts = options.isSet("TypeAnnotationAsserts"); |
110 typeAnnoAsserts = options.isSet("TypeAnnotationAsserts"); |
108 } |
111 } |
109 |
112 |
110 /** |
113 /** |
122 public void enterAnnotation() { |
125 public void enterAnnotation() { |
123 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); |
126 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); |
124 |
127 |
125 try { |
128 try { |
126 new TypeAnnotationPositions(true).scan(tree); |
129 new TypeAnnotationPositions(true).scan(tree); |
|
130 } finally { |
|
131 log.useSource(oldSource); |
|
132 } |
|
133 } |
|
134 } ); |
|
135 } |
|
136 |
|
137 public void validateTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) { |
|
138 annotate.validate(new Annotator() { //validate annotations |
|
139 @Override |
|
140 public void enterAnnotation() { |
|
141 JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile); |
|
142 |
|
143 try { |
|
144 attr.validateTypeAnnotations(tree, true); |
127 } finally { |
145 } finally { |
128 log.useSource(oldSource); |
146 log.useSource(oldSource); |
129 } |
147 } |
130 } |
148 } |
131 } ); |
149 } ); |