-
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
Clean Up: Add final modifier to private fields #739
Conversation
Test Results 246 files ±0 246 suites ±0 59m 57s ⏱️ - 4m 30s For more details on these errors, see this check. Results for commit ed65987. ± Comparison against base commit d880fec. ♻️ This comment has been updated with latest results. |
I personally see no value in adding more words (final) to the code and in the past we have actually reduced the usage of final. WDYT @HannesWell? |
Final fields are good, because they avoid possibly improper field initialization at runtime.
Not sure who is "we" and why removing final would be desired? |
I think final fields make it more clear that one doesn't not intend subsequent assignment. With implicit final variables in newer Javas, the use of final in the body of a method is kind of noisy... |
@@ -24,7 +24,7 @@ | |||
*/ | |||
public class CollapseAllAction extends Action { | |||
|
|||
private TreeViewer fViewer; | |||
private final TreeViewer fViewer; |
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.
does this compile? AFAIK, this produces unitialized final field
error.
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.
"final" on local variables is bad boiler plate and should be removed. But on fields it is mandatory for proper multi threading. I am tired to solve single missing finals, so i just added all missing. May be it adds some keywords to structures that are not used concurrently but it's to much work for me to figure out where it is needed and where it could be skipped. |
Thanks for clarification, change is fine for me in this case. |
ask for a refactoring in jdt |
The compiler knows that and could emit a warning. |
54d7a0e
to
c682848
Compare
I have the same opinion as the others for the mentioned reasons. Additionally it also makes the code easier to follow because one can be sure that the field's reference is not changed as a side-effect of any method call. |
15:05:27 [ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:4.0.2:compare-version-with-baselines (compare-attached-artifacts-with-release) on project org.eclipse.pde.unittest.junit: Only qualifier changed for (org.eclipse.pde.unittest.junit.feature.jar/1.0.500.v20230912-1247). Expected to have bigger x.y.z than what is available in baseline (1.0.500.v20230728-0611) -> [Help 1] |
15:57:01 [API ERROR] File MANIFEST.MF at line 6: The service version is increased unnecessarily since either the major or minor or service version is already increased (location: /home/jenkins/agent/workspace/eclipse.pde_PR-739/ui/org.eclipse.pde.unittest.junit/META-INF/MANIFEST.MF) |
I need help with the version bump here: org.eclipse.pde.unittest.junit - if i increase i get an error, if i do not increase i get an another error :( |
i guess that error message is wrong and it should say project |
ignoring unrelated BundleMergeSplitTests #261 |
No description provided.