Skip to content

Comments

Removes final declarations#24

Open
dgruntz wants to merge 7 commits intoeppleton:masterfrom
dgruntz:final-cleanup
Open

Removes final declarations#24
dgruntz wants to merge 7 commits intoeppleton:masterfrom
dgruntz:final-cleanup

Conversation

@dgruntz
Copy link
Contributor

@dgruntz dgruntz commented Aug 15, 2018

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.

dgruntz added 7 commits August 1, 2018 18:59
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant