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
Wed Jun 10 14:27:27 UTC 2020


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.


-- 
Best regards,
Behrang Saeedzadeh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20200611/d8a3fb75/attachment.htm>


More information about the compiler-dev mailing list