75 private final Types types; |
75 private final Types types; |
76 private final JCDiagnostic.Factory diags; |
76 private final JCDiagnostic.Factory diags; |
77 private final Target target; |
77 private final Target target; |
78 |
78 |
79 private final boolean skipAnnotations; |
79 private final boolean skipAnnotations; |
|
80 private final boolean allowSimplifiedVarargs; |
80 |
81 |
81 public static MemberEnter instance(Context context) { |
82 public static MemberEnter instance(Context context) { |
82 MemberEnter instance = context.get(memberEnterKey); |
83 MemberEnter instance = context.get(memberEnterKey); |
83 if (instance == null) |
84 if (instance == null) |
84 instance = new MemberEnter(context); |
85 instance = new MemberEnter(context); |
101 types = Types.instance(context); |
102 types = Types.instance(context); |
102 diags = JCDiagnostic.Factory.instance(context); |
103 diags = JCDiagnostic.Factory.instance(context); |
103 target = Target.instance(context); |
104 target = Target.instance(context); |
104 Options options = Options.instance(context); |
105 Options options = Options.instance(context); |
105 skipAnnotations = options.isSet("skipAnnotations"); |
106 skipAnnotations = options.isSet("skipAnnotations"); |
|
107 Source source = Source.instance(context); |
|
108 allowSimplifiedVarargs = source.allowSimplifiedVarargs(); |
106 } |
109 } |
107 |
110 |
108 /** A queue for classes whose members still need to be entered into the |
111 /** A queue for classes whose members still need to be entered into the |
109 * symbol table. |
112 * symbol table. |
110 */ |
113 */ |
615 (env.info.scope.owner.flags() & INTERFACE) != 0) { |
618 (env.info.scope.owner.flags() & INTERFACE) != 0) { |
616 localEnv = env.dup(tree, env.info.dup()); |
619 localEnv = env.dup(tree, env.info.dup()); |
617 localEnv.info.staticLevel++; |
620 localEnv.info.staticLevel++; |
618 } |
621 } |
619 attr.attribType(tree.vartype, localEnv); |
622 attr.attribType(tree.vartype, localEnv); |
|
623 if ((tree.mods.flags & VARARGS) != 0) { |
|
624 //if we are entering a varargs parameter, we need to replace its type |
|
625 //(a plain array type) with the more precise VarargsType --- we need |
|
626 //to do it this way because varargs is represented in the tree as a modifier |
|
627 //on the parameter declaration, and not as a distinct type of array node. |
|
628 ArrayType atype = (ArrayType)tree.vartype.type; |
|
629 tree.vartype.type = atype.makeVarargs(); |
|
630 } |
620 Scope enclScope = enter.enterScope(env); |
631 Scope enclScope = enter.enterScope(env); |
621 VarSymbol v = |
632 VarSymbol v = |
622 new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); |
633 new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner); |
623 v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); |
634 v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree); |
624 tree.sym = v; |
635 tree.sym = v; |