Skip to content

Could not parse JSR-308 Java TYPE_USE annotation #11490

Closed
@xuwei-k

Description

@xuwei-k

Compiler version

3.0.0-RC1 and 3.0.0-RC2-bin-20210219-aa7c21e-NIGHTLY

Minimized code

A.java

import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.util.List;

@Target({ TYPE_USE })
@Retention(RUNTIME)
@interface NotNull {}

interface A {
  public List<@NotNull String> x();
}

B.scala

class B

Output

[error] -- Error: /home/runner/work/TYPE_USE-annotation-scala3/TYPE_USE-annotation-scala3/src/main/scala/A.java:12:14 
[error] 12 |  public List<@NotNull String> x();
[error]    |              ^^^^
[error]    |              illegal start of type
[error] -- Error: /home/runner/work/TYPE_USE-annotation-scala3/TYPE_USE-annotation-scala3/src/main/scala/A.java:12:34 
[error] 12 |  public List<@NotNull String> x();
[error]    |                                  ^
[error]    |                                  null expected but ';' found.
[error] two errors found

Expectation

success compile

Note

success with Scala 2.13.4, 2.12.13

ci

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions