8037934: Javac generates invalid signatures for local types

Wed, 28 May 2014 21:47:30 +0100

author
pgovereau
date
Wed, 28 May 2014 21:47:30 +0100
changeset 2407
8a5512cb5e9d
parent 2406
372fd7283bf0
child 2408
716f2466ddd0

8037934: Javac generates invalid signatures for local types
Reviewed-by: vromero, rfield
Contributed-by: separdaud@redhat.com

src/share/classes/com/sun/tools/javac/code/Types.java file | annotate | diff | comparison | revisions
test/tools/javac/types/BadSigTest.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu May 29 15:28:01 2014 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Wed May 28 21:47:30 2014 +0100
     1.3 @@ -4670,7 +4670,7 @@
     1.4                  assembleClassSig(rawOuter
     1.5                          ? types.erasure(outer)
     1.6                          : outer);
     1.7 -                append('.');
     1.8 +                append(rawOuter ? '$' : '.');
     1.9                  Assert.check(c.flatname.startsWith(c.owner.enclClass().flatname));
    1.10                  append(rawOuter
    1.11                          ? c.flatname.subName(c.owner.enclClass().flatname.getByteLength() + 1, c.flatname.getByteLength())
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/tools/javac/types/BadSigTest.java	Wed May 28 21:47:30 2014 +0100
     2.3 @@ -0,0 +1,40 @@
     2.4 +/*
     2.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.
    2.11 + *
    2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.15 + * version 2 for more details (a copy is included in the LICENSE file that
    2.16 + * accompanied this code).
    2.17 + *
    2.18 + * You should have received a copy of the GNU General Public License version
    2.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.21 + *
    2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.23 + * or visit www.oracle.com if you need additional information or have any
    2.24 + * questions.
    2.25 + */
    2.26 +
    2.27 +/*
    2.28 + * @test
    2.29 + * @bug 8037934
    2.30 + * @summary Javac generates invalid signatures for local types
    2.31 + * @run main BadSigTest
    2.32 + */
    2.33 +
    2.34 +public class BadSigTest<Outer> {
    2.35 +    void m(){
    2.36 +        class Local1{}
    2.37 +        class Local2 extends Local1{}
    2.38 +        Local2.class.getTypeParameters();
    2.39 +    }
    2.40 +    public static void main(String[] args) {
    2.41 +        new BadSigTest().m();
    2.42 +    }
    2.43 +}

mercurial