Strange runtime error: AbstractMethodError
Here's my code:
<SSCCE>
package com.castortech.tests;
import net.sf.saxon.om.SiblingCountingNode;
import com.castortech.common.parser.tokenstreaming.Token;
public class BugTest {
public static void main(String[] args) {
Token t = new Token();
t.getParent();
SiblingCountingNode scn = t;
scn.getParent(); /*<-- line 12*/
}
}
</SSCCE>
It compiles fine, and Token does indeed implement SiblingCountingNode
(although indirectly), which is why no cast is required. However, when I try
to run this program, I get the following runtime error:
<error>
Exception in thread "main" java.lang.AbstractMethodError:
com.castortech.common.parser.tokenstreaming.Token.getParent()Lnet/sf/saxon/om/NodeInfo;
at com.castortech.tests.BugTest.main(BugTest.java:12)
</error>
In case this is useful, the hierarchy is:
class Token extends class BaseNode
class BaseNode extends class ElementNode
class ElementNode extends class AbstractNode and implements interface
IElementNode
class AbstractNode implements interface INode
interface IElementNode extends interface INode
interface INode extends interfaces IAdaptable, NodeInfo and
SiblingCountingNode
Token, BaseNode, ElementNode, AbstractNode, IElementNode and INode are from
our internal codebase.
IAdaptable is from Eclipse's API
NodeInfo and SiblingCountingNode are from Saxon
(http://saxon.sourceforge.net/)
And in case this is a bug in the Eclipse compiler, I've tried it with 3.3M4
and I20070206-0010 and get the same error on both.
The baffling part, for me, is that the call to getParent() (which is NOT a
static method) works if the reference is Token, but not if the reference is
SiblingCountingNode.
Any hints on how to fix this error?
- Oliver