This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
java/8899: gcj confused over local classes
- From: gbenson at redhat dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 11 Dec 2002 10:12:56 -0000
- Subject: java/8899: gcj confused over local classes
- Reply-to: gbenson at redhat dot com
>Number: 8899
>Category: java
>Synopsis: gcj confused over local classes
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 11 02:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: gbenson@redhat.com
>Release: gcc-3.2 patched for PR 1343
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
The following code fails to compile because gcj is looking in the wrong Foo class for the constructor:
| public class Test {
| public void func1() {
| class Foo {
| Foo(int i) {
| }
| }
| Foo f = new Foo(1);
| }
| public void func2() {
| class Foo {
| Foo(boolean b) {
| }
| }
| }
| }
The error message given is as follows:
| Test.java: In class `Test':
| Test.java: In method `Test.func1()':
| Test.java:7: Can't find constructor `Test$2$Foo(I)' in type `Test$2$Foo'.
| Foo f = new Foo(1);
| ^
| 1 error
>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
ewoJICAgIEZvbyhpbnQgaSkgewoJICAgIH0KCX0KCUZvbyBmID0gbmV3IEZvbygxKTsKICAgIH0K
ICAgIHB1YmxpYyB2b2lkIGZ1bmMyKCkgewoJY2xhc3MgRm9vIHsKCSAgICBGb28oYm9vbGVhbiBi
KSB7CgkgICAgfQoJfQogICAgfQp9Cg==