Bug 31450

Summary: Compiler bug with overriding protected abstract methods, where a parent class has package-private abstract method
Product: [Eclipse Project] JDT Reporter: Jon Skeet <skeet>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: leeder
Version: 2.1   
Target Milestone: 2.1 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jon Skeet CLA 2003-02-10 09:26:27 EST
[M5]

Note, this is *not* the same test case as bug 31398 - note that here the method
is widened to protected access by an intermediate class.

PackageClass.java:
package first;

abstract class PackageClass
{
    abstract void someMethod();
}

BaseClass.java:
package first;

public abstract class BaseClass extends PackageClass
{
    protected abstract void someMethod(); // Widened to protected access
}

Subclass.java:
package second;

import first.BaseClass;

public class Subclass extends BaseClass
{
    public void someMethod()
    {
    }
}

Error messages:
Warning	The method Subclass.someMethod() does not override the inherited method
from PackageClass since it is private to a different package.

Error This class must implement the inherited abstract method
PackageClass.someMethod(), but cannot override it since it is not visible from
Subclass. Either make the type abstract or make the inherited method visible.

The above code is accepted by JDK1.4.1.
Comment 1 Philipe Mulet CLA 2003-02-10 09:29:40 EST
Duplicate of bug 31398

*** This bug has been marked as a duplicate of 31398 ***