java/9277: gcj fails with complex inner classes and exceptions

atomb@cats.ucsc.edu atomb@cats.ucsc.edu
Mon Jan 13 05:17:00 GMT 2003


>Number:         9277
>Category:       java
>Synopsis:       gcj fails with complex inner classes and exceptions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 11 16:56:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     atomb@cats.ucsc.edu
>Release:        unknown-1.0
>Organization:
>Environment:
Debian unstable, Intel.
gcc version 3.2.2 20030109 (Debian prerelease)
But affects official releases, as well, with exactly the same behavior.
>Description:
I get the following error:

# gcj-3.2 -c Outer1.java 
./Outer1.java:1: Class `Outer1' already defined in Outer1.java:1.
   class Outer1 extends Base {
         ^
./Outer1.java:2: confused by earlier errors, bailing out

When compiling this simplified set of files:

Base.java:
class Base {
}

First.java:
class First {
    Outer2 foo;

    static class Error extends RuntimeException {
        Error(String message) {
        }
    }
}

Outer1.java:
class Outer1 extends Base {
    static class Inner1 extends Outer1 {
        void func() {
            throw new First.Error("blah");
        }
    }
}

Outer2.java:
class Outer2 {
    class Inner2 extends Outer2 {
        Inner2(Outer1.Inner1 param) { 
        }
    }
}

Removing just about any element of any of the files eliminates the error. However, I haven't managed to change the original source that these snippets were abstracted from so that it compiles and still has the same semantics.

I have tried compling with today's (20030111) 3.4 CVS head, and it still breaks, but with a different message:

Outer1.java:1: error: Superclass `Base' of class `Outer1' not found.
   class Outer1 extends Base {

Base.java does exist, though, and this error occurs whether or not Base.o or Base.class exist.

Both the Sun JDK 1.4 (Blackdown 1.4.0.99beta) and Jikes (Version 1.18 - 21 November 2002) compile the code with no complaints.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list