title: Java generics not recognizing type?
body: <p>I have a class <code>Node</code> that serves as the abstract class for <code>DoublyLinkedNode</code> and <code>FibonacciNode</code>.</p>
  
  <pre><code>package com.benjamin;
  
  abstract class Node&lt;N, T extends Comparable&lt;T&gt;&gt; {
      private N prev;
      private N next;
      private T data;
  
      public N getPrev() { return prev; }
      public N getNext() { return next; }
      public T getData() { return data; }
  
      public void setPrev(N prev) { this.prev = prev; }
      public void setNext(N next) { this.next = next; }
      public void setData(T data) { this.data = data; }
  }
  </code></pre>
  
  <p><code>DoublyLinkedNode</code> and <code>FibonacciNode</code> extend this class as a way to provide common methods to both implementations.</p>
  
  <p>My issue is that java doesn't seem to recognize the type of <code>N</code> as a <code>DoublyLinkedList</code> when I pass it in.</p>
  
  <pre><code>package com.benjamin;
  
  public class DoublyLinkedNode&lt;T extends Comparable&lt;T&gt;&gt; extends Node&lt;DoublyLinkedNode&lt;T&gt;, T&gt;{
      DoublyLinkedNode() {
          setPrev(this);
          setNext(this);
          setData(null);
      }
  
      DoublyLinkedNode(T data) {
          setData(data);
      }
  
      @Override
      public String toString() {
          if(getData() != null) {
              return "| " + getData().toString() + " |";
          }
          else {
              return "| ; |";
          }
      }
  }
  </code></pre>
  
  <p>In my <code>DoublyLinkedList</code> class I get an error saying <code>unable to resolve method setPrev()</code> and in many places I get <code>required: DoublyLinkedList got: Object</code> </p>
  
  <p>This code was working fine until I decided to unify my implementations of Node.</p>