javac "cannot find symbol" bug (?)

_ postolowicz at gmail.com
Wed Apr 5 10:29:08 UTC 2017


Hello,

I discovered strange behavior of javac in my project: depending on
order of source files passed it compiles successfully or fail.

Could you take a look at sample reproducible case at
https://bitbucket.org/postolowicz/javac-error ?

Steps to reproduce:

1. Run `./gradlew build`
This depending on your luck may success or fail at buildling system-test module.

2. Run `./compile-successful.sh`
It should succeed.

3. Run `./compile-failing.sh`
It should fail with message:
system-test/src/main/java/postolowicz/systemtest/AbstractSystemTestWithoutDB.java:18:
error: cannot find symbol
protected class RunnerImpl extends ValidationRunner {
                                  ^
  symbol:   class ValidationRunner
  location: class AbstractSystemTestWithoutDB
system-test/src/main/java/postolowicz/systemtest/AbstractSystemTestWithoutDB.java:13:
error: cannot find symbol
@Configuration
^
  symbol:   class Configuration
  location: class AbstractSystemTestWithoutDB
system-test/src/main/java/postolowicz/systemtest/AbstractSystemTestWithoutDB.java:14:
error: cannot find symbol
@PropertySource(value = "", ignoreResourceNotFound = true)
^
  symbol:   class PropertySource
  location: class AbstractSystemTestWithoutDB
system-test/src/main/java/postolowicz/systemtest/AbstractSystemTestWithoutDB.java:23:
error: method does not override or implement a method from a supertype
@Override
^
system-test/src/main/java/postolowicz/systemtest/AbstractSystemTestWithoutDB.java:28:
error: method does not override or implement a method from a supertype
@Override
^
5 errors

The only difference between these two scripts is order of source files.

Is it a bug or I miss something?

Occurs for javac -version
javac 1.8.0_121

TIA,
Radek Postołowicz


More information about the compiler-dev mailing list