This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
java/8742: Multiple identically-named local classes broken
- From: gbenson at redhat dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 28 Nov 2002 12:49:13 -0000
- Subject: java/8742: Multiple identically-named local classes broken
- Reply-to: gbenson at redhat dot com
>Number: 8742
>Category: java
>Synopsis: Multiple identically-named local classes broken
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 28 04:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: gbenson@redhat.com
>Release: gcc 3.2
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
If you have a class which contains multiple identically-named local classes, for example:
| public class Test {
| public void func1() {
| class Foo {
| }
| }
| public void func2() {
| class Foo {
| }
| }
| }
Attempting to compile it gives the following error:
| Test.java:7: Class `Test$Foo' already defined in Test.java:3.
| class Foo {
| ^
| 1 error
The behaviour of Sun's javac in this instance is to create Test$1$Foo.class and Test$2$Foo.class in addition to Test.class.
>How-To-Repeat:
gcj Test.java # attached
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Test.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Test.java"
cHVibGljIGNsYXNzIFRlc3QgewogICAgcHVibGljIHZvaWQgZnVuYzEoKSB7CgljbGFzcyBGb28g
ewoJfQogICAgfQogICAgcHVibGljIHZvaWQgZnVuYzIoKSB7CgljbGFzcyBGb28gewoJfQogICAg
fQp9Cg==