changeset 50:d135a49a1ff7

meth: tweak error checks regarding PolymorphicSignatures attributes
author jrose
date Wed, 21 Apr 2010 23:38:10 -0700
parents ab871ff01a91
children 30b47eb3dafb
files meth-ing-6939134.patch
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/meth-ing-6939134.patch	Tue Mar 30 03:36:05 2010 -0700
+++ b/meth-ing-6939134.patch	Wed Apr 21 23:38:10 2010 -0700
@@ -1,13 +1,17 @@
 6939134: JSR 292 adjustments to method handle invocation
 Summary: split MethodHandle.invoke into invokeExact and invokeGeneric
 Mark the special signature-polymorpic methods and classes with @PolymorphicSignature.
-Reviewed-by: ?
+Reviewed-by: twisti(?)
 
 The JSR 292 EG has decided to split MethodHandle.invoke into two
 methods, invokeExact and invokeGeneric.  Adjust javac so that it uses
-a marker annotation (@PolymorphicSignature) to recognize which methods
-are signature-polymorphic.  Remove hard-coded recognition of
-MethodHandle.invoke and InvokeDynamic.
+an empty attribute 'PolyMorphicSignature' to recognize which methods
+are signature-polymorphic.  Drive emission of this attribute from
+a package-private annotation (@PolymorphicSignature).  Remove
+hard-coded recognition of MethodHandle.invoke and InvokeDynamic.
+
+For the relevant parts of the language specification, see:
+  http://wikis.sun.com/display/mlvm/InterfaceDynamic
 
 diff --git a/src/share/classes/com/sun/tools/javac/code/Flags.java b/src/share/classes/com/sun/tools/javac/code/Flags.java
 --- a/src/share/classes/com/sun/tools/javac/code/Flags.java
@@ -227,7 +231,7 @@
                  }
              },
  
-+            new AttributeReader(names.PolymorphicSignature, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
++            new AttributeReader(names.PolymorphicSignature, V45_3/*S.B.V51*/, CLASS_OR_MEMBER_ATTRIBUTE) {
 +                void read(Symbol sym, int attrLen) {
 +                    sym.flags_field |= POLYMORPHIC_SIGNATURE;
 +                }
@@ -239,11 +243,13 @@
 diff --git a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
-@@ -651,6 +651,11 @@
+@@ -651,6 +651,13 @@
              endAttr(alenIdx);
              acount++;
          }
 +        if ((flags & POLYMORPHIC_SIGNATURE) != 0) {
++            if (target.majorVersion < 51)
++                throw new AssertionError("PolymorphicSignature attributes in java/dyn must be written with -target 7 (required major version is 51, current is"+target.majorVersion+")");
 +            int alenIdx = writeAttr(names.PolymorphicSignature);
 +            endAttr(alenIdx);
 +            acount++;