Make "-parameters" enabled by default?
m.zajaczkowski at gmail.com
Thu Mar 25 20:20:09 UTC 2021
Tl;TD. JEP 118  has added "-parameters" to Java 8 back in 2014 to
have parameter names available at runtime. In 2021, backward
compatibility of the bytecode-related tools should not be a big problem,
so maybe to simplify the things, it could be enabled by default?
Hi, I'm not sure this is the best place to touch such as topics, so
please show me a better way (or a "procedure") in a case that is not. I
also wasn't able to find a discussion about that, however, the code
words in the results were usually related to the default parameters
support, so I might miss something.
I have bumped into that idea, trying to explain why in one (Gradle)
project named parameters were available out of the box, but in another I
had to explicitly add "-parameters" to the compiler arguments. In the
end, it turned out that (here) the Spring Boot plugin enables
"-parameters" in the whole project if used (which looking at its usage
is an useful idea). First, I thought, I would be good to make it a
default behavior in all the Gradle projects, but after a moment, I
realized that behavior enabled by default would be much more natural
(and beneficial) for all the JDK project in general.
I realize that "-parameters" modifies bytecode structure in a non
backward compatible way. However, my first idea about potential problems
is related to the bytecode manipulating tools (such as ASM), which had
over 7 years to start supporting it and probably those versions are
already available in the majority of actively developed projects (at
least those who would like to be compilable with Java 17 :) ). As a
result, maybe it would be a good idea to have it available in one of the
further OpenJDK versions? Java 17 - as LTS - is definitely a good
candidate for that, but looking at the schedule it might be hard to get.
Of course, I might miss something obvious, what make my idea problematic
to implement (even with a switch to disable a default behavior). In that
case, please don't hesitate to write about that. On the other hand, if
you - by any chance - like that idea, please let me know, what is a
procedure to follow to make it (eventually) happen.
 - https://openjdk.java.net/jeps/118
More information about the jdk-dev