java/8742: Multiple identically-named local classes broken

gbenson@redhat.com gbenson@redhat.com
Thu Nov 28 04:56:00 GMT 2002


>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==



More information about the Java-prs mailing list