1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jan 13 21:28:38 2011 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Jan 14 09:45:04 2011 +0000 1.3 @@ -70,8 +70,6 @@ 1.4 public final boolean boxingEnabled; // = source.allowBoxing(); 1.5 public final boolean varargsEnabled; // = source.allowVarargs(); 1.6 public final boolean allowMethodHandles; 1.7 - public final boolean allowInvokeDynamic; 1.8 - public final boolean allowTransitionalJSR292; 1.9 private final boolean debugResolve; 1.10 1.11 Scope polymorphicSignatureScope; 1.12 @@ -111,13 +109,8 @@ 1.13 varargsEnabled = source.allowVarargs(); 1.14 Options options = Options.instance(context); 1.15 debugResolve = options.isSet("debugresolve"); 1.16 - allowTransitionalJSR292 = options.isSet("allowTransitionalJSR292"); 1.17 Target target = Target.instance(context); 1.18 - allowMethodHandles = allowTransitionalJSR292 || 1.19 - target.hasMethodHandles(); 1.20 - allowInvokeDynamic = (allowTransitionalJSR292 || 1.21 - target.hasInvokedynamic()) && 1.22 - options.isSet("invokedynamic"); 1.23 + allowMethodHandles = target.hasMethodHandles(); 1.24 polymorphicSignatureScope = new Scope(syms.noSymbol); 1.25 1.26 inapplicableMethodException = new InapplicableMethodException(diags); 1.27 @@ -336,8 +329,7 @@ 1.28 boolean useVarargs, 1.29 Warner warn) 1.30 throws Infer.InferenceException { 1.31 - boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) || 1.32 - isTransitionalDynamicCallSite(site, m); 1.33 + boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles; 1.34 if (useVarargs && (m.flags() & VARARGS) == 0) 1.35 throw inapplicableMethodException.setMessage(null); 1.36 Type mt = types.memberType(site, m); 1.37 @@ -346,10 +338,7 @@ 1.38 // need to inferred. 1.39 List<Type> tvars = env.info.tvars; 1.40 if (typeargtypes == null) typeargtypes = List.nil(); 1.41 - if (allowTransitionalJSR292 && polymorphicSignature && typeargtypes.nonEmpty()) { 1.42 - //transitional 292 call sites might have wrong number of targs 1.43 - } 1.44 - else if (mt.tag != FORALL && typeargtypes.nonEmpty()) { 1.45 + if (mt.tag != FORALL && typeargtypes.nonEmpty()) { 1.46 // This is not a polymorphic method, but typeargs are supplied 1.47 // which is fine, see JLS3 15.12.2.1 1.48 } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) { 1.49 @@ -387,7 +376,7 @@ 1.50 1.51 if (instNeeded) 1.52 return polymorphicSignature ? 1.53 - infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes, typeargtypes) : 1.54 + infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) : 1.55 infer.instantiateMethod(env, 1.56 tvars, 1.57 (MethodType)mt, 1.58 @@ -402,14 +391,6 @@ 1.59 return mt; 1.60 } 1.61 1.62 - boolean isTransitionalDynamicCallSite(Type site, Symbol sym) { 1.63 - return allowTransitionalJSR292 && // old logic that doesn't use annotations 1.64 - !sym.isPolymorphicSignatureInstance() && 1.65 - ((allowMethodHandles && site == syms.methodHandleType && // invokeExact, invokeGeneric, invoke 1.66 - (sym.name == names.invoke && sym.isPolymorphicSignatureGeneric())) || 1.67 - (site == syms.invokeDynamicType && allowInvokeDynamic)); // InvokeDynamic.XYZ 1.68 - } 1.69 - 1.70 /** Same but returns null instead throwing a NoInstanceException 1.71 */ 1.72 Type instantiate(Env<AttrContext> env, 1.73 @@ -1412,12 +1393,11 @@ 1.74 steps = steps.tail; 1.75 } 1.76 if (sym.kind >= AMBIGUOUS) { 1.77 - if (site.tsym.isPolymorphicSignatureGeneric() || 1.78 - isTransitionalDynamicCallSite(site, sym)) { 1.79 + if (site.tsym.isPolymorphicSignatureGeneric()) { 1.80 //polymorphic receiver - synthesize new method symbol 1.81 env.info.varArgs = false; 1.82 sym = findPolymorphicSignatureInstance(env, 1.83 - site, name, null, argtypes, typeargtypes); 1.84 + site, name, null, argtypes); 1.85 } 1.86 else { 1.87 //if nothing is found return the 'first' error 1.88 @@ -1431,7 +1411,7 @@ 1.89 //non-instantiated polymorphic signature - synthesize new method symbol 1.90 env.info.varArgs = false; 1.91 sym = findPolymorphicSignatureInstance(env, 1.92 - site, name, (MethodSymbol)sym, argtypes, typeargtypes); 1.93 + site, name, (MethodSymbol)sym, argtypes); 1.94 } 1.95 return sym; 1.96 } 1.97 @@ -1449,15 +1429,9 @@ 1.98 Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site, 1.99 Name name, 1.100 MethodSymbol spMethod, // sig. poly. method or null if none 1.101 - List<Type> argtypes, 1.102 - List<Type> typeargtypes) { 1.103 - if (typeargtypes.nonEmpty() && (site.tsym.isPolymorphicSignatureGeneric() || 1.104 - (spMethod != null && spMethod.isPolymorphicSignatureGeneric()))) { 1.105 - log.warning(env.tree.pos(), "type.parameter.on.polymorphic.signature"); 1.106 - } 1.107 - 1.108 + List<Type> argtypes) { 1.109 Type mtype = infer.instantiatePolymorphicSignatureInstance(env, 1.110 - site, name, spMethod, argtypes, typeargtypes); 1.111 + site, name, spMethod, argtypes); 1.112 long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE | 1.113 (spMethod != null ? 1.114 spMethod.flags() & Flags.AccessFlags :