diff -r ab1356297c67 -r 005bec70ca27 src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jun 17 16:28:21 2010 -0700 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Jun 18 15:12:04 2010 -0700 @@ -122,7 +122,6 @@ relax = (options.get("-retrofit") != null || options.get("-relax") != null); useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null; - allowInvokedynamic = options.get("invokedynamic") != null; enableSunApiLintControl = options.get("enableSunApiLintControl") != null; } @@ -155,10 +154,6 @@ */ boolean allowAnonOuterThis; - /** Switch: allow invokedynamic syntax - */ - boolean allowInvokedynamic; - /** * Switch: warn about use of variable before declaration? * RFE: 6425594 @@ -1384,9 +1379,15 @@ // as a special case, MethodHandle.invoke(abc) and InvokeDynamic.foo(abc) // has type , and T can be a primitive type. if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) { - Type selt = ((JCFieldAccess) tree.meth).selected.type; - if ((selt == syms.methodHandleType && methName == names.invoke) || selt == syms.invokeDynamicType) { + JCFieldAccess mfield = (JCFieldAccess) tree.meth; + if ((mfield.selected.type.tsym != null && + (mfield.selected.type.tsym.flags() & POLYMORPHIC_SIGNATURE) != 0) + || + (mfield.sym != null && + (mfield.sym.flags() & POLYMORPHIC_SIGNATURE) != 0)) { assert types.isSameType(restype, typeargtypes.head) : mtype; + assert mfield.selected.type == syms.methodHandleType + || mfield.selected.type == syms.invokeDynamicType; typeargtypesNonRefOK = true; } }