-
Notifications
You must be signed in to change notification settings - Fork 79
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 #705
Conversation
@@ -1,55 +1,145 @@ | |||
cleanup.add_all=false |
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.
did you mean these changes (in preferences) to be made permanent?
// Cheat sheet view will log an error loading simple cheat | ||
// sheets | ||
IStorageEditorInput storageInput = (IStorageEditorInput) input; | ||
} else if (input instanceof IStorageEditorInput storageInput) { |
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.
Please keep the comment .
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.
Is this a bug in the cleanup command?
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.
Is this a bug in the cleanup command?
Hi @vik-chand ,
I did not remove the comment manually. It was done as part of the code cleanup.
Was it done manually or via some refactoring command? |
Test Results 231 files - 15 231 suites - 15 36m 30s ⏱️ - 17m 31s Results for commit fbbe725. ± Comparison against base commit d7228a1. This pull request removes 2663 tests.
|
Hi @iloveeclipse , |
if (e instanceof CoreException) { | ||
// Re-use status only if it has attached exception with the stack trace | ||
CoreException ce = (CoreException) e; | ||
if (e instanceof CoreException ce) { |
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.
Please keep the comment.
I can only second that such patches should be done in smaller chunks e.g. one PR per project to make reviewing actually possible. |
@iloveeclipse @akurtakov Henceforth I shall try to focus on making smaller commits. Should I revert and convert this into individual commits, for each project ? |
Please do. That would allow us to deliver incrementally. |
Hi @iloveeclipse @akurtakov @vik-chand @gireeshpunathil |
Sounds good ! Ideally we would want such incremental changes in M1/M2. M3 and RC1 are too close for comfort. |
Pattern matching using instanceof operator in Java generally involves testing whether an object belongs to a certain type, and further converting the object to that type depending on the test result.
From Java 16 onwards, this conversion step is avoided by using the type pattern as the second operand of instance operator itself. This helps make the code more concise.
This commit has tried to implement the above mentioned code change throughout.
Ref: #592