langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
changeset 8036 17b976649c61
parent 8032 e1aa25ccdabb
child 8045 df2ca0edfbaa
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Jan 13 21:28:38 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jan 14 09:45:04 2011 +0000
@@ -70,8 +70,6 @@
     public final boolean boxingEnabled; // = source.allowBoxing();
     public final boolean varargsEnabled; // = source.allowVarargs();
     public final boolean allowMethodHandles;
-    public final boolean allowInvokeDynamic;
-    public final boolean allowTransitionalJSR292;
     private final boolean debugResolve;
 
     Scope polymorphicSignatureScope;
@@ -111,13 +109,8 @@
         varargsEnabled = source.allowVarargs();
         Options options = Options.instance(context);
         debugResolve = options.isSet("debugresolve");
-        allowTransitionalJSR292 = options.isSet("allowTransitionalJSR292");
         Target target = Target.instance(context);
-        allowMethodHandles = allowTransitionalJSR292 ||
-                target.hasMethodHandles();
-        allowInvokeDynamic = (allowTransitionalJSR292 ||
-                target.hasInvokedynamic()) &&
-                options.isSet("invokedynamic");
+        allowMethodHandles = target.hasMethodHandles();
         polymorphicSignatureScope = new Scope(syms.noSymbol);
 
         inapplicableMethodException = new InapplicableMethodException(diags);
@@ -336,8 +329,7 @@
                         boolean useVarargs,
                         Warner warn)
         throws Infer.InferenceException {
-        boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) ||
-                                        isTransitionalDynamicCallSite(site, m);
+        boolean polymorphicSignature = m.isPolymorphicSignatureGeneric() && allowMethodHandles;
         if (useVarargs && (m.flags() & VARARGS) == 0)
             throw inapplicableMethodException.setMessage(null);
         Type mt = types.memberType(site, m);
@@ -346,10 +338,7 @@
         // need to inferred.
         List<Type> tvars = env.info.tvars;
         if (typeargtypes == null) typeargtypes = List.nil();
-        if (allowTransitionalJSR292 && polymorphicSignature && typeargtypes.nonEmpty()) {
-            //transitional 292 call sites might have wrong number of targs
-        }
-        else if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
+        if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
             // This is not a polymorphic method, but typeargs are supplied
             // which is fine, see JLS3 15.12.2.1
         } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) {
@@ -387,7 +376,7 @@
 
         if (instNeeded)
             return polymorphicSignature ?
-                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes, typeargtypes) :
+                infer.instantiatePolymorphicSignatureInstance(env, site, m.name, (MethodSymbol)m, argtypes) :
                 infer.instantiateMethod(env,
                                     tvars,
                                     (MethodType)mt,
@@ -402,14 +391,6 @@
         return mt;
     }
 
-    boolean isTransitionalDynamicCallSite(Type site, Symbol sym) {
-        return allowTransitionalJSR292 &&  // old logic that doesn't use annotations
-                !sym.isPolymorphicSignatureInstance() &&
-                ((allowMethodHandles && site == syms.methodHandleType && // invokeExact, invokeGeneric, invoke
-                    (sym.name == names.invoke && sym.isPolymorphicSignatureGeneric())) ||
-                (site == syms.invokeDynamicType && allowInvokeDynamic)); // InvokeDynamic.XYZ
-    }
-
     /** Same but returns null instead throwing a NoInstanceException
      */
     Type instantiate(Env<AttrContext> env,
@@ -1412,12 +1393,11 @@
             steps = steps.tail;
         }
         if (sym.kind >= AMBIGUOUS) {
-            if (site.tsym.isPolymorphicSignatureGeneric() ||
-                    isTransitionalDynamicCallSite(site, sym)) {
+            if (site.tsym.isPolymorphicSignatureGeneric()) {
                 //polymorphic receiver - synthesize new method symbol
                 env.info.varArgs = false;
                 sym = findPolymorphicSignatureInstance(env,
-                        site, name, null, argtypes, typeargtypes);
+                        site, name, null, argtypes);
             }
             else {
                 //if nothing is found return the 'first' error
@@ -1431,7 +1411,7 @@
             //non-instantiated polymorphic signature - synthesize new method symbol
             env.info.varArgs = false;
             sym = findPolymorphicSignatureInstance(env,
-                    site, name, (MethodSymbol)sym, argtypes, typeargtypes);
+                    site, name, (MethodSymbol)sym, argtypes);
         }
         return sym;
     }
@@ -1449,15 +1429,9 @@
     Symbol findPolymorphicSignatureInstance(Env<AttrContext> env, Type site,
                                             Name name,
                                             MethodSymbol spMethod,  // sig. poly. method or null if none
-                                            List<Type> argtypes,
-                                            List<Type> typeargtypes) {
-        if (typeargtypes.nonEmpty() && (site.tsym.isPolymorphicSignatureGeneric() ||
-                (spMethod != null && spMethod.isPolymorphicSignatureGeneric()))) {
-            log.warning(env.tree.pos(), "type.parameter.on.polymorphic.signature");
-        }
-
+                                            List<Type> argtypes) {
         Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
-                site, name, spMethod, argtypes, typeargtypes);
+                site, name, spMethod, argtypes);
         long flags = ABSTRACT | HYPOTHETICAL | POLYMORPHIC_SIGNATURE |
                     (spMethod != null ?
                         spMethod.flags() & Flags.AccessFlags :