提交 4203308b 编写于 作者: M mcimadamore

7017414: before the move of JSR 292 to package java.lang.invoke, javac must...

7017414: before the move of JSR 292 to package java.lang.invoke, javac must recognize the new package
Summary: added support for future 292 package (support for old location 'java.dyn' will be removed in followup changeset)
Reviewed-by: jjg
上级 e5021a5a
...@@ -237,7 +237,7 @@ public class Flags { ...@@ -237,7 +237,7 @@ public class Flags {
/** /**
* Flag that marks a signature-polymorphic invoke method. * 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; public static final long POLYMORPHIC_SIGNATURE = 1L<<40;
......
...@@ -124,7 +124,9 @@ public class Symtab { ...@@ -124,7 +124,9 @@ public class Symtab {
public final Type stringBuilderType; public final Type stringBuilderType;
public final Type cloneableType; public final Type cloneableType;
public final Type serializableType; public final Type serializableType;
public final Type transientMethodHandleType; // transient - 292
public final Type methodHandleType; public final Type methodHandleType;
public final Type transientPolymorphicSignatureType; // transient - 292
public final Type polymorphicSignatureType; public final Type polymorphicSignatureType;
public final Type throwableType; public final Type throwableType;
public final Type errorType; public final Type errorType;
...@@ -419,8 +421,10 @@ public class Symtab { ...@@ -419,8 +421,10 @@ public class Symtab {
cloneableType = enterClass("java.lang.Cloneable"); cloneableType = enterClass("java.lang.Cloneable");
throwableType = enterClass("java.lang.Throwable"); throwableType = enterClass("java.lang.Throwable");
serializableType = enterClass("java.io.Serializable"); serializableType = enterClass("java.io.Serializable");
methodHandleType = enterClass("java.dyn.MethodHandle"); transientMethodHandleType = enterClass("java.dyn.MethodHandle"); // transient - 292
polymorphicSignatureType = enterClass("java.dyn.MethodHandle$PolymorphicSignature"); 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"); errorType = enterClass("java.lang.Error");
illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException");
exceptionType = enterClass("java.lang.Exception"); exceptionType = enterClass("java.lang.Exception");
...@@ -464,6 +468,7 @@ public class Symtab { ...@@ -464,6 +468,7 @@ public class Symtab {
synthesizeEmptyInterfaceIfMissing(cloneableType); synthesizeEmptyInterfaceIfMissing(cloneableType);
synthesizeEmptyInterfaceIfMissing(serializableType); synthesizeEmptyInterfaceIfMissing(serializableType);
synthesizeEmptyInterfaceIfMissing(transientPolymorphicSignatureType); // transient - 292
synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType); synthesizeEmptyInterfaceIfMissing(polymorphicSignatureType);
synthesizeBoxTypeIfMissing(doubleType); synthesizeBoxTypeIfMissing(doubleType);
synthesizeBoxTypeIfMissing(floatType); synthesizeBoxTypeIfMissing(floatType);
......
...@@ -787,10 +787,11 @@ public class MemberEnter extends JCTree.Visitor implements Completer { ...@@ -787,10 +787,11 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
&& s.owner.kind != MTH && s.owner.kind != MTH
&& types.isSameType(c.type, syms.deprecatedType)) && types.isSameType(c.type, syms.deprecatedType))
s.flags_field |= Flags.DEPRECATED; 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. // acts like a classfile attribute.
if (!c.type.isErroneous() && 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()) { if (!target.hasMethodHandles()) {
// Somebody is compiling JDK7 source code to a JDK6 target. // Somebody is compiling JDK7 source code to a JDK6 target.
// Make it an error, since it is unlikely but important. // Make it an error, since it is unlikely but important.
......
...@@ -1321,7 +1321,9 @@ public class ClassReader implements Completer { ...@@ -1321,7 +1321,9 @@ public class ClassReader implements Completer {
sym.flags_field |= PROPRIETARY; sym.flags_field |= PROPRIETARY;
else else
proxies.append(proxy); 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; sym.flags_field |= POLYMORPHIC_SIGNATURE;
} }
} }
......
...@@ -73,7 +73,8 @@ public class Names { ...@@ -73,7 +73,8 @@ public class Names {
public final Name java_io_Serializable; public final Name java_io_Serializable;
public final Name serialVersionUID; public final Name serialVersionUID;
public final Name java_lang_Enum; 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 package_info;
public final Name ConstantValue; public final Name ConstantValue;
public final Name LineNumberTable; public final Name LineNumberTable;
...@@ -183,7 +184,8 @@ public class Names { ...@@ -183,7 +184,8 @@ public class Names {
java_lang_Cloneable = fromString("java.lang.Cloneable"); java_lang_Cloneable = fromString("java.lang.Cloneable");
java_io_Serializable = fromString("java.io.Serializable"); java_io_Serializable = fromString("java.io.Serializable");
java_lang_Enum = fromString("java.lang.Enum"); 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"); package_info = fromString("package-info");
serialVersionUID = fromString("serialVersionUID"); serialVersionUID = fromString("serialVersionUID");
ConstantValue = fromString("ConstantValue"); ConstantValue = fromString("ConstantValue");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册