I have three generic interfaces (with an inverses relationship between two of them) and want to process them in a recursive method:
public interface User<R extends Role<R,U>, U extends User<R,U>>
{
public R getRole();
public void setRole(R role);
}
public interface Role<R extends Role<R,U>,U extends User<R,U>>
{
public List<R> getRoles();
public void setRoles(List<R> roles);
public List<U> getUser() ;
public void setUser(List<U> user);
}
Now I want to do some processing with a recursion in my Worker class:
public <R extends Role<R,U>,U extends User<R,U>> void recursion(List<R> roles)
{
for(R role : roles)
{
recursion(role.getRoles());
}
}
I get this error and I'm didn't figured out why this does not work or how I can solve this:
Bound mismatch: The generic method recursion(List<R>) of type Worker is not
applicable for the arguments (List<R>). The inferred type User<R,User<R,U>>
is not a valid substitute for the bounded parameter <U extends User<R,U>>