Hi there,
I've spotted out an unexpected javac behavior, just wanted to share it to get some feedback from you guys, as it's a bit annoying.
So here it is, given the following folders structure and class content:
adir/A.java
bdir/B.java
cdir/C.java
and the following commands:
javac adir/A.java
javac bdir/B.java -cp adir/
then
javac cdir/C.java -cp bdir/
fails with the following:
C.java:3: cannot access A
file A.class not found
B b = new B("");
^
1 error
So even if in B.java, nothing can possibly access an A class (which is anyway NOT in the classpath) or at least access an exposed API from B that involes an A, C.java will not compile!
It gets even wierder because with the following modifications, everything compiles fine:
- Adding an empty constructor to B
- Calling the empty constructor instead of the
String one in C
Then javac does not complain anymore and does its job...
Couldn't find anything on internet on that..
Thanks!