How does javac determine the source dependencies of the current source file?

71 views Asked by At

Consider the following two classes, defined in two source files:

Foo.java

public class Foo {
}

Bar.java

public class Bar {
  Foo foo;
}

When we invoke javac Bar.java, the current directory now contains Foo.class and Bar.class.

I'd like to understand the exact steps that javac uses to determine that it needs to compile Foo.java when I ask it to compile Bar.java.

Could I get a pointer to the set of classes in the source code which implement the steps to infer the source files that a given source file depends on?

I've looked through the Java compiler API, as well as perused the source myself, but have so far been unsuccessful at finding what I seek, probably due to lack of familiarity.

I am continuing to read the source, but asking this question in case someone happens to be much more familiar with the javac source code and knows this already.

0

There are 0 answers