RFR: 8332497: javac prints an AssertionError when annotation processing runs on program with module imports [v16]
Vicente Romero
vromero at openjdk.org
Fri May 24 13:54:04 UTC 2024
On Thu, 23 May 2024 11:12:32 GMT, Evemose <duke at openjdk.org> wrote:
>> Fix is pretty simple: visitModuleImport in com.sun.tools.javac.tree.TreeScanner has notbeen overriden, so defaulted to Visitor::visitModuleImport, which forwards to Visitor::visitTree, which is also not overriden, and, therefore, threw AssertionError.
>>
>> PS: Im not even sure how it worked before without crashing, seems like there is some intermidiate implementation between this TreeScanner and actual scanners because otherwise it should have resultedin compile error the moment it encounter module importin any visitor
>
> Evemose has updated the pull request incrementally with two additional commits since the last revision:
>
> - Merge remote-tracking branch 'origin/fix_module_imoprts_apt_fail' into fix_module_imoprts_apt_fail
>
> # Conflicts:
> # test/langtools/tools/javac/processing/ModuleImportProcessingTest.java
> - moved test to processing folder
test/langtools/tools/javac/processing/ModuleImportProcessingTest.java line 46:
> 44: * jdk.compiler/com.sun.tools.javac.main
> 45: * @build toolbox.JavacTask toolbox.ToolBox toolbox.Assert toolbox.Task
> 46: * @run main tools.javac.annotations.ModuleImportProcessingTest
just `@run main ModuleImportProcessingTest`
test/langtools/tools/javac/processing/ModuleImportProcessingTest.java line 84:
> 82: "-processor", AP.class.getName(),
> 83: "--enable-preview",
> 84: "--source", System.getProperty("java.specification.version")
looking good, just a minor comment, here we usually use: `Integer.toString(Runtime.version().feature())` to get the source version, and for indentation we use 4 spaces
test/langtools/tools/javac/processing/ModuleImportProcessingTest.java line 90:
> 88: .run(Task.Expect.SUCCESS)
> 89: .writeAll()
> 90: .getOutputLines(Task.OutputKind.DIRECT);
you don't need to call getOutputLines if you won't do anything with the output
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19292#discussion_r1613520723
PR Review Comment: https://git.openjdk.org/jdk/pull/19292#discussion_r1613518661
PR Review Comment: https://git.openjdk.org/jdk/pull/19292#discussion_r1613519385
More information about the compiler-dev
mailing list