Код: Выделить всё
public interface ItemSelectPanelFactory
{
public static final int MAX_RADIO_COUNT = 4;
@SafeVarargs
public static
V createPanel(String label, T... items)
{
V result = null;
if (MAX_RADIO_COUNT < items.length)
{
result = new ItemSelectComboPanel(label, items);
}
else
{
result = new ItemSelectRadioPanel(label, items);
}
return result;
}
}
// one of those classes is declared as:
public class ItemSelectRadioPanel extends JPanel
implements ActionListener, LabeledInput
{...}
// The other looks like
public class ItemSelectComboPanel
extends AbstractLabeledInputComponent
{...}
// but that inheritance chain does also derive from JPanel.
// the other interface declaration is:
public interface LabeledInput
{
public T getValue();
}
Код: Выделить всё
javac -d obj -Xlint:unchecked -classpath obj -sourcepath . . .
Код: Выделить всё
src/flb/gui/ItemSelectPanelFactory.java:61: error: incompatible types: ItemSelectComboPanel cannot be converted to V
result = new ItemSelectComboPanel(label, items);
^
where T,V are type-variables:
T extends Object declared in method createPanel(String,T...)
V extends JPanel,LabeledInput declared in method createPanel(String,T...)
src/flb/gui/ItemSelectPanelFactory.java:65: error: incompatible types: ItemSelectRadioPanel cannot be converted to V
result = new ItemSelectRadioPanel(label, items);
^
where T,V are type-variables:
T extends Object declared in method createPanel(String,T...)
V extends JPanel,LabeledInput declared in method createPanel(String,T...)