Skip to content

Could not parse JSR-308 Java TYPE_USE annotation #11490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xuwei-k opened this issue Feb 21, 2021 · 1 comment · Fixed by #11525
Closed

Could not parse JSR-308 Java TYPE_USE annotation #11490

xuwei-k opened this issue Feb 21, 2021 · 1 comment · Fixed by #11525

Comments

@xuwei-k
Copy link
Contributor

xuwei-k commented Feb 21, 2021

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

@xuwei-k
Copy link
Contributor Author

xuwei-k commented Feb 21, 2021

scala/scala@7e57bcc

@xuwei-k xuwei-k changed the title Could not parse Java TYPE_USE annotation Could not parse JSR-308 Java TYPE_USE annotation Feb 21, 2021
@Kordyjan Kordyjan self-assigned this Feb 23, 2021
Kordyjan added a commit that referenced this issue Feb 24, 2021
Fix #11490: Support Java type annotation parsing
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants