[m-rev.] for review: add missing prereqs for .class files
Zoltan Somogyi
zoltan.somogyi at runbox.com
Fri Sep 26 16:49:23 AEST 2025
On Fri, 26 Sep 2025 16:02:08 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> On Fri, 26 Sept 2025 at 15:53, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> > On Fri, 26 Sep 2025 15:16:26 +1000, Julien Fischer <jfischer at opturion.com> wrote:
> > > There's an overview of Java compilation here:
> > > <https://openjdk.org/groups/compiler/doc/compilation-overview/index.html>
> >
> > Thanks for that.
> >
> > The relevant part of the introduction seems to be this:
> >
> > Finally, the syntax trees created by the parser are analyzed
> > and translated into class files. During the course of the analysis,
> > references to additional classes may be found. The compiler will
> > check the source and class path for these classes; if they are found
> > on the source path, those files will be compiled as well, although
> > they will not be subject to annotation processing.
> >
> > Without this diff, it seems javac was not finding the "additional classes",
> > which is why it failed. With this diff, this failure does not happen.
> > That's fine. What is not fine is that this says those additional classes
> > will also be compiled, which seems to me to be crazy. It means that
> > if you have a utility module (call it module_u), and a bunch of modules
> > (module_a, module_b, ... module_t) that all use module_u, then there
> > can be no separate compilation for any module except module_u,
> > because every time you compile e.g. module_c, module_u gets
> > compiled as well.
>
> In Java-land incremental compilation is offloaded to external build
> tools like maven or gradle;
I know, but ...
> the Java compiler itself is fairly primitive
> in that department.
... I would call this decision "pointlessly stupid", rather than "primitive".
That's because it effectively forces a build system to give javac all the
updated .java files to javac in the same invocation, but if you do that,
then recompiling all the "additional classes" shouldn't be necessary;
the results of that recompilation should be the same as the results
of their most recent earlier compilation. Unless, of course, they screwed up
the design of interfaces between .class files ...
Zoltan.
More information about the reviews
mailing list