I'd like to know how to avoid this unchecked cast warning in eclipse even though it might not be necessary since I know what types i'm putting into the object. My CriteriaComboBox extends a RenderedComboBox which extends a JComboBox. My class is of type TEST.Criteria.
Can someone advise if this is just a bug in eclipse? Should I just add a suppress warning? Or am I not doing this correctly?
Here is the code snippet:
// identify the source dropdown component
Object source = evt.getSource();
CriteriaComboBox<TEST.Criteria> cBox = null;
if (source instanceof CriteriaComboBox) {
cBox = (CriteriaComboBox<TEST.Criteria>) source;
}
This also give me the same warning:
if (source instanceof CriteriaComboBox) {
cBox = (CriteriaComboBox<TEST.Criteria>) source;
}
My version of eclipse is 2021-12 (4.22.0) running on ubuntu.