Skip to content

Support attributes introduced in Java 9 for @Deprecated annotation #10131

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

Open
difflaender opened this issue May 13, 2025 · 2 comments · May be fixed by #10132
Open

Support attributes introduced in Java 9 for @Deprecated annotation #10131

difflaender opened this issue May 13, 2025 · 2 comments · May be fixed by #10132

Comments

@difflaender
Copy link

Java 9 introduced additional attributes String since and boolean forRemoval to the Deprecated annotation.

However, using these attributes in our code leads to a GWT compilation error:

@Deprecated( since = "2017-11-13" ) // -> [ERROR] Line 383: The attribute since is undefined for the annotation type Deprecated
public void foo() {
  [...]
}

Setting -sourceLevel 17 does not prevent this.

It would be nice if this could be supported at some point. At the very least when support for Java 8 is dropped at some point.

@tbroyer
Copy link
Member

tbroyer commented May 13, 2025

Given how GWT works, I believe you can make a pull request for https://github.com/gwtproject/gwt/blob/main/user/super/com/google/gwt/emul/java/lang/Deprecated.java, it should be backwards compatible even when using JDK 8 or -release 8 (the code would have to not use those attributes then), and/or -sourceLevel 8.

Not sure how best to test it though… (just slap one of those attributes in an existing class in com/google/gwt/emul?)

@niloc132
Copy link
Member

I believe it should actually be even easier than this now, since #10020 was finally reported (in open source... was reported years ago inside of goog) and fixed - we should just be able to delete Deprecated.java and others, and pick up bytecode from the classpath.

@zbynek zbynek linked a pull request May 13, 2025 that will close this issue
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.

4 participants