RFR: 8320001: javac crashes while adding type annotations to constructor's return type
Vicente Romero
vromero at openjdk.org
Wed Nov 22 00:38:12 UTC 2023
On Tue, 21 Nov 2023 23:31:08 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:
>> 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
>
> That's weird, I tried it out before commenting and it worked for me, I was able to reproduce the crash and then see the test pass with the fix using:
>
>
> diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java
> index 50c596ac79b..49f694a9a4f 100644
> --- a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java
> +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java
> @@ -98,12 +98,6 @@ class Y {
> @Target(ElementType.TYPE_USE)
> @Retention(RetentionPolicy.RUNTIME)
> @interface TA {}
> - """,
> - """
> - class YWrapper {
> - // just to make the compiler load the class file for class Y above
> - Y y;
> - }
> """);
>
> // we need to compile Y first
> @@ -116,7 +110,7 @@ class YWrapper {
> new JavacTask(tb)
> .classpath(classes, classDir)
> .options("-processor", SimpleProcessor.class.getName())
> - .files(yWrapper)
> + .classes("Y")
> .outdir(classes)
> .run(Task.Expect.SUCCESS);
> }
yup your are right, will fix the test, it seems like I tried another combination of options
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16774#discussion_r1401369424
More information about the compiler-dev
mailing list