changeset 53171:5e355d28824a lworld

8215109: [lworld]: ClassFormatError: Illegal class name "QX<TE;>;"
author sadayapalam
date Mon, 10 Dec 2018 12:07:50 +0530
parents 6493751663b3
children e986cdb5aa99
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java test/langtools/tools/javac/valhalla/lworld-values/ParameterizedDefault.java test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfGenericType.java
diffstat 4 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Fri Dec 07 11:33:12 2018 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Mon Dec 10 12:07:50 2018 +0530
@@ -4860,10 +4860,16 @@
     public static class UniqueType {
         public final Type type;
         final Types types;
-
-        public UniqueType(Type type, Types types) {
+        private boolean encodeTypeSig;
+
+        public UniqueType(Type type, Types types, boolean encodeTypeSig) {
             this.type = type;
             this.types = types;
+            this.encodeTypeSig = encodeTypeSig;
+        }
+
+        public UniqueType(Type type, Types types) {
+            this(type, types, true);
         }
 
         public int hashCode() {
@@ -4875,6 +4881,10 @@
                 types.isSameType(type, ((UniqueType)obj).type);
         }
 
+        public boolean encodeTypeSig() {
+            return encodeTypeSig;
+        }
+
         public String toString() {
             return type.toString();
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Dec 07 11:33:12 2018 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Dec 10 12:07:50 2018 +0530
@@ -480,7 +480,11 @@
                     ClassSymbol c = (ClassSymbol) type.tsym;
                     if (c.owner.kind == TYP) pool.put(c.owner);
                     poolbuf.appendByte(CONSTANT_Class);
-                    poolbuf.appendChar(pool.put(typeSig(c.type)));
+                    if (((UniqueType) value).encodeTypeSig()) {
+                        poolbuf.appendChar(pool.put(typeSig(c.type)));
+                    } else {
+                        poolbuf.appendChar(pool.put(names.fromString("Q" + new String(externalize(c.flatname)) + ";")));
+                    }
                     enterInner(c);
                 } else {
                     Assert.check(type.hasTag(ARRAY));
@@ -1465,7 +1469,7 @@
             case ARRAY:
                 if (debugstackmap) System.out.print("object(" + t + ")");
                 databuf.appendByte(7);
-                databuf.appendChar(pool.put(types.isValue(t) ? new UniqueType(t, types) : t));
+                databuf.appendChar(pool.put(types.isValue(t) ? new UniqueType(t, types, false) : t));
                 break;
             case TYPEVAR:
                 if (debugstackmap) System.out.print("object(" + types.erasure(t).tsym + ")");
--- a/test/langtools/tools/javac/valhalla/lworld-values/ParameterizedDefault.java	Fri Dec 07 11:33:12 2018 -0500
+++ b/test/langtools/tools/javac/valhalla/lworld-values/ParameterizedDefault.java	Mon Dec 10 12:07:50 2018 +0530
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8210906
+ * @bug 8210906 8215109
  * @summary [lworld] default value creation should not impose raw types on users.
  * @run main/othervm -XX:+EnableValhalla ParameterizedDefault
  */
--- a/test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfGenericType.java	Fri Dec 07 11:33:12 2018 -0500
+++ b/test/langtools/tools/javac/valhalla/lworld-values/WithFieldOfGenericType.java	Mon Dec 10 12:07:50 2018 +0530
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8205686
+ * @bug 8205686 8215109
  * @summary __WithField seems to have trouble if the value type is a generic type.
  * @compile -XDrawDiagnostics -XDdev -XDallowWithFieldOperator WithFieldOfGenericType.java
  * @run main/othervm -XX:+EnableValhalla WithFieldOfGenericType