[LibGDX] Unchecked Call Warning

I’m getting an unchecked call warning where it doesn’t seem to make sense. I’m using the SelectBox widget from libGDX’s Scene2D API. First, I instantiate the SelectBox like this:


lHeadBox = new SelectBox(skin, "equipment");

Then I create an Array to add to the SelectBox items and add a default string to start the list:


Array<String> headList = new Array<String>();
headList.add("none");

Finally, I set this Array as the items of the SelectBox, and this is where I get the unchecked call warning for the setItems(Array items) method:


headBox.setItems(headList);

The exact warning is:


Unchecked call to 'setItems(Array<T>)' as a member of raw type 'com.badlogic.gdx.scenes.scene2d.ui.SelectBox'

I don’t understand this. I thought the unchecked call warning was due to not specifying the type parameter, which I thought I was doing by declaring the Array with the String parameter type (i.e. Array instead of just Array).

Thanks!

Make following change:


-HeadBox = new SelectBox(skin, "equipment");
+HeadBox = new SelectBox<String>(skin, "equipment");

The select box is generic since gdx 1.0 I think and also requires a type parameter. If you supply an array of strings, then you need to set the type of the select box also to string.

Sorry, it took me a while to get back to this problem, but your suggestion cleared everything up. Thanks!

Disable the generics warnings that are overly strict. Like this: