refering to inner classes from imports doesn't work
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Thu Feb 7 17:50:00 GMT 2002
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.
More information about the Java
mailing list