src/share/classes/com/sun/tools/javac/comp/MemberEnter.java

changeset 1850
6debfa63a4a1
parent 1820
6b48ebae2569
child 1896
44e27378f523
equal deleted inserted replaced
1845:be10ac0081b2 1850:6debfa63a4a1
107 types = Types.instance(context); 107 types = Types.instance(context);
108 diags = JCDiagnostic.Factory.instance(context); 108 diags = JCDiagnostic.Factory.instance(context);
109 source = Source.instance(context); 109 source = Source.instance(context);
110 target = Target.instance(context); 110 target = Target.instance(context);
111 deferredLintHandler = DeferredLintHandler.instance(context); 111 deferredLintHandler = DeferredLintHandler.instance(context);
112 } 112 allowTypeAnnos = source.allowTypeAnnotations();
113 }
114
115 /** Switch: support type annotations.
116 */
117 boolean allowTypeAnnos;
113 118
114 /** A queue for classes whose members still need to be entered into the 119 /** A queue for classes whose members still need to be entered into the
115 * symbol table. 120 * symbol table.
116 */ 121 */
117 ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<Env<AttrContext>>(); 122 ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<Env<AttrContext>>();
118 123
119 /** Set to true only when the first of a set of classes is 124 /** Set to true only when the first of a set of classes is
120 * processed from the halfcompleted queue. 125 * processed from the half completed queue.
121 */ 126 */
122 boolean isFirst = true; 127 boolean isFirst = true;
123 128
124 /** A flag to disable completion from time to time during member 129 /** A flag to disable completion from time to time during member
125 * enter, as we only need to look up types. This avoids 130 * enter, as we only need to look up types. This avoids
1070 } 1075 }
1071 } finally { 1076 } finally {
1072 isFirst = true; 1077 isFirst = true;
1073 } 1078 }
1074 } 1079 }
1075 TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate); 1080 if (allowTypeAnnos) {
1081 TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate);
1082 }
1076 } 1083 }
1077 1084
1078 /* 1085 /*
1079 * If the symbol is non-null, attach the type annotation to it. 1086 * If the symbol is non-null, attach the type annotation to it.
1080 */ 1087 */
1115 annotate.new AnnotateRepeatedContext<Attribute.TypeCompound>(env, annotated, pos, log, true)); 1122 annotate.new AnnotateRepeatedContext<Attribute.TypeCompound>(env, annotated, pos, log, true));
1116 } 1123 }
1117 } 1124 }
1118 1125
1119 public void typeAnnotate(final JCTree tree, final Env<AttrContext> env, final Symbol sym) { 1126 public void typeAnnotate(final JCTree tree, final Env<AttrContext> env, final Symbol sym) {
1120 tree.accept(new TypeAnnotate(env, sym)); 1127 if (allowTypeAnnos) {
1128 tree.accept(new TypeAnnotate(env, sym));
1129 }
1121 } 1130 }
1122 1131
1123 /** 1132 /**
1124 * We need to use a TreeScanner, because it is not enough to visit the top-level 1133 * We need to use a TreeScanner, because it is not enough to visit the top-level
1125 * annotations. We also need to visit type arguments, etc. 1134 * annotations. We also need to visit type arguments, etc.

mercurial