I am working with tree's in java and I have the following interface for a simple unordered tree with a self reference:
public interface Node<N extends Node> {
public N getParent();
public void setParent(N parent);
public Collection<N> getChildren();
public void addChild(N node);
public void removeChild(N node);
public N getRootNode();
... more ...
}
The idea of course is to create a typesafe Node
public abstract class ParentChildNode<E extends Node> implements Node<E> {
problem that really annoys me is the warning i get:
ParentChild is a raw type. References to generic type Node<N> should be parameterized
warning on this line:
public interface Node<N extends Node> {
warning on this line:
public abstract class ParentChildNode<E extends ParentChild> implements ParentChild<E>
I can do:
public interface Node<N extends Node<?>> {
but i fear im treading into yuckness territory. i can suppress the warning but thats not allowed where i work.
any suggestions? I noticed java.util collections API does not have any warnings anywhere.
thanks in advance