Requesting review for 8292275: javac does not emit SYNTHETIC and MANDATED flags for parameters by default

- liangchenblue at gmail.com
Thu Apr 27 15:58:06 UTC 2023


Hello javac reviewers,
I wish you can take a look at patch
https://github.com/openjdk/jdk/pull/9862 with JBS issue at
https://bugs.openjdk.org/browse/JDK-8292275 that fixes the problem
where javac generates classfiles without sufficient information for
core reflection to perform explicit to full parameter mappings.

Why it matters:
Even though the parameter information is always available with
-parameters flag, most javac users will not opt-in to such a flag, and
end up encountering problems with core reflection mismatching
annotations or signatures. This patch generates minimal parameter
information that can prevent such problems.

Example:
public class Outer {
    public class Inner {
        public Inner(Optional<String> arg) {} // this constructor's
parameterized types will be erased
    }
}

Without this patch, core reflection reports the arg as Optional than
Optional<String>, due to signature reporting one parameter while the
actual method has two parameters, one mandated.

Additionally, (from most to least important)
1. This patch has a CSR approved for release 21. Deferring the CSR and
the helpful bugfix due to lack of reviews would be an unfortunate
waste, especially that this patch is in a ready state.
2. A bug in the Classfile API, which this patch uses to write tests,
causes one of the tests to fail. If you can approve the associated
simple typo bugfix https://github.com/openjdk/jdk/pull/13167 to
advance the main patch, I would be grateful as well.
3. I have submitted a patch utilizing the parameter information to the
core reflection at https://github.com/openjdk/jdk/pull/13664 which
would make the patch more useful as well.

Sincerely,
Chen Liang


More information about the compiler-dev mailing list