Removes final declarations#24
Open
dgruntz wants to merge 7 commits intoeppleton:masterfrom
dgruntz:final-cleanup
Open
Removes final declarations#24dgruntz wants to merge 7 commits intoeppleton:masterfrom dgruntz:final-cleanup
dgruntz wants to merge 7 commits intoeppleton:masterfrom
dgruntz:final-cleanup
Conversation
In this example the final declaration of final TextArea textArea = new TextArea(); is not necessary.
The final modifier is removed from the declaration final ContextMenu contextMenu = new ContextMenu(); Although this field is used in a lambda, the final property is inferred automatically by the compiler.
The final modifier at the declaration of the two stack panes
final StackPane stackPane = new StackPane(...);
final StackPane stackPane1 = new StackPane(...);
can be removed, the panes are not used in an anonymous class.
it is not cecessary to declare the two fields
CardStackLayout cardStackLayout = new CardStackLayout();
CardStackLayout cardStackLayout2 = new CardStackLayout();
as fnal.
Removes the final declaration from
final HomeTimeline homeTimeline = new HomeTimeline();
This field is used in an action listener, but the final proeprty
can be inferred.
Declares the toolbar as final as well, as all other fields in this class (except to the status field, as that one is created lazily).
Removes final modifiers from local variables where the compiler can derive the final proprty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In some classes, local variables are declared as final, but (as you know) it is no longer necessary to declare local variables which are used in anonymous classes as final. The compiler can infer the final property automatically. I assume that you have converted some anonymous classes to lambda expressions, and in this case I would drop the final modifier from locals.
The commits contained in this PR remove some of these final declarations.
For fields however, the final modifier is useful (JMM => initialization) so at least at one place I have added a final modifier.