java - Missing type arguments for generic class -
using library abstract class a , interfaces i , j, following warning message when extend / implement class / interfaces:
missing type arguments generic class j<t>.
as mwe, classes follows (t , s generic type parameters):
public abstract class {} public interface i<t extends a> { public <s extends t> void dostuff(j<? super s> param); } public interface j<t extends a> { public void dootherstuff(); } here classes:
public class aextended extends {} public class iimplemented implements i<aextended> { @override public void dostuff(j param) {} } explicitly using class aextended below not implement dostuff() i:
public class iimplemented implements i<aextended> { @override public void dostuff(j<aextended> param) {} }
you're not overriding dostuff in iimplemented because method not generic , type bounds not present. version of dostuff should work you:
public <s extends aextended> void dostuff(j<? super s> param) {} notice since type of i aextended used appropriately here, , lower bound in wildcard type j included.
Comments
Post a Comment