Search code examples
javaintellij-ideawarningsgxtunchecked-cast

Inappropriate 'unchecked assignment' warning in IntelliJ


I have a line saying

List<FilterConfig> configs = filter.getFilterConfig();

and IntelliJ warns me about

Unchecked assignment: java.util.List to java.util.List<com.sencha.gxt.data.shared.loader.FilterConfig>

However, the called method says:

public abstract List<FilterConfig> getFilterConfig();

so I do not see any unchecked cast here.

https://docs.sencha.com/gxt/javadoc/com/sencha/gxt/widget/core/client/grid/filters/Filter.html https://docs.sencha.com/gxt/javadoc/com/sencha/gxt/data/shared/loader/FilterConfig.html


Solution

  • Thanks to Andy, I've found the problem: filter was a raw type here but I thought this should not affect getFilterConfig().

    As soon as I changed

    Filter filter
    

    to

    Filter<?,?> filter
    

    the warning disappeared.