AS400 JVM bug ? AbstractMethodError when using method defined in an interface through an abstract class implementing this interface.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   yoann_jagoury
Posted On:   Thursday, January 30, 2003 08:38 AM

Did anyone come accross this problem: You have an interface defining a method (e.g. getInt()) You have an abstract class implementing this interface but not the method. You have an object implement this abstract class. When using the method defined in the interface through the abstract class you get an annoying: java.lang.AbstractMethodError like this: ITest.java: public interface ITest { int getInt(); } AbstractTest.java: public abstract class AbstractTest implements ITest{} SimpleTest.java: public class SimpleTest extends AbstractTest { public int    More>>

Did anyone come accross this problem:

You have an interface defining a method (e.g. getInt())

You have an abstract class implementing this interface

but not the method.

You have an object implement this abstract class.



When using the method defined in the interface through

the abstract class you get an annoying:

java.lang.AbstractMethodError



like this:

			ITest.java:
			
public interface ITest {
int getInt();
}

AbstractTest.java:
public abstract class AbstractTest implements ITest{}

SimpleTest.java:
public class SimpleTest extends AbstractTest {
public int getInt() {return 1;}}

Test.java:
public class Test
{
public static void main(String[] args)
{
use(new SimpleTest());
}
static void use(AbstractTest test)
{
test.getInt();
}
}



could this be an AS400 JVM bug : OS400 V5R1 using java 1.3
   <<Less

Re: AS400 JVM bug ? AbstractMethodError when using method defined in an interface through an abstract class implementing this interface.

Posted By:   Christopher_Koenigsberg  
Posted On:   Thursday, January 30, 2003 10:58 AM

Maybe you need to change "static void use(AbstractTest test)", to "static void use(ITest test)"...

About | Sitemap | Contact