warning: [unchecked] unchecked call to setCellValueFactory(Callback<CellDataFeatures<S,T>,ObservableValue<T>>) as a member of the raw type TableColumn column1.setCellValueFactory(new PropertyValueFactory<String, State>("name")); where S,T are type-variables:
S extends Object declared in class TableColumn
T extends Object declared in class TableColumn
code:
column1.setCellValueFactory(new PropertyValueFactory<>("name"));
warning: [unchecked] unchecked call to add(E) as a member of the raw type List
transitionTable.getColumns().add(column1);
where E is a type-variable:
E extends Object declared in interface List
code:
transitionTable.getColumns().add(column1);
warning: [unchecked] unchecked call to setAll(Collection<? extends E>) as a member of the raw type ObservableList
automatonSelection.getItems().setAll(automatonManager.getMachines());
where E is a type-variable:
E extends Object declared in interface ObservableList
code:
automatonSelection.getItems().setAll(automatonManager.getMachines());
automatonSelection is a ComboBox and getMachines() returns a LinkedList of the type Automaton
warning: [unchecked] unchecked call to addListener(ChangeListener<? super T>) as a member of the raw type ObservableValue
automatonSelection.valueProperty().addListener((ObservableValue observable,
where T is a type-variable:
T extends Object declared in interface ObservableValue
code:
automatonSelection.valueProperty().addListener((ObservableValue observable,
Object oldValue, Object newValue) -> {
stateChanged();
});
I tried to fix most of those warnings and managed to do so by adding generics, but I can't see how to fix those other 4 warnings.
An unchecked warning tells a programmer that a cast may cause a program to throw an exception somewhere else. Suppressing the warning with @SuppressWarnings("unchecked") tells the compiler that the programmer believes the code to be safe and won't cause unexpected exceptions.
The warning tells you that the compiler has encountered a condition that it can't guarantee the sense of. You should avoid having this kind of thing.
Unchecked assignment: 'java.util.List' to 'java.util.List<java.lang.String>' It means that you try to assign not type safe object to a type safe variable. If you are make sure that such assignment is type safe, you can disable the warning using @SuppressWarnings annotation, as in the following examples.
Don't declare your TableView
s and TableColumn
s as raw types.
In other words, instead of
TableView personTable ;
TableColumn firstNameColumn ;
use
TableView<Person> personTable ;
TableColumn<Person, String> firstNameColumn ;
etc.
Don't suppress these warnings, they will help you debug problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With