changeset 3296:ee3dd386c16b

Fix: Infinite loop when generating ParamType entry with raw enclosing Fix: Missing call to ClassFile.externalize on ParamType Utf8 name.
author mcimadamore
date Thu, 28 Jan 2016 17:46:46 +0000
parents ade1263cab01
children 3700d512c76d
files src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java test/tools/javac/valhalla/typespec/GenericMethod01.java test/tools/javac/valhalla/typespec/GenericMethod02.java
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java	Tue Jan 26 15:41:48 2016 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java	Thu Jan 28 17:46:46 2016 +0000
@@ -451,12 +451,14 @@
                 Type encl = t.getEnclosingType();
                 Entry encl_entry = null;
                 while (!encl.hasTag(TypeTag.NONE)) {
-                    encl_entry = visit(t.getEnclosingType(), typeNameFunc);
-                    if (encl_entry.tag == ClassFile.CONSTANT_ParameterizedType) {
+                    if (encl.hasTag(CLASS) &&
+                            encl.getTypeArguments().stream().anyMatch(types::isTypeArgumentSpecializable)) {
+                        encl_entry = visit(t.getEnclosingType(), typeNameFunc);
                         break;
                     }
+                    encl = encl.getEnclosingType();
                 }
-                Constant<Name> clazz = (Constant<Name>)makeConstant(t.tsym.flatName());
+                Constant<Name> clazz = (Constant<Name>)makeConstant(types.names.fromUtf(ClassFile.externalize(t.tsym.flatName())));
                 boolean prevTypeArgPosition = typeArgPosition;
                 Entry[] typeargs = null;
                 try {
--- a/test/tools/javac/valhalla/typespec/GenericMethod01.java	Tue Jan 26 15:41:48 2016 +0000
+++ b/test/tools/javac/valhalla/typespec/GenericMethod01.java	Thu Jan 28 17:46:46 2016 +0000
@@ -28,10 +28,12 @@
  * @summary smoke test for generic methods (using both translation schemes)
  * @clean .*
  * @compile GenericMethod01.java
+ * @run main GenericMethod01 *
+ * @clean .*
+ * @compile -XDuseUnsharedTable -XDdesugarGenericMethods GenericMethod01.java
  * @run main GenericMethod01
  * @clean .*
- * @compile -XDdesugarGenericMethods GenericMethod01.java
- * @run main GenericMethod01
+ * @compile -XDuseUnsharedTable -XDgenericClassFile GenericMethod01.java
  */
 public class GenericMethod01 {
 
--- a/test/tools/javac/valhalla/typespec/GenericMethod02.java	Tue Jan 26 15:41:48 2016 +0000
+++ b/test/tools/javac/valhalla/typespec/GenericMethod02.java	Thu Jan 28 17:46:46 2016 +0000
@@ -29,6 +29,8 @@
  * @clean .*
  * @compile -XDdesugarGenericMethods GenericMethod02.java
  * @run main GenericMethod02
+ * @clean .*
+ * @compile -XDgenericClassFile GenericMethod01.java
  */
 public class GenericMethod02 {