Skip to content

Comments

Generics cleanup#25

Open
dgruntz wants to merge 3 commits intoeppleton:masterfrom
dgruntz:generics-cleanup
Open

Generics cleanup#25
dgruntz wants to merge 3 commits intoeppleton:masterfrom
dgruntz:generics-cleanup

Conversation

@dgruntz
Copy link
Contributor

@dgruntz dgruntz commented Aug 15, 2018

This PR adds generic declarations at some places (instead of the use of raw types). This may simplify the code (as casts can be dropped).

However, at one place this change leads to the warning "A generic array of TableColumn<Player,?> is
created for a varargs" and therefore I added a suppress warnings annotation, but I have seen in later projects that you have this problem in other classes as well and you have not added an ignore warnings annotation, so the one I have added could be removed.

dgruntz added 3 commits July 28, 2018 00:54
The choice-box used in this example was declared as a raw type:
   ChoiceBox cb = new ChoiceBox();
This commit makes use of the generic type
   ChoiceBox<String> cb = new ChoiceBox<>();
Declares the TableView tableView as a generic type:
        TableView<Player> tableView = new TableView<>();

However, with this change the method call
   tableView.getColumns().addAll(firstName, lastName, goals);
leads to the warning "A generic array of TableColumn<Player,?> is
created for a varargs", therefore I added a suppress warnings
annotation.
Removes the cast to Player in the line
   ((Player) t.getTableView().getItems().get(t.getTablePosition()
     .getRow())).setFirstName(t.getNewValue());
as this is given by the generics declaration.
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