mercredi 27 mai 2015

Removing Warnings (Type safety: Unchecked cast from capture#2-of ? extends Template to T)

Inside my IF all 3 lines having warnings. How I can remove it without supress? Is there a better solution?

public void template() throws NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
        if(templateResult == null){
            Class templateClass = getGenericTypeArgument(this.getClass(), 0);
            Constructor<? extends Template> constructor = templateClass.getConstructor(new Class[]{List.class, List.class});
            templateResult = (T) constructor.newInstance(listData, listaDataRes);       
        }
    }





Aucun commentaire:

Enregistrer un commentaire