-
Bug
-
Resolution: Unresolved
-
P4
-
9, 11, 13
A DESCRIPTION OF THE PROBLEM :
I think I found a javac bug which is reproduced on Java 9/10/11, but not on Java 8.
I created a repository with a minimal, reproducible and verifiable example: https://github.com/orionll/javac-bug
There are three Java files:
org/example/Common.java (empty file)
org/example/impl/Common.java
org/example/impl/Util.java
Util.java imports org.example.* and refers to a Common.X field. This is a totally legitimate code, but javac fails with an error saying that org/example/Common.java does not contain a class org.example.Common (it doesn't have to).
REGRESSION : Last worked in version 8u202
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
mkdir bin
javac -sourcepath src src/org/example/Common.java src/org/example/impl/Common.java src/org/example/impl/Util.java -d bin
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The files successfully compile
ACTUAL -
src\org\example\impl\Util.java:7: error: cannot access Common
System.out.println(Common.X);
^
bad source file: src\org\example\Common.java
file does not contain class org.example.Common
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
1 error
---------- BEGIN SOURCE ----------
// src/org/example/Common.java
package org.example;
// src/org/example/impl/Common.java
package org.example.impl;
final class Common {
static final int X = 42;
}
// src/org/example/impl/Util.java
package org.example.impl;
import org.example.*;
public class Util {
public static void f() {
System.out.println(Common.X);
}
}
---------- END SOURCE ----------
FREQUENCY : always
I think I found a javac bug which is reproduced on Java 9/10/11, but not on Java 8.
I created a repository with a minimal, reproducible and verifiable example: https://github.com/orionll/javac-bug
There are three Java files:
org/example/Common.java (empty file)
org/example/impl/Common.java
org/example/impl/Util.java
Util.java imports org.example.* and refers to a Common.X field. This is a totally legitimate code, but javac fails with an error saying that org/example/Common.java does not contain a class org.example.Common (it doesn't have to).
REGRESSION : Last worked in version 8u202
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
mkdir bin
javac -sourcepath src src/org/example/Common.java src/org/example/impl/Common.java src/org/example/impl/Util.java -d bin
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The files successfully compile
ACTUAL -
src\org\example\impl\Util.java:7: error: cannot access Common
System.out.println(Common.X);
^
bad source file: src\org\example\Common.java
file does not contain class org.example.Common
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
1 error
---------- BEGIN SOURCE ----------
// src/org/example/Common.java
package org.example;
// src/org/example/impl/Common.java
package org.example.impl;
final class Common {
static final int X = 42;
}
// src/org/example/impl/Util.java
package org.example.impl;
import org.example.*;
public class Util {
public static void f() {
System.out.println(Common.X);
}
}
---------- END SOURCE ----------
FREQUENCY : always