JDK-6280975 : Parameterized exceptions are erased too soon
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2005-06-06
  • Updated: 2010-04-03
  • Resolved: 2005-09-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
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