I fear I may be making a newbie error here. I have the ActionListener below, but I get the warning Unchecked cast: 'java.lang.Object' to 'javax.swing.JComboBox<java.lang.String>' inside the if statement. How can I solve it? I want to invoke a method from the JComboBox API.
I am not interested in suppressing the warning.
public class MyActionListener implements ActionListener {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
        Object source = actionEvent.getSource();
        JComboBox<String> comboBox;
        if (source instanceof JComboBox) {
            comboBox = (JComboBox<String>) source;
        }
    }
}
 
     
     
    