The following mail sent to javabugs describes the problem completely -
I've verified the results.
>From: Gerald Vogt <###@###.###>
This does not look like form output to me.
BUG REPORT JDK 1.0.2 javac Solaris 2.4 Sparc
javac cannot distinguish the same name for a class and a package. If
there is a class compiled with the same name as a package the
definitions in the package are not accessable.
Example: 3 files
---- node.java
package my.test;
public class node {
public static final int AB = 0;
}
---- test.java
package my;
public class test
{
}
---- t.java
class Main {
public static void main (String args[])
{
System.out.println("AB is " + my.test.node.AB);
}
}
----
Compile with:
setenv CLASSPATH ./classes
javac -d classes node.java
javac -d classes test.java
javac -d classes t.java
The last statement prints the following error:
t.java:4: No variable node defined in class my.test.
System.out.println("AB is " + my.test.node.AB);
--
Gerald Vogt E-Mail: ###@###.###
WWW: <http://www.isa.de/~vogt>
PGP pubkey at keyservers or via WWW!
I've verified the results.
>From: Gerald Vogt <###@###.###>
This does not look like form output to me.
BUG REPORT JDK 1.0.2 javac Solaris 2.4 Sparc
javac cannot distinguish the same name for a class and a package. If
there is a class compiled with the same name as a package the
definitions in the package are not accessable.
Example: 3 files
---- node.java
package my.test;
public class node {
public static final int AB = 0;
}
---- test.java
package my;
public class test
{
}
---- t.java
class Main {
public static void main (String args[])
{
System.out.println("AB is " + my.test.node.AB);
}
}
----
Compile with:
setenv CLASSPATH ./classes
javac -d classes node.java
javac -d classes test.java
javac -d classes t.java
The last statement prints the following error:
t.java:4: No variable node defined in class my.test.
System.out.println("AB is " + my.test.node.AB);
--
Gerald Vogt E-Mail: ###@###.###
WWW: <http://www.isa.de/~vogt>
PGP pubkey at keyservers or via WWW!