I would be nice if Gradle could do a combination of things:
-
use a compiler that allows deactivating constant inlining so it is possible to do very limited decompiles. There is always the Eclipse compiler and the new GraalVM compiler (pure java). I assume javac doesn’t have a flag to allow this.
-
alternatively prevent the compiler from constant inlining using hacky tricks. On the source code level one can redirect value generation of constants to methods so the compiler is not 100% that it is a constant and skips inlining. There are other tricks like annotations, byte code manipulation, etc. Obviously this is all not ideal. I would prefer (1)
-
go even further and make atomic recompiles possible - for example replace only parts of a .class file, like a single method in case you can make sure it doesn’t affect anything else. Maybe source code analysis could help here. I think Eclipse did this a decade ago (maybe this is not the case anymore) resulting in incredible build speed.