This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: refering to inner classes from imports doesn't work
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Nic Ferrier <nferrier at tapsellferrier dot co dot uk>
- Cc: java at gcc dot gnu dot org
- Date: Fri, 08 Feb 2002 14:48:10 +1300
- Subject: Re: refering to inner classes from imports doesn't work
- References: <87u1sszwe1.fsf@tf1.tapsellferrier.co.uk>
Nic Ferrier wrote:
>import A.X;
>
>public class B
>{
> public void someThing ()
> {
> X var = A.createSomething();
> var.someMethod();
> }
>}
>
This is actually not legal because you cannot import a class from the
default package. Some versions of javac did accept this code, but JDK
1.4's will not. GCJ needs to report an error like "A is not a package".
In the case where A is in package "pkg" and you do an "import pkg.A.X",
it is legal. However with GCJ I get a different error:
$ gcj -C pkg/*.java
./pkg/A.java:3: Class `pkg.A' already defined in pkg/A.java:3.
class A
^
./pkg/A.java:5: tree check: expected class 'd', have 'x' (error_mark) in
make_nested_class_name, at java/parse.y:3512
Please submit a full bug report,
with preprocessed source if appropriate.
Hmm...
regards
Bryce.