You speak of "compilation unit" as if it means the scope of work performed by javac and Maven. ("compiles each module separately as its own compilation unit") That's not the meaning. The meaning is as given in https://docs.oracle.com/javase/specs/jls/se13/html/jls-7.html#jls-7.3

On 10/2/2019 1:43 PM, Peter Levart wrote:
Is compilation unit really the right choice to base inference on?

For example, a program may be composed of several modules compiled all at once in a single compilation unit (javac supports that). This same program may be compiled with a build system such as Maven, which compiles each module separately as its own compilation unit. Would we really want the semantics of a program (or successful compilation thereoff) depend on the choice of the build tool?

What about using (module, compilation unit) as the base to perform inference within? I understand that compiler may only infer things within a compilation unit and module is usually compiled as a whole in one compilation unit (possibly together with other modules).

Regards, Peter

Reply via email to