Replies: 2 comments 1 reply
-
This is a great idea. For simple cases, we should already be able to parse existing "Use xxxx instead" Javadoc statements:
A snippet would be a good solution for more complex scenarios and we could define a syntax to help recognize these. |
Beta Was this translation helpful? Give feedback.
-
I started work on a PR for simple cases (methods in same class that are mentioned in the Javadoc and are also called by the deprecated method). eclipse-jdt/eclipse.jdt.ui#687 After working on it, I think I've come up with a better approach. What if we offered a quick assist to inline the deprecated method's logic (without deleting it) if and only if it calls the recommended replacement method in the Javadoc? That would handle more complex logic scenarios where set-up is required to make the call and ignore cases where the deprecated method chooses to throw an exception or simply fail (e.g. return null). This would require no change to Javadoc syntax and current refactoring logic could be reused. |
Beta Was this translation helpful? Give feedback.
-
It seems often people are quite dedicated to apply quickfixes e.g. converting to newer java language features, because it is quite easy to apply.
What I feel missing a bit in JDT would be a way to have similar for deprecated code, often there could be a pattern applied to fix these, or at least assist the users, so I wonder if it would be possible that JDT can be feed somehow with a "how to fix this deprecation" (beside the usual javadoc) especially as now it is possible with higher java versions to have snippets in javadoc JDT can maybe detect a special snippet and then suggest a user to replace some part of the code with a not deprecated one.
Of course this will not work in all cases, but if we can make it more comfortable to do it at least for the simple cases this would be great and help people in cleanup things.
Beta Was this translation helpful? Give feedback.
All reactions