-
Notifications
You must be signed in to change notification settings - Fork 83
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
Code Cleanup: Java 16 instanceof pattern matching in pde.core #712
Conversation
...eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/ExtensionPointSchemaBuilder.java
Show resolved
Hide resolved
...g.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/FeatureConsistencyChecker.java
Show resolved
Hide resolved
...g.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/FeatureConsistencyChecker.java
Show resolved
Hide resolved
ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/UpdateSiteBuilder.java
Show resolved
Hide resolved
ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/UpdateSiteBuilder.java
Show resolved
Hide resolved
if (pluginBase instanceof IFragment) { | ||
// host specification | ||
IFragment fragment = (IFragment) pluginBase; | ||
if (pluginBase instanceof IFragment fragment) { |
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.
ditto
@alshamams It's good to open a bug against jdt for removed comments. |
IIRC some other JDT clean-ups like 'add braces' has a similar issue for years (if not decades), nevertheless it would be great if this is fixed. |
This is a no-win area for cleanups. The compiler treats a comment preceding a statement as belonging to the statement. When a statement is moved, it's comments generally go along and when removed, it's comments are removed. There is a way to preserve a comment but this isn't done for removals because there is no way to know if the comment really belongs to the statement or is a general logic comment like the ones you have above. It can never get it right not knowing the context. I was thinking of adding an option to preserve comments on remove but this is a large-scale undertaking which might require changes to all existing cleanups. I think in this particular case, defaulting to keeping the comment might be reasonable since the cast statement is a trivial operation not usually worth documenting. I will open an enhancement issue. |
@jjohnstn - is the code removal logic generic for all the clean-up functions? or is it specific to clean-up of |
a88a5ec
to
bd2a980
Compare
@gireeshpunathil As I noted, the comment for the cast statement is unlikely to be a comment regarding the cast. I posted #752 so the comment is no longer removed. It has been merged for 4.30 M1. |
bd2a980
to
90a120d
Compare
90a120d
to
01fca40
Compare
Thanks! |
The commit tries to implement a code cleanup in pattern matching using instanceof operator according to Java 16 guidelines, making the code more concise.
The change has been applied in org.eclipse.pde.core project.
Kindly review @akurtakov @iloveeclipse @vik-chand @gireeshpunathil and do let me know in case of any edits.