Buggy code:
public class ManagedElement implements Serializable , IModel { private static final long serialVersionUID = 3787493356525574746L ; protected List < Association > toAssociations = new LinkedList < Association > ( ) ; public List < Association > getToAssociations ( ) { } public void setToAssociations ( List < Association > toAssociations ) { } public List < ? extends Association > getToAssociationsByType ( Class < ? extends Association > clazz ) { } public Association getFirstToAssociationsByType ( Class < ? extends Association > clazz ) { } public List < ? extends ManagedElement > getToAssociatedElementsByType ( Class < ? extends Association > clazz ) { } public ManagedElement getFisrtsToAssociatedElementByType ( Class < ? extends Association > clazz ) { } public Association getToAssociationByElement ( ManagedElement element ) { } public Association getFirstToAssociationByTypeAndElement ( Class < ? extends Association > clazz , ManagedElement element ) { } public ManagedElement getFirstToAssociatedElementByType ( Class < ? extends Association > clazz ) { } public void addToAssociation ( Association assoc ) { } public boolean removeToAssociation ( Association assoc ) { } public boolean removeToAssociationByElement ( ManagedElement element ) { } public boolean removeToAssociationByTypeAndElement ( Class < ? extends Association > clazz , ManagedElement element ) { } protected List < Association > fromAssociations = new LinkedList < Association > ( ) ; @ XmlTransient public List < Association > getFromAssociations ( ) { } public void setFromAssociations ( List < Association > fromAssociations ) { } public List < ? extends Association > getFromAssociationsByType ( Class < ? extends Association > clazz ) { } public Association getFirstFromAssociationsByType ( Class < ? extends Association > clazz ) { } public List < ? extends ManagedElement > getFromAssociatedElementsByType ( Class < ? extends Association > clazz ) { } public ManagedElement getFirstFromAssociatedElementByType ( Class < ? extends Association > clazz ) { } public Association getFromAssociationByElement ( ManagedElement element ) { } public Association getFirstFromAssociationByTypeAndElement ( Class < ? extends Association > clazz , ManagedElement element ) { } public void addFromAssociation ( Association assoc ) { } public boolean removeFromAssociation ( Association assoc ) { } public boolean removeFromAssociationByElement ( ManagedElement element ) { } @ SuppressWarnings ( "unchecked" ) public List < SettingData > getElementsSettingData ( ) { } public boolean addElementSettingData ( SettingData settingData ) { } public boolean removeElementSettingData ( SettingData settingData ) { } @ SuppressWarnings ( "unchecked" ) public < T extends SettingData > List < T > getAllElementSettingDataByType ( Class < T > clazz ) { List < SettingData > list = getElementsSettingData ( ) ; ArrayList < T > toReturn = new ArrayList < T > ( ) ; for ( SettingData settingData : list ) { <START_BUG> if ( clazz . getClass ( ) . isInstance ( settingData ) ) { <END_BUG> toReturn . add ( ( ( T ) ( settingData ) ) ) ; } } return toReturn ; } protected ManagedElement ( ) { } private String instanceID ; @ XmlID public String getInstanceID ( ) { } public void setInstanceID ( String instanceID ) { } private String caption ; public String getCaption ( ) { } public void setCaption ( String caption ) { } private String description ; public String getDescription ( ) { } public void setDescription ( String description ) { } private String elementName ; public String getElementName ( ) { } public void setElementName ( String elementName ) { } @ Override public List < String > getChildren ( ) { } public void afterUnmarshal ( Unmarshaller u , Object parent ) { } protected String generateInstanceID ( ) { } @ Override public String toXml ( ) throws SerializationException { } }

Fix:
if ( clazz . isInstance ( settingData ) ) {