From ###@###.### Mon Jan 8 16:17:30 1996
Date: Mon, 8 Jan 1996 16:13:26 -0800
From: ###@###.### (Rafael Bracho)
To: fy@Eng
Subject: Bug #3
Cc: avh@Eng, sami@Eng
X-Sun-Charset: US-ASCII
Frank,
One more bug we found. Enjoy :-)
-Rafael
The compiler does not properly deal with packages and classes that
share the same name.
The following test case has a class called "Foo" and a package called
"Foo". Inside the package "Foo" there is a class "Foo.Bar".
Foo.java:
public class Foo {
public static int value;
public static void op() {};
}
Foo/Bar.java:
package Foo;
public class Bar {
public static int value;
public static void op() {};
}
Ex1.java:
public class Ex1 {
public static void main(String argv[]) {
int value;
value = Foo.value;
Foo.op();
Bar b = new Foo.Bar();
value = Foo.Bar.value;
Foo.Bar.op();
}
}
Foo/Ex2.java:
package Foo;
import Foo; // generates different errors depending on whether this
// import statement is declared
public class Ex2 {
public static void main(String argv[]) {
int value;
value = Foo.value;
Foo.op();
Bar b = new Foo.Bar();
value = Foo.Bar.value;
Foo.Bar.op();
}
}
These cause several different errors:
javac Ex1.java:
Ex1.java:7: No variable Bar defined in class Foo.
value = Foo.Bar.value;
^
Ex1.java:8: No variable Bar defined in class Foo.
Foo.Bar.op();
^
2 errors
javac Foo/Ex2.java:
(without the import statement)
Foo/Ex2.java:6: Undefined variable: Foo
value = Foo.value;
^
Foo/Ex2.java:7: Undefined variable: Foo
Foo.op();
^
2 errors
(with the import statement)
Foo/Ex2.java:10: No variable Bar defined in class Foo.
value = Foo.Bar.value;
^
Foo/Ex2.java:11: No variable Bar defined in class Foo.
Foo.Bar.op();
^
2 errors
Date: Mon, 8 Jan 1996 16:13:26 -0800
From: ###@###.### (Rafael Bracho)
To: fy@Eng
Subject: Bug #3
Cc: avh@Eng, sami@Eng
X-Sun-Charset: US-ASCII
Frank,
One more bug we found. Enjoy :-)
-Rafael
The compiler does not properly deal with packages and classes that
share the same name.
The following test case has a class called "Foo" and a package called
"Foo". Inside the package "Foo" there is a class "Foo.Bar".
Foo.java:
public class Foo {
public static int value;
public static void op() {};
}
Foo/Bar.java:
package Foo;
public class Bar {
public static int value;
public static void op() {};
}
Ex1.java:
public class Ex1 {
public static void main(String argv[]) {
int value;
value = Foo.value;
Foo.op();
Bar b = new Foo.Bar();
value = Foo.Bar.value;
Foo.Bar.op();
}
}
Foo/Ex2.java:
package Foo;
import Foo; // generates different errors depending on whether this
// import statement is declared
public class Ex2 {
public static void main(String argv[]) {
int value;
value = Foo.value;
Foo.op();
Bar b = new Foo.Bar();
value = Foo.Bar.value;
Foo.Bar.op();
}
}
These cause several different errors:
javac Ex1.java:
Ex1.java:7: No variable Bar defined in class Foo.
value = Foo.Bar.value;
^
Ex1.java:8: No variable Bar defined in class Foo.
Foo.Bar.op();
^
2 errors
javac Foo/Ex2.java:
(without the import statement)
Foo/Ex2.java:6: Undefined variable: Foo
value = Foo.value;
^
Foo/Ex2.java:7: Undefined variable: Foo
Foo.op();
^
2 errors
(with the import statement)
Foo/Ex2.java:10: No variable Bar defined in class Foo.
value = Foo.Bar.value;
^
Foo/Ex2.java:11: No variable Bar defined in class Foo.
Foo.Bar.op();
^
2 errors