Duplicate :
|
|
Relates :
|
|
Relates :
|
SomeNode.java 1 class SomeNode extends NamedNode {} IRNode.java 1 public interface IRNode 2 { 3 public <Return, Input, ExceptionType extends Exception> Return execute (IRNamedNodeAlgo<Return,Input,ExceptionType> algo, Input... input) throws ExceptionType; 4 5 } IRNamedNodeAlgo.java 1 public interface IRNamedNodeAlgo<Return, Input, ExceptionType extends Exception> 2 { 3 4 public Return forNamedNode(IRNode node, Input... input) throws ExceptionType; 5 6 public Return forNonNamedNode(IRNode node, Input... input) throws ExceptionType; 7 8 } NamedNode.java 1 public class NamedNode implements IRNode 2 { 3 4 public <Return, Input, ExceptionType extends Exception> Return execute(IRNamedNodeAlgo<Return,Input,ExceptionType> algo, Input... input) throws ExceptionType 5 { 6 return algo.forNamedNode(this, input); 7 } 8 9 } Compiles without problem: javac IRNode.java IRNamedNodeAlgo.java NamedNode.java SomeNode.java Can't compile: javac SomeNode.java IRNode.java IRNamedNodeAlgo.java NamedNode.java NamedNode.java:6: unreported exception java.lang.Exception; must be caught or declared to be thrown return algo.forNamedNode(this, input); ^ 1 error See: http://forum.java.sun.com/thread.jspa?threadID=633301&tstart=0 javac -J-fullversion java full version "1.5.0_01-b08" ###@###.### 2005-06-06 16:51:45 GMT