src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 573
005bec70ca27
parent 567
593a59e40bdb
parent 571
f0e3ec1f9d9f
child 591
d1d7595fa824
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 17 16:28:21 2010 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jun 18 15:12:04 2010 -0700
     1.3 @@ -122,7 +122,6 @@
     1.4          relax = (options.get("-retrofit") != null ||
     1.5                   options.get("-relax") != null);
     1.6          useBeforeDeclarationWarning = options.get("useBeforeDeclarationWarning") != null;
     1.7 -        allowInvokedynamic = options.get("invokedynamic") != null;
     1.8          enableSunApiLintControl = options.get("enableSunApiLintControl") != null;
     1.9      }
    1.10  
    1.11 @@ -155,10 +154,6 @@
    1.12       */
    1.13      boolean allowAnonOuterThis;
    1.14  
    1.15 -    /** Switch: allow invokedynamic syntax
    1.16 -     */
    1.17 -    boolean allowInvokedynamic;
    1.18 -
    1.19      /**
    1.20       * Switch: warn about use of variable before declaration?
    1.21       * RFE: 6425594
    1.22 @@ -1384,9 +1379,15 @@
    1.23              // as a special case, MethodHandle.<T>invoke(abc) and InvokeDynamic.<T>foo(abc)
    1.24              // has type <T>, and T can be a primitive type.
    1.25              if (tree.meth.getTag() == JCTree.SELECT && !typeargtypes.isEmpty()) {
    1.26 -              Type selt = ((JCFieldAccess) tree.meth).selected.type;
    1.27 -              if ((selt == syms.methodHandleType && methName == names.invoke) || selt == syms.invokeDynamicType) {
    1.28 +              JCFieldAccess mfield = (JCFieldAccess) tree.meth;
    1.29 +              if ((mfield.selected.type.tsym != null &&
    1.30 +                   (mfield.selected.type.tsym.flags() & POLYMORPHIC_SIGNATURE) != 0)
    1.31 +                  ||
    1.32 +                  (mfield.sym != null &&
    1.33 +                   (mfield.sym.flags() & POLYMORPHIC_SIGNATURE) != 0)) {
    1.34                    assert types.isSameType(restype, typeargtypes.head) : mtype;
    1.35 +                  assert mfield.selected.type == syms.methodHandleType
    1.36 +                      || mfield.selected.type == syms.invokeDynamicType;
    1.37                    typeargtypesNonRefOK = true;
    1.38                }
    1.39              }

mercurial