6835430: javac does not generate signature attributes for classes extending parameterized inner classes
authormcimadamore
Tue, 16 Jun 2009 10:45:42 +0100
changeset 3138 c9fe0e7472ac
parent 3137 a8590199a00e
child 3139 01d76d311f8e
6835430: javac does not generate signature attributes for classes extending parameterized inner classes Summary: ClassWriter does not consider outer params of an inner class when emitting signature attributes Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
langtools/test/tools/javac/6835430/A.java
langtools/test/tools/javac/6835430/T6835430.java
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Jun 16 10:45:11 2009 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Jun 16 10:45:42 2009 +0100
@@ -1521,9 +1521,9 @@
         int acount = 0;
 
         boolean sigReq =
-            typarams.length() != 0 || supertype.getTypeArguments().length() != 0;
+            typarams.length() != 0 || supertype.allparams().length() != 0;
         for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
-            sigReq = l.head.getTypeArguments().length() != 0;
+            sigReq = l.head.allparams().length() != 0;
         if (sigReq) {
             assert source.allowGenerics();
             int alenIdx = writeAttr(names.Signature);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6835430/A.java	Tue Jun 16 10:45:42 2009 +0100
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+class A<T extends A<T>> {
+    class C {
+        public T getT() { return null; }
+    }
+}
+
+class B extends A<B> {
+    public class D extends A<B>.C {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/6835430/T6835430.java	Tue Jun 16 10:45:42 2009 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6835430
+ * @summary 6835430: javac does not generate signature attributes for classes extending parameterized inner classes
+ * @author mcimadamore
+ *
+ * @compile A.java
+ * @compile T6835430.java
+ */
+
+class T6835430 {
+    void test(B.D d) {
+        B b = d.getT();
+    }
+}