This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: refering to inner classes from imports doesn't work


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.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]