--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Jul 05 17:11:12 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat May 01 15:05:39 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
@@ -1377,9 +1372,15 @@
// as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
// has type <T>, 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;
}
}