gcj/223: gcj fails to compile this 1.1 innerclass code
Bryce McKinlay
bryce@albatross.co.nz
Sun May 7 23:30:00 GMT 2000
The following reply was made to PR gcj/223; it has been noted by GNATS.
From: Bryce McKinlay <bryce@albatross.co.nz>
To: mdejong@cygnus.com
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/223: gcj fails to compile this 1.1 innerclass code
Date: Mon, 08 May 2000 18:30:52 +1200
mdejong@cygnus.com wrote:
> >Synopsis: gcj fails to compile this 1.1 innerclass code
I dont think this is really a problem specific to inner classes, but rather more general issues with the way gcj
resolves nested package/class/inner class/field names and finds packages.
For example, the following code also fails:
// in "pkg"
package pkg;
public class A
{
public static String f = "f";
}
// in "pkg/pkg"
package pkg.pkg;
public class B
{
static String c = pkg.A.f;
}
Trying to compile them from within "pkg" I get:
$ gcj -C A.java pkg/B.java
pkg/B.java: In class `pkg.pkg.B':
pkg/B.java: In method `<clinit>()':
pkg/B.java:5: Undefined variable or class name: `pkg'.
static String c = pkg.A.f;
^
1 error
Trying to compile from the top level gives a different error:
$ gcj -C pkg/A.java pkg/pkg/B.java
pkg/pkg/B.java: In class `pkg.pkg.B':
pkg/pkg/B.java: In method `<clinit>()':
pkg/pkg/B.java:5: Incompatible type for declaration. Can't convert `pkg.A' to `java.lang.String'.
static String c = pkg.A.f;
^
1 error
With javac or jikes it works either way.
regards
[ bryce ]
More information about the Java-prs
mailing list