57 Check chk; |
57 Check chk; |
58 Infer infer; |
58 Infer infer; |
59 ClassReader reader; |
59 ClassReader reader; |
60 TreeInfo treeinfo; |
60 TreeInfo treeinfo; |
61 Types types; |
61 Types types; |
|
62 JCDiagnostic.Factory diags; |
62 public final boolean boxingEnabled; // = source.allowBoxing(); |
63 public final boolean boxingEnabled; // = source.allowBoxing(); |
63 public final boolean varargsEnabled; // = source.allowVarargs(); |
64 public final boolean varargsEnabled; // = source.allowVarargs(); |
64 private final boolean debugResolve; |
65 private final boolean debugResolve; |
65 |
66 |
66 public static Resolve instance(Context context) { |
67 public static Resolve instance(Context context) { |
90 chk = Check.instance(context); |
91 chk = Check.instance(context); |
91 infer = Infer.instance(context); |
92 infer = Infer.instance(context); |
92 reader = ClassReader.instance(context); |
93 reader = ClassReader.instance(context); |
93 treeinfo = TreeInfo.instance(context); |
94 treeinfo = TreeInfo.instance(context); |
94 types = Types.instance(context); |
95 types = Types.instance(context); |
|
96 diags = JCDiagnostic.Factory.instance(context); |
95 Source source = Source.instance(context); |
97 Source source = Source.instance(context); |
96 boxingEnabled = source.allowBoxing(); |
98 boxingEnabled = source.allowBoxing(); |
97 varargsEnabled = source.allowVarargs(); |
99 varargsEnabled = source.allowVarargs(); |
98 Options options = Options.instance(context); |
100 Options options = Options.instance(context); |
99 debugResolve = options.get("debugresolve") != null; |
101 debugResolve = options.get("debugresolve") != null; |
447 public VarSymbol resolveInternalField(DiagnosticPosition pos, Env<AttrContext> env, |
449 public VarSymbol resolveInternalField(DiagnosticPosition pos, Env<AttrContext> env, |
448 Type site, Name name) { |
450 Type site, Name name) { |
449 Symbol sym = findField(env, site, name, site.tsym); |
451 Symbol sym = findField(env, site, name, site.tsym); |
450 if (sym.kind == VAR) return (VarSymbol)sym; |
452 if (sym.kind == VAR) return (VarSymbol)sym; |
451 else throw new FatalError( |
453 else throw new FatalError( |
452 JCDiagnostic.fragment("fatal.err.cant.locate.field", |
454 diags.fragment("fatal.err.cant.locate.field", |
453 name)); |
455 name)); |
454 } |
456 } |
455 |
457 |
456 /** Find unqualified variable or field with given name. |
458 /** Find unqualified variable or field with given name. |
457 * Synthetic fields always skipped. |
459 * Synthetic fields always skipped. |
1246 List<Type> typeargtypes) { |
1248 List<Type> typeargtypes) { |
1247 Symbol sym = resolveQualifiedMethod( |
1249 Symbol sym = resolveQualifiedMethod( |
1248 pos, env, site, name, argtypes, typeargtypes); |
1250 pos, env, site, name, argtypes, typeargtypes); |
1249 if (sym.kind == MTH) return (MethodSymbol)sym; |
1251 if (sym.kind == MTH) return (MethodSymbol)sym; |
1250 else throw new FatalError( |
1252 else throw new FatalError( |
1251 JCDiagnostic.fragment("fatal.err.cant.locate.meth", |
1253 diags.fragment("fatal.err.cant.locate.meth", |
1252 name)); |
1254 name)); |
1253 } |
1255 } |
1254 |
1256 |
1255 /** Resolve constructor. |
1257 /** Resolve constructor. |
1256 * @param pos The position to use for error reporting. |
1258 * @param pos The position to use for error reporting. |
1318 List<Type> typeargtypes) { |
1320 List<Type> typeargtypes) { |
1319 Symbol sym = resolveConstructor( |
1321 Symbol sym = resolveConstructor( |
1320 pos, env, site, argtypes, typeargtypes); |
1322 pos, env, site, argtypes, typeargtypes); |
1321 if (sym.kind == MTH) return (MethodSymbol)sym; |
1323 if (sym.kind == MTH) return (MethodSymbol)sym; |
1322 else throw new FatalError( |
1324 else throw new FatalError( |
1323 JCDiagnostic.fragment("fatal.err.cant.locate.ctor", site)); |
1325 diags.fragment("fatal.err.cant.locate.ctor", site)); |
1324 } |
1326 } |
1325 |
1327 |
1326 /** Resolve operator. |
1328 /** Resolve operator. |
1327 * @param pos The position to use for error reporting. |
1329 * @param pos The position to use for error reporting. |
1328 * @param optag The tag of the operation tree. |
1330 * @param optag The tag of the operation tree. |