diff --git a/src/share/classes/com/sun/tools/javac/code/Flags.java b/src/share/classes/com/sun/tools/javac/code/Flags.java index e681ee56c411b7f10207d56c857292712d42c71c..a9e314f8d879d1db9cd2778b59d5eb0e5a0de3f8 100644 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java +++ b/src/share/classes/com/sun/tools/javac/code/Flags.java @@ -237,7 +237,7 @@ public class Flags { /** * Flag that marks a signature-polymorphic invoke method. - * (These occur inside java.dyn.MethodHandle.) + * (These occur inside java.lang.invoke.MethodHandle.) */ public static final long POLYMORPHIC_SIGNATURE = 1L<<40; diff --git a/src/share/classes/com/sun/tools/javac/code/Symtab.java b/src/share/classes/com/sun/tools/javac/code/Symtab.java index bf3e68acd4be1103e02fa44631f243da05238560..48996a045a3ed06b41774f4a8ddaccb5b9a738ed 100644 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java @@ -124,7 +124,9 @@ public class Symtab { public final Type stringBuilderType; public final Type cloneableType; public final Type serializableType; + public final Type transientMethodHandleType; // transient - 292 public final Type methodHandleType; + public final Type transientPolymorphicSignatureType; // transient - 292 public final Type polymorphicSignatureType; public final Type throwableType; public final Type errorType; @@ -419,8 +421,10 @@ public class Symtab { cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); - methodHandleType = enterClass("java.dyn.MethodHandle"); - polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); + transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292 + methodHandleType = enterClass("java.lang.invoke.MethodHandle"); + transientPolymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); // transient - 292 + polymorphicSignatureType = enterClass("java.lang.invoke.MethodHandle$PolymorphicSignature"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); exceptionType = enterClass("java.lang.Exception"); @@ -464,6 +468,7 @@ public class Symtab { synthesizeEmptyInterfaceIfMissing(cloneableType); synthesizeEmptyInterfaceIfMissing(serializableType); + synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292 synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType); synthesizeBoxTypeIfMissing(doubleType); synthesizeBoxTypeIfMissing(floatType); diff --git a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java index 89b3e20055d64c2a689978fcfbf6415c8363bf83..d6ae40631a538b6a730adb51448648d966b06d31 100644 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java @@ -787,10 +787,11 @@ public class MemberEnter extends JCTree.Visitor implements Completer { && s.owner.kind != MTH && types.isSameType(c.type, syms.deprecatedType)) s.flags_field |= Flags.DEPRECATED; - // Internally to java.dyn, a @PolymorphicSignature annotation + // Internally to java.lang.invoke, a @PolymorphicSignature annotation // acts like a classfile attribute. if (!c.type.isErroneous() && - types.isSameType(c.type, syms.polymorphicSignatureType)) { + (types.isSameType(c.type, syms.polymorphicSignatureType) || + types.isSameType(c.type, syms.transientPolymorphicSignatureType))) { if (!target.hasMethodHandles()) { // Somebody is compiling JDK7 source code to a JDK6 target. // Make it an error, since it is unlikely but important. diff --git a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 0a973f2276c1257e41eb0fb8121ab16325f1afd8..c81d9026de88587145803636ea07826460bc95ee 100644 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -1321,7 +1321,9 @@ public class ClassReader implements Completer { sym.flags_field |= PROPRIETARY; else proxies.append(proxy); - if (majorVersion >= V51.major && proxy.type.tsym == syms.polymorphicSignatureType.tsym) { + if (majorVersion >= V51.major && + (proxy.type.tsym == syms.polymorphicSignatureType.tsym || + proxy.type.tsym == syms.transientPolymorphicSignatureType.tsym)) { sym.flags_field |= POLYMORPHIC_SIGNATURE; } } diff --git a/src/share/classes/com/sun/tools/javac/util/Names.java b/src/share/classes/com/sun/tools/javac/util/Names.java index 1dfff5662f625a4169336c84b412ffe1e1c6bce1..995d4bfff687d803942a9a5cfb7ae296419a8710 100644 --- a/src/share/classes/com/sun/tools/javac/util/Names.java +++ b/src/share/classes/com/sun/tools/javac/util/Names.java @@ -73,7 +73,8 @@ public class Names { public final Name java_io_Serializable; public final Name serialVersionUID; public final Name java_lang_Enum; - public final Name java_dyn_MethodHandle; + public final Name transient_java_dyn_MethodHandle; // transient - 292 + public final Name java_lang_invoke_MethodHandle; public final Name package_info; public final Name ConstantValue; public final Name LineNumberTable; @@ -183,7 +184,8 @@ public class Names { java_lang_Cloneable = fromString("java.lang.Cloneable"); java_io_Serializable = fromString("java.io.Serializable"); java_lang_Enum = fromString("java.lang.Enum"); - java_dyn_MethodHandle = fromString("java.dyn.MethodHandle"); + transient_java_dyn_MethodHandle = fromString("java.dyn.MethodHandle"); //transient - 292 + java_lang_invoke_MethodHandle = fromString("java.lang.invoke.MethodHandle"); package_info = fromString("package-info"); serialVersionUID = fromString("serialVersionUID"); ConstantValue = fromString("ConstantValue");