src/share/classes/com/sun/tools/javac/jvm/ClassReader.java

Print this page




1118     }
1119 
1120 
1121 
1122     void readEnclosingMethodAttr(Symbol sym) {
1123         // sym is a nested class with an "Enclosing Method" attribute
1124         // remove sym from it's current owners scope and place it in
1125         // the scope specified by the attribute
1126         sym.owner.members().remove(sym);
1127         ClassSymbol self = (ClassSymbol)sym;
1128         ClassSymbol c = readClassSymbol(nextChar());
1129         NameAndType nt = (NameAndType)readPool(nextChar());
1130 
1131         MethodSymbol m = findMethod(nt, c.members_field, self.flags());
1132         if (nt != null && m == null)
1133             throw badClassFile("bad.enclosing.method", self);
1134 
1135         self.name = simpleBinaryName(self.flatname, c.flatname) ;
1136         self.owner = m != null ? m : c;
1137         if (self.name.isEmpty())
1138             self.fullname = null;
1139         else
1140             self.fullname = ClassSymbol.formFullName(self.name, self.owner);
1141 
1142         if (m != null) {
1143             ((ClassType)sym.type).setEnclosingType(m.type);
1144         } else if ((self.flags_field & STATIC) == 0) {
1145             ((ClassType)sym.type).setEnclosingType(c.type);
1146         } else {
1147             ((ClassType)sym.type).setEnclosingType(Type.noType);
1148         }
1149         enterTypevars(self);
1150         if (!missingTypeVariables.isEmpty()) {
1151             ListBuffer<Type> typeVars =  new ListBuffer<Type>();
1152             for (Type typevar : missingTypeVariables) {
1153                 typeVars.append(findTypeVar(typevar.tsym.name));
1154             }
1155             foundTypeVariables = typeVars.toList();
1156         } else {
1157             foundTypeVariables = List.nil();
1158         }




1118     }
1119 
1120 
1121 
1122     void readEnclosingMethodAttr(Symbol sym) {
1123         // sym is a nested class with an "Enclosing Method" attribute
1124         // remove sym from it's current owners scope and place it in
1125         // the scope specified by the attribute
1126         sym.owner.members().remove(sym);
1127         ClassSymbol self = (ClassSymbol)sym;
1128         ClassSymbol c = readClassSymbol(nextChar());
1129         NameAndType nt = (NameAndType)readPool(nextChar());
1130 
1131         MethodSymbol m = findMethod(nt, c.members_field, self.flags());
1132         if (nt != null && m == null)
1133             throw badClassFile("bad.enclosing.method", self);
1134 
1135         self.name = simpleBinaryName(self.flatname, c.flatname) ;
1136         self.owner = m != null ? m : c;
1137         if (self.name.isEmpty())
1138             self.fullname = names.empty;
1139         else
1140             self.fullname = ClassSymbol.formFullName(self.name, self.owner);
1141 
1142         if (m != null) {
1143             ((ClassType)sym.type).setEnclosingType(m.type);
1144         } else if ((self.flags_field & STATIC) == 0) {
1145             ((ClassType)sym.type).setEnclosingType(c.type);
1146         } else {
1147             ((ClassType)sym.type).setEnclosingType(Type.noType);
1148         }
1149         enterTypevars(self);
1150         if (!missingTypeVariables.isEmpty()) {
1151             ListBuffer<Type> typeVars =  new ListBuffer<Type>();
1152             for (Type typevar : missingTypeVariables) {
1153                 typeVars.append(findTypeVar(typevar.tsym.name));
1154             }
1155             foundTypeVariables = typeVars.toList();
1156         } else {
1157             foundTypeVariables = List.nil();
1158         }