-
Notifications
You must be signed in to change notification settings - Fork 49
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 #556
Code Cleanup: Java 16 instanceof pattern matching #556
Conversation
Hi @jukzi , could you please check on this ? |
Was this an pure automated cleanup, or manual edit? Or both? |
Manual edit only. |
@@ -144,17 +144,17 @@ public class JavaLaunchableTester extends PropertyTester { | |||
*/ | |||
private IType getType(IJavaElement element) { | |||
IType type = null; | |||
if (element instanceof ICompilationUnit) { | |||
type= ((ICompilationUnit) element).findPrimaryType(); | |||
if (element instanceof ICompilationUnit iCompilationUnit) { |
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.
on github the intendation looks wrong here
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.
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.
It may be an automated conversion of TABs to whitespace or other way around. Would be good if the intendation would be uniform within a method. Please try autoformat the whole affected method.
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.
Will do this.
@@ -3337,8 +3331,8 @@ private static void updateCompliance(IVMInstall vm) { | |||
if (LaunchingPlugin.isVMLogging()) { | |||
LaunchingPlugin.log("Compliance needs an update."); //$NON-NLS-1$ | |||
} | |||
if (vm instanceof IVMInstall2) { | |||
String javaVersion = ((IVMInstall2)vm).getJavaVersion(); | |||
if (vm instanceof IVMInstall2 ivmInstall) { |
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.
intendation looks wrong on github
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.
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.
Enable "show whitespace characters" and you'll most likely see a mixture of tabs and spaces and different tools display tabs as 2,4,8,... whitespaces.
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.
Enable "show whitespace characters" and you'll most likely see a mixture of tabs and spaces and different tools display tabs as 2,4,8,... whitespaces.
Thanks
beside minor intendation looks ok for me |
please make that clear in the commit message "manual code cleanup" to not be confused with dogfooding |
0a514b6
to
66814be
Compare
Done the changes now. |
9f896cb
to
7ae5a62
Compare
Hi @jukzi |
* As well, this class provides VM install change notification, | ||
* and computes class paths and source lookup paths for launch | ||
* configurations. | ||
* The central access point for launching support. This class manages the registered VM types contributed through the |
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.
Manu unrelated format changes in JavaRuntime.java
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.
Same case as of JavaLaunchableTester.java - So removed the changes now.
@@ -119,7 +119,7 @@ protected ISourceContainer[] createSourceContainers() throws CoreException { | |||
IPath path = entry.getPath(); | |||
IResource resource = root.findMember(path); | |||
if (resource instanceof IContainer) { |
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.
missing cleanup here
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.
Done.
7ae5a62
to
7a5de07
Compare
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.
LGTM, lets wait some days if someone else wants to review too.
Sure @jukzi , Thanks |
Performed manual code cleanup in pattern matching using instanceof operator according to Java 16 guidelines, making the code more concise for classes in jdt.launching package.
7a5de07
to
a825216
Compare
This pull request changes some projects for the first time in this development cycle.
An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patch
Further information are available in Common Build Issues - Missing version increments. |
Thanks for this one. I really find such PRs reducing time to read code kind one of the most important things as with the limited resources it's very hard to dedicate time for issues/improvements making every second counts. |
Thank you @akurtakov & @jukzi |
I like such motivating comments. thanks. And thanks for @SougandhS for improving the code even in minor cases. |
Thanks again @jukzi |
Performs code cleanup in pattern matching using instanceof operator according to Java 16 guidelines, making the code more concise for classes in jdt.launching package.
What it does
How to test
Author checklist