Add an option to javac to disable inlining of static final variables (to be used by programmers during development phase)

Behrang Saeedzadeh behrangsa at gmail.com
Thu Jun 11 07:07:10 UTC 2020


I see. Thanks for the information.

Best regards,
Behrang Saeedzadeh
(Sent from my cellphone.)

On Thu, Jun 11, 2020, 1:04 AM Remi Forax <forax at univ-mlv.fr> wrote:

> ----- Mail original -----
> > De: "Behrang Saeedzadeh" <behrangsa at gmail.com>
> > À: "compiler-dev" <compiler-dev at openjdk.java.net>, "discuss" <
> discuss at openjdk.java.net>
> > Envoyé: Mercredi 10 Juin 2020 16:27:27
> > Objet: Add an option to javac to disable inlining of static final
> variables (to be used by programmers during
> > development phase)
>
> > Hi,
>
> Hi,
>
> >
> > I guess inlining of static variables [1] is one of the main causes that
> > during our day to day coding activities, we have to do a full recompile
> > (e.g. `mvn clean ...`) every time a constant that is referenced
> throughout
> > the code is changed.
> >
> > There are a few ugly tricks to prevent the constants from getting
> inlined,
> > but a compiler option that we can pass to javac that produces a warning
> > message that can be used while we program locally could reduce the need
> to
> > run `mvn clean ...`, `gradle clean ...`, etc.
> >
> > Another option could be [2] adding some metadata to classes that
> reference
> > constants to record where the constant is coming from that could allow
> > build tools recompile all such classes when the constant changes.
> > [1]
> >
> https://docs.oracle.com/javase/specs/jls/se14/html/jls-13.html#jls-13.4.9.
> > [2] If the class file format permits that.
>
> It's already done by javac, it register all the classes of the static
> final fields it depends in the constant pool (the dictionary pat of the
> classfile format).
> Gradle (the recent versions) uses this information but not Maven, so the
> question is more how to improve Maven to compute the graph of dependencies
> at the file level.
>
> There is also a kind of quick hack if you have a multi-modules project,
> you can read the module-info.java to get the graph of modules to find the
> dependency at module level,
> you can then use javac to read the module-info.java and the JDK API to
> create the module and let the JDK resolve the graph for you.
> The build of the OpenJDK does that with great success.
>
> >
> >
> > --
> > Best regards,
> > Behrang Saeedzadeh
>
> regards,
> Rémi
>


More information about the discuss mailing list