< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java

Print this page




 897                 boolean based = false;
 898                 boolean addConstructor = true;
 899                 JCNewClass nc = null;
 900                 if (sym.name.isEmpty()) {
 901                     nc = (JCNewClass)env.next.tree;
 902                     if (nc.constructor != null) {
 903                         addConstructor = nc.constructor.kind != ERR;
 904                         Type superConstrType = types.memberType(sym.type,
 905                                                                 nc.constructor);
 906                         argtypes = superConstrType.getParameterTypes();
 907                         typarams = superConstrType.getTypeArguments();
 908                         ctorFlags = nc.constructor.flags() & VARARGS;
 909                         if (nc.encl != null) {
 910                             argtypes = argtypes.prepend(nc.encl.type);
 911                             based = true;
 912                         }
 913                         thrown = superConstrType.getThrownTypes();
 914                     }
 915                 }
 916                 if (addConstructor) {


 917                     MethodSymbol basedConstructor = nc != null ?
 918                             (MethodSymbol)nc.constructor : null;
 919                     JCTree constrDef = DefaultConstructor(make.at(tree.pos), sym,
 920                                                         basedConstructor,
 921                                                         typarams, argtypes, thrown,
 922                                                         ctorFlags, based);
 923                     tree.defs = tree.defs.prepend(constrDef);
 924                 }
 925             }
 926 
 927             // enter symbols for 'this' into current scope.
 928             VarSymbol thisSym =
 929                 new VarSymbol(FINAL | HASINIT, names._this, sym.type, sym);
 930             thisSym.pos = Position.FIRSTPOS;
 931             env.info.scope.enter(thisSym);
 932             // if this is a class, enter symbol for 'super' into current scope.
 933             if ((sym.flags_field & INTERFACE) == 0 &&
 934                     ct.supertype_field.hasTag(CLASS)) {
 935                 VarSymbol superSym =
 936                     new VarSymbol(FINAL | HASINIT, names._super,




 897                 boolean based = false;
 898                 boolean addConstructor = true;
 899                 JCNewClass nc = null;
 900                 if (sym.name.isEmpty()) {
 901                     nc = (JCNewClass)env.next.tree;
 902                     if (nc.constructor != null) {
 903                         addConstructor = nc.constructor.kind != ERR;
 904                         Type superConstrType = types.memberType(sym.type,
 905                                                                 nc.constructor);
 906                         argtypes = superConstrType.getParameterTypes();
 907                         typarams = superConstrType.getTypeArguments();
 908                         ctorFlags = nc.constructor.flags() & VARARGS;
 909                         if (nc.encl != null) {
 910                             argtypes = argtypes.prepend(nc.encl.type);
 911                             based = true;
 912                         }
 913                         thrown = superConstrType.getThrownTypes();
 914                     }
 915                 }
 916                 if (addConstructor) {
 917                     // Lint check here
 918                     chk.checkDefaultConstructor(sym);
 919                     MethodSymbol basedConstructor = nc != null ?
 920                             (MethodSymbol)nc.constructor : null;
 921                     JCTree constrDef = DefaultConstructor(make.at(tree.pos), sym,
 922                                                         basedConstructor,
 923                                                         typarams, argtypes, thrown,
 924                                                         ctorFlags, based);
 925                     tree.defs = tree.defs.prepend(constrDef);
 926                 }
 927             }
 928 
 929             // enter symbols for 'this' into current scope.
 930             VarSymbol thisSym =
 931                 new VarSymbol(FINAL | HASINIT, names._this, sym.type, sym);
 932             thisSym.pos = Position.FIRSTPOS;
 933             env.info.scope.enter(thisSym);
 934             // if this is a class, enter symbol for 'super' into current scope.
 935             if ((sym.flags_field & INTERFACE) == 0 &&
 936                     ct.supertype_field.hasTag(CLASS)) {
 937                 VarSymbol superSym =
 938                     new VarSymbol(FINAL | HASINIT, names._super,


< prev index next >