JDK-6270396 : Javac creates a class files that causes AbstractMethodError
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2005-05-13
  • Updated: 2010-05-11
  • Resolved: 2005-05-14
Related Reports
Duplicate :  
Description
Compile the following code and run it. You'll get:

Exception in thread "main" java.lang.AbstractMethodError: Bar.doIt()Ljava/lang/String;
        at JavacTest.main(JavacTest.java:8)

------------------------------------------------

public class JavacTest {
    public static void main(String[] args) {
        IBar b = new Bar();
        String x = b.doIt();
    }
}

class Foo<T> {
    public final T doIt() { return null; }
}

interface IBar {
    String doIt();
}

class Bar extends Foo<String> implements IBar {
}

###@###.### 2005-05-13 21:38:48 GMT

Comments
WORK AROUND Remove the final keyword from the doIt method. ###@###.### 2005-05-13 21:38:48 GMT
13-05-2005