Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6519118

Classes are compiled but java.lang.AbstractMethodError is thrown at runtime

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 6
    • specification
    • rc
    • x86
    • windows_xp
    • Verified

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE runtime environment (build 1.6.0-b105)
      JavaHotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Classes are compiled without errors but java.lang.AbstractMethodError is thrown at runtime

      API Documentation says:
      Thrown when an application tries to call an abstract method.
       Normally, this error is caught by the compiler; this error can
       only occur at run time if the definition of some class has
       incompatibly changed since the currently executing method was last
       compiled.

      In my example error was NOT caught by the compiler and NO class has
       incompatibly changed since the currently executing method was last
       compiled.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run my code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There must be an error at time of compilation or NO exception must be thrown at runtime.
      ACTUAL -
      In my example error was NOT caught by the compiler and NO class has
       incompatibly changed since the currently executing method was last
       compiled.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.AbstractMethodError: p1.AbstractClass.doIt()V
      at p1.Test.main(Test.java:6)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /** src/p1/AbstractClass .java **/

      package p1;

      public abstract class AbstractClass {
      abstract void doIt();
      }

      /** src/p2/AbstractClass2 .java **/
      package p2;

      import p1.AbstractClass;

      public abstract class AbstractClass2 extends AbstractClass {
      public void doIt(){

      }
      }

      /** src/p1/RealClass .java **/
      package p1;

      import p2.AbstractClass2;

      public class RealClass extends AbstractClass2{

      }


      /** src/p1/Test .java **/
      package p1;

      public class Test {
      public static void main(String[] args) {
      AbstractClass c = new RealClass();
      c.doIt();
      }
      }

      ---------- END SOURCE ----------

            abuckley Alex Buckley
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: