RFR: 8332497: javac crashes when annotation processing runs on program with module imports [v9]
Evemose
duke at openjdk.org
Wed May 22 17:34:05 UTC 2024
On Wed, 22 May 2024 13:51:36 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Evemose has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Added --enable-preview flag
>
> test/langtools/tools/javac/processing/ModuleImportProcessingTest.java line 36:
>
>> 34: * @modules jdk.compiler
>> 35: * @build JavacTestingAbstractProcessor ModuleImportProcessingTest
>> 36: * @compile/process --enable-preview --release 23 -processor ModuleImportProcessingTest ModuleImportProcessingTest.java
>
> You should use an `@enablePreview` tag if the building of other classes doesn't have a source version restriction.
>
> In the worst scenario, if you have a version restriction (say testing behavior for `--release 14`), you can use `--enable-preview --source ${jdk.version}`.
>
> There are 2 problems with your command line here:
> 1. `--release` will fail because you are specifying modules (see https://bugs.openjdk.org/browse/CODETOOLS-7902754)
> 2. `23` will break when JDK bumps version
>
> As a result, I recommend just using a `@enablePreview` tag.
I have tried to replace it with `@enablePreview`, but compilation in ci fails with:
/home/runner/work/jdk/jdk/test/langtools/tools/javac/processing/ModuleImportProcessingTest.java:24: error: module imports are a preview feature and are disabled by default.
import module java.base;
^
(use --enable-preview to enable module imports)
1 error
Im not sure what I am missing. I have tried to also run with `--enable-preview --source ${jdk.version}`, and it also fails. I saw that `TestUnnamedVariableElement` uses both `@enablePreview~ and `--enable-preview --source ${jdk.version}` for some reason, but this approach also fails for me
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19292#discussion_r1610388652
More information about the compiler-dev
mailing list