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

changeset 2596
fa8be3ce18fc
parent 2425
76b61848c9a4
child 2702
9ca8d8713094
equal deleted inserted replaced
2595:1cf5a53613ae 2596:fa8be3ce18fc
573 m.enclClass().flags_field |= DEFAULT; 573 m.enclClass().flags_field |= DEFAULT;
574 } 574 }
575 575
576 Env<AttrContext> localEnv = methodEnv(tree, env); 576 Env<AttrContext> localEnv = methodEnv(tree, env);
577 577
578 annotate.enterStart(); 578 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
579 try { 579 try {
580 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); 580 // Compute the method type
581 try { 581 m.type = signature(m, tree.typarams, tree.params,
582 // Compute the method type 582 tree.restype, tree.recvparam,
583 m.type = signature(m, tree.typarams, tree.params, 583 tree.thrown,
584 tree.restype, tree.recvparam, 584 localEnv);
585 tree.thrown,
586 localEnv);
587 } finally {
588 deferredLintHandler.setPos(prevLintPos);
589 }
590
591 if (types.isSignaturePolymorphic(m)) {
592 m.flags_field |= SIGNATURE_POLYMORPHIC;
593 }
594
595 // Set m.params
596 ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>();
597 JCVariableDecl lastParam = null;
598 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
599 JCVariableDecl param = lastParam = l.head;
600 params.append(Assert.checkNonNull(param.sym));
601 }
602 m.params = params.toList();
603
604 // mark the method varargs, if necessary
605 if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0)
606 m.flags_field |= Flags.VARARGS;
607
608 localEnv.info.scope.leave();
609 if (chk.checkUnique(tree.pos(), m, enclScope)) {
610 enclScope.enter(m);
611 }
612
613 annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
614 // Visit the signature of the method. Note that
615 // TypeAnnotate doesn't descend into the body.
616 typeAnnotate(tree, localEnv, m, tree.pos());
617
618 if (tree.defaultValue != null)
619 annotateDefaultValueLater(tree.defaultValue, localEnv, m);
620 } finally { 585 } finally {
621 annotate.enterDone(); 586 deferredLintHandler.setPos(prevLintPos);
622 } 587 }
588
589 if (types.isSignaturePolymorphic(m)) {
590 m.flags_field |= SIGNATURE_POLYMORPHIC;
591 }
592
593 // Set m.params
594 ListBuffer<VarSymbol> params = new ListBuffer<VarSymbol>();
595 JCVariableDecl lastParam = null;
596 for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
597 JCVariableDecl param = lastParam = l.head;
598 params.append(Assert.checkNonNull(param.sym));
599 }
600 m.params = params.toList();
601
602 // mark the method varargs, if necessary
603 if (lastParam != null && (lastParam.mods.flags & Flags.VARARGS) != 0)
604 m.flags_field |= Flags.VARARGS;
605
606 localEnv.info.scope.leave();
607 if (chk.checkUnique(tree.pos(), m, enclScope)) {
608 enclScope.enter(m);
609 }
610
611 annotateLater(tree.mods.annotations, localEnv, m, tree.pos());
612 // Visit the signature of the method. Note that
613 // TypeAnnotate doesn't descend into the body.
614 typeAnnotate(tree, localEnv, m, tree.pos());
615
616 if (tree.defaultValue != null)
617 annotateDefaultValueLater(tree.defaultValue, localEnv, m);
623 } 618 }
624 619
625 /** Create a fresh environment for method bodies. 620 /** Create a fresh environment for method bodies.
626 * @param tree The method definition. 621 * @param tree The method definition.
627 * @param env The environment current outside of the method definition. 622 * @param env The environment current outside of the method definition.
645 (env.info.scope.owner.flags() & INTERFACE) != 0) { 640 (env.info.scope.owner.flags() & INTERFACE) != 0) {
646 localEnv = env.dup(tree, env.info.dup()); 641 localEnv = env.dup(tree, env.info.dup());
647 localEnv.info.staticLevel++; 642 localEnv.info.staticLevel++;
648 } 643 }
649 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos()); 644 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
650 annotate.enterStart();
651 try { 645 try {
652 try { 646 if (TreeInfo.isEnumInit(tree)) {
653 if (TreeInfo.isEnumInit(tree)) { 647 attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
654 attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype); 648 } else {
655 } else { 649 attr.attribType(tree.vartype, localEnv);
656 attr.attribType(tree.vartype, localEnv); 650 if (TreeInfo.isReceiverParam(tree))
657 if (TreeInfo.isReceiverParam(tree)) 651 checkReceiver(tree, localEnv);
658 checkReceiver(tree, localEnv); 652 }
659 }
660 } finally {
661 deferredLintHandler.setPos(prevLintPos);
662 }
663
664 if ((tree.mods.flags & VARARGS) != 0) {
665 //if we are entering a varargs parameter, we need to
666 //replace its type (a plain array type) with the more
667 //precise VarargsType --- we need to do it this way
668 //because varargs is represented in the tree as a
669 //modifier on the parameter declaration, and not as a
670 //distinct type of array node.
671 ArrayType atype = (ArrayType)tree.vartype.type.unannotatedType();
672 tree.vartype.type = atype.makeVarargs();
673 }
674 Scope enclScope = enter.enterScope(env);
675 VarSymbol v =
676 new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner);
677 v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree);
678 tree.sym = v;
679 if (tree.init != null) {
680 v.flags_field |= HASINIT;
681 if ((v.flags_field & FINAL) != 0 &&
682 needsLazyConstValue(tree.init)) {
683 Env<AttrContext> initEnv = getInitEnv(tree, env);
684 initEnv.info.enclVar = v;
685 v.setLazyConstValue(initEnv(tree, initEnv), attr, tree);
686 }
687 }
688 if (chk.checkUnique(tree.pos(), v, enclScope)) {
689 chk.checkTransparentVar(tree.pos(), v, enclScope);
690 enclScope.enter(v);
691 }
692 annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
693 typeAnnotate(tree.vartype, env, v, tree.pos());
694 v.pos = tree.pos;
695 } finally { 653 } finally {
696 annotate.enterDone(); 654 deferredLintHandler.setPos(prevLintPos);
697 } 655 }
656
657 if ((tree.mods.flags & VARARGS) != 0) {
658 //if we are entering a varargs parameter, we need to
659 //replace its type (a plain array type) with the more
660 //precise VarargsType --- we need to do it this way
661 //because varargs is represented in the tree as a
662 //modifier on the parameter declaration, and not as a
663 //distinct type of array node.
664 ArrayType atype = (ArrayType)tree.vartype.type.unannotatedType();
665 tree.vartype.type = atype.makeVarargs();
666 }
667 Scope enclScope = enter.enterScope(env);
668 VarSymbol v =
669 new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner);
670 v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree);
671 tree.sym = v;
672 if (tree.init != null) {
673 v.flags_field |= HASINIT;
674 if ((v.flags_field & FINAL) != 0 &&
675 needsLazyConstValue(tree.init)) {
676 Env<AttrContext> initEnv = getInitEnv(tree, env);
677 initEnv.info.enclVar = v;
678 v.setLazyConstValue(initEnv(tree, initEnv), attr, tree);
679 }
680 }
681 if (chk.checkUnique(tree.pos(), v, enclScope)) {
682 chk.checkTransparentVar(tree.pos(), v, enclScope);
683 enclScope.enter(v);
684 }
685 annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
686 typeAnnotate(tree.vartype, env, v, tree.pos());
687 v.pos = tree.pos;
698 } 688 }
699 // where 689 // where
700 void checkType(JCTree tree, Type type, String diag) { 690 void checkType(JCTree tree, Type type, String diag) {
701 if (!tree.type.isErroneous() && !types.isSameType(tree.type, type)) { 691 if (!tree.type.isErroneous() && !types.isSameType(tree.type, type)) {
702 log.error(tree, diag, type, tree.type); 692 log.error(tree, diag, type, tree.type);
1028 ClassType ct = (ClassType)c.type; 1018 ClassType ct = (ClassType)c.type;
1029 Env<AttrContext> env = typeEnvs.get(c); 1019 Env<AttrContext> env = typeEnvs.get(c);
1030 JCClassDecl tree = (JCClassDecl)env.tree; 1020 JCClassDecl tree = (JCClassDecl)env.tree;
1031 boolean wasFirst = isFirst; 1021 boolean wasFirst = isFirst;
1032 isFirst = false; 1022 isFirst = false;
1033
1034 JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
1035 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
1036 try { 1023 try {
1037 // Save class environment for later member enter (2) processing. 1024 annotate.enterStart();
1038 halfcompleted.append(env); 1025
1039 1026 JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
1040 // Mark class as not yet attributed. 1027 DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
1041 c.flags_field |= UNATTRIBUTED; 1028 try {
1042 1029 // Save class environment for later member enter (2) processing.
1043 // If this is a toplevel-class, make sure any preceding import 1030 halfcompleted.append(env);
1044 // clauses have been seen. 1031
1045 if (c.owner.kind == PCK) { 1032 // Mark class as not yet attributed.
1046 memberEnter(env.toplevel, env.enclosing(TOPLEVEL)); 1033 c.flags_field |= UNATTRIBUTED;
1047 todo.append(env); 1034
1048 } 1035 // If this is a toplevel-class, make sure any preceding import
1049 1036 // clauses have been seen.
1050 if (c.owner.kind == TYP) 1037 if (c.owner.kind == PCK) {
1051 c.owner.complete(); 1038 memberEnter(env.toplevel, env.enclosing(TOPLEVEL));
1052 1039 todo.append(env);
1053 // create an environment for evaluating the base clauses 1040 }
1054 Env<AttrContext> baseEnv = baseEnv(tree, env); 1041
1055 1042 if (c.owner.kind == TYP)
1056 if (tree.extending != null) 1043 c.owner.complete();
1057 typeAnnotate(tree.extending, baseEnv, sym, tree.pos()); 1044
1058 for (JCExpression impl : tree.implementing) 1045 // create an environment for evaluating the base clauses
1059 typeAnnotate(impl, baseEnv, sym, tree.pos()); 1046 Env<AttrContext> baseEnv = baseEnv(tree, env);
1060 annotate.flush(); 1047
1061 1048 if (tree.extending != null)
1062 // Determine supertype. 1049 typeAnnotate(tree.extending, baseEnv, sym, tree.pos());
1063 Type supertype = 1050 for (JCExpression impl : tree.implementing)
1064 (tree.extending != null) 1051 typeAnnotate(impl, baseEnv, sym, tree.pos());
1065 ? attr.attribBase(tree.extending, baseEnv, true, false, true) 1052 annotate.flush();
1066 : ((tree.mods.flags & Flags.ENUM) != 0) 1053
1067 ? attr.attribBase(enumBase(tree.pos, c), baseEnv, 1054 // Determine supertype.
1068 true, false, false) 1055 Type supertype =
1069 : (c.fullname == names.java_lang_Object) 1056 (tree.extending != null)
1070 ? Type.noType 1057 ? attr.attribBase(tree.extending, baseEnv, true, false, true)
1071 : syms.objectType; 1058 : ((tree.mods.flags & Flags.ENUM) != 0)
1072 ct.supertype_field = modelMissingTypes(supertype, tree.extending, false); 1059 ? attr.attribBase(enumBase(tree.pos, c), baseEnv,
1073 1060 true, false, false)
1074 // Determine interfaces. 1061 : (c.fullname == names.java_lang_Object)
1075 ListBuffer<Type> interfaces = new ListBuffer<Type>(); 1062 ? Type.noType
1076 ListBuffer<Type> all_interfaces = null; // lazy init 1063 : syms.objectType;
1077 Set<Type> interfaceSet = new HashSet<Type>(); 1064 ct.supertype_field = modelMissingTypes(supertype, tree.extending, false);
1078 List<JCExpression> interfaceTrees = tree.implementing; 1065
1079 for (JCExpression iface : interfaceTrees) { 1066 // Determine interfaces.
1080 Type i = attr.attribBase(iface, baseEnv, false, true, true); 1067 ListBuffer<Type> interfaces = new ListBuffer<Type>();
1081 if (i.hasTag(CLASS)) { 1068 ListBuffer<Type> all_interfaces = null; // lazy init
1082 interfaces.append(i); 1069 Set<Type> interfaceSet = new HashSet<Type>();
1083 if (all_interfaces != null) all_interfaces.append(i); 1070 List<JCExpression> interfaceTrees = tree.implementing;
1084 chk.checkNotRepeated(iface.pos(), types.erasure(i), interfaceSet); 1071 for (JCExpression iface : interfaceTrees) {
1085 } else { 1072 Type i = attr.attribBase(iface, baseEnv, false, true, true);
1086 if (all_interfaces == null) 1073 if (i.hasTag(CLASS)) {
1087 all_interfaces = new ListBuffer<Type>().appendList(interfaces); 1074 interfaces.append(i);
1088 all_interfaces.append(modelMissingTypes(i, iface, true)); 1075 if (all_interfaces != null) all_interfaces.append(i);
1089 } 1076 chk.checkNotRepeated(iface.pos(), types.erasure(i), interfaceSet);
1090 } 1077 } else {
1091 if ((c.flags_field & ANNOTATION) != 0) { 1078 if (all_interfaces == null)
1092 ct.interfaces_field = List.of(syms.annotationType); 1079 all_interfaces = new ListBuffer<Type>().appendList(interfaces);
1093 ct.all_interfaces_field = ct.interfaces_field; 1080 all_interfaces.append(modelMissingTypes(i, iface, true));
1094 } else { 1081 }
1095 ct.interfaces_field = interfaces.toList(); 1082 }
1096 ct.all_interfaces_field = (all_interfaces == null) 1083 if ((c.flags_field & ANNOTATION) != 0) {
1097 ? ct.interfaces_field : all_interfaces.toList(); 1084 ct.interfaces_field = List.of(syms.annotationType);
1098 } 1085 ct.all_interfaces_field = ct.interfaces_field;
1099 1086 } else {
1100 if (c.fullname == names.java_lang_Object) { 1087 ct.interfaces_field = interfaces.toList();
1101 if (tree.extending != null) { 1088 ct.all_interfaces_field = (all_interfaces == null)
1102 chk.checkNonCyclic(tree.extending.pos(), 1089 ? ct.interfaces_field : all_interfaces.toList();
1103 supertype); 1090 }
1104 ct.supertype_field = Type.noType; 1091
1105 } 1092 if (c.fullname == names.java_lang_Object) {
1106 else if (tree.implementing.nonEmpty()) { 1093 if (tree.extending != null) {
1107 chk.checkNonCyclic(tree.implementing.head.pos(), 1094 chk.checkNonCyclic(tree.extending.pos(),
1108 ct.interfaces_field.head); 1095 supertype);
1109 ct.interfaces_field = List.nil(); 1096 ct.supertype_field = Type.noType;
1110 } 1097 }
1111 } 1098 else if (tree.implementing.nonEmpty()) {
1112 1099 chk.checkNonCyclic(tree.implementing.head.pos(),
1113 // Annotations. 1100 ct.interfaces_field.head);
1114 // In general, we cannot fully process annotations yet, but we 1101 ct.interfaces_field = List.nil();
1115 // can attribute the annotation types and then check to see if the 1102 }
1116 // @Deprecated annotation is present. 1103 }
1117 attr.attribAnnotationTypes(tree.mods.annotations, baseEnv); 1104
1118 if (hasDeprecatedAnnotation(tree.mods.annotations)) 1105 // Annotations.
1119 c.flags_field |= DEPRECATED; 1106 // In general, we cannot fully process annotations yet, but we
1120 annotateLater(tree.mods.annotations, baseEnv, c, tree.pos()); 1107 // can attribute the annotation types and then check to see if the
1121 // class type parameters use baseEnv but everything uses env 1108 // @Deprecated annotation is present.
1122 1109 attr.attribAnnotationTypes(tree.mods.annotations, baseEnv);
1123 chk.checkNonCyclicDecl(tree); 1110 if (hasDeprecatedAnnotation(tree.mods.annotations))
1124 1111 c.flags_field |= DEPRECATED;
1125 attr.attribTypeVariables(tree.typarams, baseEnv); 1112 annotateLater(tree.mods.annotations, baseEnv, c, tree.pos());
1126 // Do this here, where we have the symbol. 1113 // class type parameters use baseEnv but everything uses env
1127 for (JCTypeParameter tp : tree.typarams) 1114
1128 typeAnnotate(tp, baseEnv, sym, tree.pos()); 1115 chk.checkNonCyclicDecl(tree);
1129 1116
1130 // Add default constructor if needed. 1117 attr.attribTypeVariables(tree.typarams, baseEnv);
1131 if ((c.flags() & INTERFACE) == 0 && 1118 // Do this here, where we have the symbol.
1132 !TreeInfo.hasConstructors(tree.defs)) { 1119 for (JCTypeParameter tp : tree.typarams)
1133 List<Type> argtypes = List.nil(); 1120 typeAnnotate(tp, baseEnv, sym, tree.pos());
1134 List<Type> typarams = List.nil(); 1121
1135 List<Type> thrown = List.nil(); 1122 // Add default constructor if needed.
1136 long ctorFlags = 0; 1123 if ((c.flags() & INTERFACE) == 0 &&
1137 boolean based = false; 1124 !TreeInfo.hasConstructors(tree.defs)) {
1138 boolean addConstructor = true; 1125 List<Type> argtypes = List.nil();
1139 JCNewClass nc = null; 1126 List<Type> typarams = List.nil();
1140 if (c.name.isEmpty()) { 1127 List<Type> thrown = List.nil();
1141 nc = (JCNewClass)env.next.tree; 1128 long ctorFlags = 0;
1142 if (nc.constructor != null) { 1129 boolean based = false;
1143 addConstructor = nc.constructor.kind != ERR; 1130 boolean addConstructor = true;
1144 Type superConstrType = types.memberType(c.type, 1131 JCNewClass nc = null;
1145 nc.constructor); 1132 if (c.name.isEmpty()) {
1146 argtypes = superConstrType.getParameterTypes(); 1133 nc = (JCNewClass)env.next.tree;
1147 typarams = superConstrType.getTypeArguments(); 1134 if (nc.constructor != null) {
1148 ctorFlags = nc.constructor.flags() & VARARGS; 1135 addConstructor = nc.constructor.kind != ERR;
1149 if (nc.encl != null) { 1136 Type superConstrType = types.memberType(c.type,
1150 argtypes = argtypes.prepend(nc.encl.type); 1137 nc.constructor);
1151 based = true; 1138 argtypes = superConstrType.getParameterTypes();
1139 typarams = superConstrType.getTypeArguments();
1140 ctorFlags = nc.constructor.flags() & VARARGS;
1141 if (nc.encl != null) {
1142 argtypes = argtypes.prepend(nc.encl.type);
1143 based = true;
1144 }
1145 thrown = superConstrType.getThrownTypes();
1152 } 1146 }
1153 thrown = superConstrType.getThrownTypes();
1154 } 1147 }
1155 } 1148 if (addConstructor) {
1156 if (addConstructor) { 1149 MethodSymbol basedConstructor = nc != null ?
1157 MethodSymbol basedConstructor = nc != null ? 1150 (MethodSymbol)nc.constructor : null;
1158 (MethodSymbol)nc.constructor : null; 1151 JCTree constrDef = DefaultConstructor(make.at(tree.pos), c,
1159 JCTree constrDef = DefaultConstructor(make.at(tree.pos), c, 1152 basedConstructor,
1160 basedConstructor, 1153 typarams, argtypes, thrown,
1161 typarams, argtypes, thrown, 1154 ctorFlags, based);
1162 ctorFlags, based); 1155 tree.defs = tree.defs.prepend(constrDef);
1163 tree.defs = tree.defs.prepend(constrDef); 1156 }
1164 } 1157 }
1165 } 1158
1166 1159 // enter symbols for 'this' into current scope.
1167 // enter symbols for 'this' into current scope. 1160 VarSymbol thisSym =
1168 VarSymbol thisSym = 1161 new VarSymbol(FINAL | HASINIT, names._this, c.type, c);
1169 new VarSymbol(FINAL | HASINIT, names._this, c.type, c); 1162 thisSym.pos = Position.FIRSTPOS;
1170 thisSym.pos = Position.FIRSTPOS; 1163 env.info.scope.enter(thisSym);
1171 env.info.scope.enter(thisSym); 1164 // if this is a class, enter symbol for 'super' into current scope.
1172 // if this is a class, enter symbol for 'super' into current scope. 1165 if ((c.flags_field & INTERFACE) == 0 &&
1173 if ((c.flags_field & INTERFACE) == 0 && 1166 ct.supertype_field.hasTag(CLASS)) {
1174 ct.supertype_field.hasTag(CLASS)) { 1167 VarSymbol superSym =
1175 VarSymbol superSym = 1168 new VarSymbol(FINAL | HASINIT, names._super,
1176 new VarSymbol(FINAL | HASINIT, names._super, 1169 ct.supertype_field, c);
1177 ct.supertype_field, c); 1170 superSym.pos = Position.FIRSTPOS;
1178 superSym.pos = Position.FIRSTPOS; 1171 env.info.scope.enter(superSym);
1179 env.info.scope.enter(superSym); 1172 }
1180 } 1173
1181 1174 // check that no package exists with same fully qualified name,
1182 // check that no package exists with same fully qualified name, 1175 // but admit classes in the unnamed package which have the same
1183 // but admit classes in the unnamed package which have the same 1176 // name as a top-level package.
1184 // name as a top-level package. 1177 if (checkClash &&
1185 if (checkClash && 1178 c.owner.kind == PCK && c.owner != syms.unnamedPackage &&
1186 c.owner.kind == PCK && c.owner != syms.unnamedPackage && 1179 reader.packageExists(c.fullname)) {
1187 reader.packageExists(c.fullname)) { 1180 log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c);
1188 log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c); 1181 }
1189 } 1182 if (c.owner.kind == PCK && (c.flags_field & PUBLIC) == 0 &&
1190 if (c.owner.kind == PCK && (c.flags_field & PUBLIC) == 0 && 1183 !env.toplevel.sourcefile.isNameCompatible(c.name.toString(),JavaFileObject.Kind.SOURCE)) {
1191 !env.toplevel.sourcefile.isNameCompatible(c.name.toString(),JavaFileObject.Kind.SOURCE)) { 1184 c.flags_field |= AUXILIARY;
1192 c.flags_field |= AUXILIARY; 1185 }
1193 } 1186 } catch (CompletionFailure ex) {
1194 } catch (CompletionFailure ex) { 1187 chk.completionError(tree.pos(), ex);
1195 chk.completionError(tree.pos(), ex); 1188 } finally {
1189 deferredLintHandler.setPos(prevLintPos);
1190 log.useSource(prev);
1191 }
1192
1193 // Enter all member fields and methods of a set of half completed
1194 // classes in a second phase.
1195 if (wasFirst) {
1196 try {
1197 while (halfcompleted.nonEmpty()) {
1198 Env<AttrContext> toFinish = halfcompleted.next();
1199 finish(toFinish);
1200 if (allowTypeAnnos) {
1201 typeAnnotations.organizeTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
1202 typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
1203 }
1204 }
1205 } finally {
1206 isFirst = true;
1207 }
1208 }
1196 } finally { 1209 } finally {
1197 deferredLintHandler.setPos(prevLintPos); 1210 annotate.enterDone();
1198 log.useSource(prev);
1199 }
1200
1201 // Enter all member fields and methods of a set of half completed
1202 // classes in a second phase.
1203 if (wasFirst) {
1204 try {
1205 while (halfcompleted.nonEmpty()) {
1206 Env<AttrContext> toFinish = halfcompleted.next();
1207 finish(toFinish);
1208 if (allowTypeAnnos) {
1209 typeAnnotations.organizeTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
1210 typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
1211 }
1212 }
1213 } finally {
1214 isFirst = true;
1215 }
1216 } 1211 }
1217 } 1212 }
1218 1213
1219 /* 1214 /*
1220 * If the symbol is non-null, attach the type annotation to it. 1215 * If the symbol is non-null, attach the type annotation to it.

mercurial