changeset 53:423e18903e43

meth-ver-6949040.patch
author jrose
date Sat, 01 May 2010 20:06:38 -0700
parents f8ba90f78b93
children c2c8c3c2e692
files meth-ver-6949040.patch series
diffstat 2 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/meth-ver-6949040.patch	Sat May 01 20:06:38 2010 -0700
@@ -0,0 +1,29 @@
+6949040: java.dyn package must be compiled with -target 7 or better
+Reviewed-by: ?
+
+Three names in the java.dyn have polymorphic signatures, and are marked as such in source code with a private annotation (@PolymorphicSignature) and in class files with a new attribute (PolymorphicSignature).
+
+If the java.dyn package is compiled with -target 6 (or earlier), there is a risk that javac will emit the PolymorphicSignature attribute into the classfile (for InvokeDynamic or MethodHandle), but due to the retrograde class file version, the attribute will be ignored.  This in turn will cause JSR 292 code to surprisingly fail to compile (since no signatures will be polymorphic).
+
+The solution is twofold:
+
+1. Do not allow @PolymorphicSignature to be used unless the -target option is 7 or better.  This logic is already in sun.tools.javac.jvm.ClassFile in the changeset for bug 6939134.
+
+2. Even if class files have retrograde version numbers, accept PolymorphicSignature attributes at face value.
+
+Step 2 will expire after a grace period, since step 1 ensures that class files will no longer need step 2.  This bug track the end of the grace period.
+
+The fix is simple:  Change ClassReader to read the attribute only in the correct classfile versions.
+
+diff --git a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
++++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+@@ -1098,7 +1098,7 @@
+                 }
+             },
+ 
+-            new AttributeReader(names.PolymorphicSignature, V45_3/*S.B.V51*/, CLASS_OR_MEMBER_ATTRIBUTE) {
++            new AttributeReader(names.PolymorphicSignature, V51, CLASS_OR_MEMBER_ATTRIBUTE) {
+                 void read(Symbol sym, int attrLen) {
+                     sym.flags_field |= POLYMORPHIC_SIGNATURE;
+                 }
--- a/series	Sat May 01 18:22:32 2010 -0700
+++ b/series	Sat May 01 20:06:38 2010 -0700
@@ -6,6 +6,7 @@
 
 meth.patch                      #-/meth #+9d0c5bd080b6
 meth-ing-6939134.patch          #-/meth #+9d0c5bd080b6
+meth-ver-6949040.patch          #-/meth #+9d0c5bd080b6 #-testable
 meth-ldc-6939203.patch          #-/meth #+9d0c5bd080b6
 meth-anno.patch                 #-/meth #+9d0c5bd080b6 #-testable