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

Behrang Saeedzadeh behrangsa at
Wed Jun 10 14:27:27 UTC 2020


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.
[2] If the class file format permits that.

Best regards,
Behrang Saeedzadeh

More information about the discuss mailing list