Extending a class using a generic parameter

I need to get the following class:

public abstract class MyTool<VIEW extends MyView>
  implements LookupListener, MouseListener, MouseMotionListener, KeyListener {}

The following does not work:

public abstract class MySubTool<VIEW> extends MyTool<VIEW> {}

Thank!

+3
source share
2 answers

Compiler MySubTool as a way to learn that VIEWin MySubToola subclass MyView, you need to use it once again:

public abstract class MySubTool<VIEW extends MyView> extends MyTool<VIEW> {}
+3
source

It must:

public abstract class MySubTool<VIEW extends MyView> extends MyTool<VIEW> {}
+1
source

All Articles