JDK-4089922 : Issue: abstract method inheritance across package boundaries. Need lang lawyer.
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.1.4
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_2.6
  • CPU: sparc
  • Submitted: 1997-10-30
  • Updated: 2000-04-25
  • Resolved: 2000-04-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.3.0 rc3Fixed
Related Reports
Relates :  
Relates :  
Description
allan.jacobs@Eng 1997-10-30

A small number of bugs involve codes that looks like those included below.
They involve the interaction between abstract methods, packages, and
inheritance.  The issues have been outstanding for just about 1 year.

Should the following code be rejected at compile-time?
My 2 cents:
An abstract class is in one package.  A class that extends the abstract
class is in another package.  All abstract methods in the abstract class
have default access control, so they are inaccessible to the child class.
Because they are inaccessible, it seems like the child should not inherit
the abstract methods and therefore not be abstract at all.

    package p1;
    public abstract class Broken {
        abstract void f (); // default access
    }

    package p2;
    class TimeBomb extends p1.Broken {
                            // TimeBomb does not implement void f().
    }

Should the following code be rejected at compile-time?
My 2 cents:
An abstract class is in one package.  A class that extends the abstract
class is in another package.  All abstract methods in the abstract class
have default access control, so they are inaccessible to the child class.
Because they are inaccessible, it seems like the child should not inherit
the abstract methods.  An attempt to hide an inaccessible method should
succeed.

    package p1;
    public abstract class Broken {
        abstract void f (); // default access
    }

    package p2;
    class TimeBomb extends p1.Broken {
        void f () {
        }
    }


Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic FIXED IN: kestrel-rc3 INTEGRATED IN: kestrel-rc3
14-06-2004

EVALUATION This issue (and several interrelated ones) have now been addressed. The issue is broader than the behavior when methods are abstract. The specific issue cited here was settled long ago. See bug 1240831 for an extensive discussion. The semantics of method override vis-a-vis package private methods are now completely determined by the revised JVMS. Draft text for a corresponding correction to the JLS exists, has been cross checked with Guy Steele and will be posted to the clarifications and amendments page shortly. Our implementations do not yet implement this behavior. gilad.bracha@eng 1998-11-10
10-11-1998