-
Enhancement
-
Resolution: Unresolved
-
P4
-
9, 11, 17, 21, 22, 23
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
The `javac` compiler switches into JPMS-mode if the target directory contains a compile module descriptor `module-info.class`.
This makes the compilation result (in this case a failure) dependent not only on the CLI options and source directories, but also on the contents of the output directory.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Clone the project at:
https://github.com/copernik-eu/bug-reproducibility/tree/main/javac-module-info-bug
and run `make` twice.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect each compilation step to always work in the same way, i.e. each time:
javac -cp lib/log4j-api.jar -d target src/example/Main.java
is called, it will look for imported classes on the classpath.
ACTUAL -
The second execution of:
javac -cp lib/log4j-api.jar -d target src/example/Main.java
will fail while trying to resolve the modules references in the trailing `target/module-info.class` file.
CUSTOMER SUBMITTED WORKAROUND :
A temporary workaround consists in deleting the `module-info.class` file before each compilation step.
FREQUENCY : always
The `javac` compiler switches into JPMS-mode if the target directory contains a compile module descriptor `module-info.class`.
This makes the compilation result (in this case a failure) dependent not only on the CLI options and source directories, but also on the contents of the output directory.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Clone the project at:
https://github.com/copernik-eu/bug-reproducibility/tree/main/javac-module-info-bug
and run `make` twice.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect each compilation step to always work in the same way, i.e. each time:
javac -cp lib/log4j-api.jar -d target src/example/Main.java
is called, it will look for imported classes on the classpath.
ACTUAL -
The second execution of:
javac -cp lib/log4j-api.jar -d target src/example/Main.java
will fail while trying to resolve the modules references in the trailing `target/module-info.class` file.
CUSTOMER SUBMITTED WORKAROUND :
A temporary workaround consists in deleting the `module-info.class` file before each compilation step.
FREQUENCY : always