8037934: Javac generates invalid signatures for local types
authorpgovereau
Wed, 28 May 2014 21:47:30 +0100
changeset 24647 4435712075de
parent 24615 74eb0778e4f2
child 24648 3b639cd0c8bd
8037934: Javac generates invalid signatures for local types Reviewed-by: vromero, rfield Contributed-by: separdaud@redhat.com
langtools/src/share/classes/com/sun/tools/javac/code/Types.java
langtools/test/tools/javac/types/BadSigTest.java
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 05 19:42:32 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed May 28 21:47:30 2014 +0100
@@ -4696,7 +4696,7 @@
                 assembleClassSig(rawOuter
                         ? types.erasure(outer)
                         : outer);
-                append('.');
+                append(rawOuter ? '$' : '.');
                 Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
                 append(rawOuter
                         ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength() + 1, c.flatname.getByteLength())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/types/BadSigTest.java	Wed May 28 21:47:30 2014 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8037934
+ * @summary Javac generates invalid signatures for local types
+ * @run main BadSigTest
+ */
+
+public class BadSigTest<Outer> {
+    void m(){
+        class Local1{}
+        class Local2 extends Local1{}
+        Local2.class.getTypeParameters();
+    }
+    public static void main(String[] args) {
+        new BadSigTest().m();
+    }
+}