-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix deprecated check routines in ASTNode to also check since value #2874
Fix deprecated check routines in ASTNode to also check since value #2874
Conversation
57fcf39
to
c47b37c
Compare
2aba8be
to
cf61b9b
Compare
Hi @stephan-herrmann Can this be reviewed for M2? |
yes, M2 sounds realistic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped some suggestions for technical code simplification.
But I'm not sure we are on 100% firm ground conceptually:
- do we know why editor and problems view show different results? A corresponding test in
ReconcilerTests9
could be helpful to observe the difference. - I'd expect
since
values to be used mostly by JDK classes (because the version is a JDK version, not the version of 3rd party code) - and in the ticket the affected class wasjava.net.URL
indeed.- in that case we shouldn't even see the class version with the deprecation annotations, IFF
--release
is used. This, too, is worth being double-checked.
- in that case we shouldn't even see the class version with the deprecation annotations, IFF
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
Outdated
Show resolved
Hide resolved
....core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
Outdated
Show resolved
Hide resolved
cf61b9b
to
58bd418
Compare
Thanks for the code suggestions. I agree that the since value will likely only be used with JDK classes. I don't know how the release option works under the covers. Should the release option change the URL class in this case since we are talking deprecation and not an API addition, change, or removal? When I use JDK22 and specify compliance 19 with --release option checked, the Javadoc I get from the hover for the URL constructor in question is the JDK22 javadoc specifying the deprecation with since value. |
58bd418
to
0c21872
Compare
The signature entry for URL at versions 20+ contains:
When specifying
That's a problem: we do have the correct information in byte code format, but we don't have version specific source attachment and javadoc! There is only the JDK22 version in your setup. |
@jjohnstn did you succeed to write a test that demonstrates this difference between compiler and reconciler? |
No, unfortunately I had to go to a wedding in Texas and have been doing some catch up in getting some UI changes into M2. |
0c21872
to
37400b1
Compare
Hi @stephan-herrmann I added a test to ReconcilerTests9. Without the patch, there is a warning for both methods (one is deprecated since 9 and the other is deprecated since 10). With the patch, it only shows a warning for the method that is deprecated since 9. Is that sufficient? |
- fix Deprecated9Test failures
37400b1
to
eca7837
Compare
@stephan-herrmann The reason for the warning in the editor is that the IMethodBinding returns true for isDeprecated() due to the compiler MethodBinding which sets the flag based on the ASTNode.isMethodUseDeprecated() method which I changed. |
For the actual difference between editor and builder (which can only be demonstrated with deprecation in an original JDK class) I filed #3168, which comes with its own set of open questions, and hence may not be resolved in the near future. For that reason the current fix is a valid workaround for a situation that ideally shouldn't even occur, but does occur currently. |
thanks @jjohnstn |
What it does
Fixes deprecated warnings and errors being shown when the release setting is below the since threshold of a
deprecated method, type, field.
How to test
See issue.
Author checklist