RFR: 8320001: javac crashes while adding type annotations to constructor's return type

Vicente Romero vromero at openjdk.org
Tue Nov 21 23:25:04 UTC 2023


On Tue, 21 Nov 2023 22:48:45 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> Fix for [1] introduced a regression that is making some internal tests fail. Basically fix for [1] is trying to add annotations read from the class file to the corresponding symbol. Constructors are a bit special given that its return type is `void` thus type annotations can't be added to them. This fix is proposing just dropping the type annotation if it applies to the return type of a constructor.
>> 
>> TIA
>> [1] https://bugs.openjdk.org/browse/JDK-8225377
>
> test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java line 119:
> 
>> 117:                 .classpath(classes, classDir)
>> 118:                 .options("-processor", SimpleProcessor.class.getName())
>> 119:                 .files(yWrapper)
> 
> It should be equivalent to use `.classes("Y")` to request annotation processing of `Y` directly, and avoid the need for `YWrapper`. But either way is fine.

thanks for your comment, yes I tried that but all of the APIs we offer in JavacTasks were failing stating that the file was not a source file, this is why I decided to use a wrapper

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16774#discussion_r1401326705


More information about the compiler-dev mailing list