#940 Erroneous IncompatibleClassChangeError

open
nobody
emitter (227)
5
2005-11-10
2005-11-10
Anonymous
No

I have an abstract class which "implements" an
interface but does not define the methods of that
interface (hence making the class abstract).

I compile this class using Jikes 1.22, with the
"-target 1.1" option.

Jikes gives no warnings or errors.

Java 1.1.8 fails to load the class, reporting an
IncompatibleClassChangeError due to an unimplemented
interface method in the abstract class.

Example: a single file, Run.java, containing:

----

public class Run
{
public static void main(String[] args)
{
Class c = BadAbstract.class;
System.out.println("Hello");
}
}

abstract class BadAbstract implements MyInterface
{
// With this method commented out, Jikes 1.22 (with
the "target 1.1" flag supplied)
// happily compiles this source file, but Java
1.1.8 fails to load the resulting class
// file.
//public abstract String my_method();
}

interface MyInterface
{
public String my_method();

}

----

Compile with Jikes 1.22 using the command:
> jikes -target 1.1 Run.java

Run using Java 1.1.8 using the command:
> java Run

The result is:

java.lang.IncompatibleClassChangeError: Unimplemented
interface method
at Run.class(Run.java:0)
at Run.main(Run.java:6)

Note that
1) The class loads without errors in Java 1.3
2) Uncommenting the marked line in BadAbstract makes
the problem go away.

Submitted by malcolmwood76@yahoo.co.uk

Discussion


Log in to post a comment.