8037934: Javac generates invalid signatures for local types

Reviewed-by: vromero, rfield
This commit is contained in:
Stephane Epardaud 2014-05-28 21:47:30 +01:00 committed by Paul Govereau
parent 714a7e877e
commit e0f4450825
2 changed files with 41 additions and 1 deletions

View File

@ -4696,7 +4696,7 @@ public class Types {
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())

View File

@ -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();
}
}