<E extends Exception> Only Compiles Sometimes (possible bug)

Consider:

publicinterface RootedNodeAlgo<R,T,J,Eextends Exception>

{

public R forParentNode(RootedNode<J> n, T... input)throws E;

public R forLeafNode(RootedNode<J> n, T... input)throws E;

}

publicabstractclass LeafSyntaxNodeBaseextends SyntaxNodeBaseimplements LeafSyntaxNode

{

public <R, T, Eextends Exception> R execute(RootedNodeAlgo<R,T,SyntaxNode,E> algo, T... input)throws E

{

return algo.forLeafNode(this, input);// error sometimes on this line

}

}

When compiled as the only file being compiled, never a problem. When being compiled with a group of files I sometimes get the error:

Error: unreported exception java.lang.Exception; must be caught or declared to be thrown

This seems to an incorrect error though as we can show that E is the only checked exception that could ever be raised and we have declared E as thrown. Sometimes the compiler will generate this error and sometimes it wont for the exact same source. Compiling the files all alone never generates this error and no unusual runtime behavior has ever been observed.

Is this a compiler bug?

[1930 byte] By [DejasPerPera] at [2007-11-27 9:56:16]
# 1
Hi,I would appreciate a "full code sample" (with all the interface declaration you are using).It would be easier for testing/helping.Anyway i compiled it in a IDE (eclipse) and out of it (javac) using a "group of file" and it worked.What is your javac version ?
ibanna at 2007-7-13 0:26:23 > top of Java-index,Core,Core APIs...
# 2

The hierarchy is pretty big, but here is more:

Also javac = JDK 5.0_11

abstract public class SyntaxNodeBase extends VertexBridge<SyntaxNode> implements SyntaxNode

{

private SyntaxNode _parent;

SyntaxNodeBase()

{

}

public SyntaxNode getParent()

{

return _parent;

}

public void setParent(SyntaxNode parent)

{

_parent = parent;

}

public SyntaxNode getContents()

{

return this;

}

abstract public <R,T, E extends Exception> R execute(SyntaxNodeAlgo<R,T,E> algo, T...input) throws E;

public String toString()

{

return this.getClass().getName();

}

public <R,T, E extends Exception> R execute(AGLastNodeAlgo<R,T,E> algo, T... input) throws E

{

return algo.forArrayList(this, input);

}

}

public interface RootedNode<J> extends Vertex<J>

{

public <R,T,E extends Exception> R execute(RootedNodeAlgo<R,T,J,E> algo, T...input) throws E;

}

public interface LeafSyntaxNode extends SyntaxNode

{

// actually empty

}

public interface SyntaxNode extends AGLastNode<SyntaxNode>

{

public <R,T, E extends Exception> R execute(SyntaxNodeAlgo<R,T,E> algo, T...input) throws E;

public RootedNode<SyntaxNode> getParent();

public void setParent(SyntaxNode parent);

}

Message was edited by:

DejasPerPer

DejasPerPera at 2007-7-13 0:26:23 > top of Java-index,Core,Core APIs...