Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6280975
Votes 1
Synopsis Parameterized exceptions are erased too soon
Category java:compiler
Reported Against
Release Fixed
State 11-Closed, duplicate of 6199662, bug
Priority: 2-High
Related Bugs 6325201 , 5086027 , 6199662
Submit Date 06-JUN-2005
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"

  xxxxx@xxxxx   2005-06-06 16:51:45 GMT
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang