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

class extended by abstract class with default access method

XMLWordPrintable

    • sparc
    • solaris_2.5



      Name: ngC57085 Date: 04/01/98



      Java compiler jdk1.2beta3N considers class from one package that are extended
      by abstract class with default access abstract method from another package
      as an abstract class.

      -----------------clss17104a------------------
      package a;

      public abstract class clss17104a {
         abstract int proc();
      }
      ---------------------------------------------
      -----------------clss17104b------------------
      package b;
      import a.clss17104a;

      public class clss17104b extends clss17104a {
      }
      ---------------------------------------------
      Absract method int proc() from class clss17104a is not accessable outside
      package a, so class clss17104b does not contain abstract method int proc().
      But Java compiler jdk1.2beta3N does not compile class clss17104b.

      > java -version
      java version "1.2beta3"
      > javac -d . clss17104a.java
      > javac -d . clss17104b.java
      clss17104b.java:4: class b.clss17104b is not able to provide an implementation for the method int proc() declared in class a.clss17104a because it is private to another package. class b.clss17104b must be declared abstract.
      public class clss17104b extends clss17104a {
                   ^
      1 error
      >


      ======================================================================

            tturnidgsunw Todd Turnidge (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: