RFR: 8226216: parameter modifiers are not visible to javac plugins across compilation boundaries

Jonathan Gibbons jjg at openjdk.java.net
Thu Dec 24 16:25:59 UTC 2020

On Thu, 24 Dec 2020 16:02:19 GMT, Guoxiong Li <github.com+13688759+lgxbslgx at openjdk.org> wrote:

> Hi all,
> javac fails to read modifiers from the MethodParameters attribute in class files, which prevents plugins from accessing those modifiers across compilation boundaries. Because `com.sun.tools.javac.jvm.ClassReader` doesn't read and store the access flags(modifiers) from MethodParameters attribute.
> This patch fixes it and adds a corresponding test case. All the existing tests of javac passed locally.
> Thank you for taking the time to review.
> Best Regards.

I've noted a couple of minor issues in the test.
I'll leave it to other javac folk to decide the merits of the change to `ClassReader`.
Note that the `MethodParameters` attribute may not always be present.

test/langtools/tools/javac/classreader/8226216/T8226216.java line 9:

> 7:  * published by the Free Software Foundation.  Oracle designates this
> 8:  * particular file as subject to the "Classpath" exception as provided
> 9:  * by Oracle in the LICENSE file that accompanied this code.

Tests should not contain the text `Oracle designates ... this code.` or the immediately preceding whitespace.

test/langtools/tools/javac/classreader/8226216/T8226216.java line 123:

> 121: 
> 122:     @Test
> 123:     public void testParameterModifiersNotVisiable() throws Exception {

spelling: should be "Visible"


Changes requested by jjg (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1890

More information about the compiler-dev mailing list