Bug 31591

Summary: abstract method in base class, defined in a subclass results in compile error
Product: [Eclipse Project] JDT Reporter: Erik Johnson <ejohnson>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 RC1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Erik Johnson CLA 2003-02-11 16:13:33 EST
The following legal code results in compile error, which shouldn't be the case:

package beans;
public abstract class Base {
	abstract void doSomething();
}

package beans;
public abstract class SubClass extends Base {
	public final void doSomething() {
		System.out.println("hello world");
	}
	public void anotherMethod() {
	}
}

package beans.test;
import beans.SubClass;
public class TestClass extends SubClass {
	public void anotherMethod() {
		super.anotherMethod();
	}
}

In this case, the base class in package "beans" defines a package-private 
method doSomething() which the subclass, "SubClass" implements as a public 
final method.  Any class that extends from "SubClass" but is in a different 
package, then contains the following compile error:
"This class must implement the inherited abstract method Base.doSomething(), 
but cannot override it since it is not visible from TestClass. Either make the 
type abstract or make the inherited method visible."

Making the Base.doSomething() public will fix this error; however this isn't a 
Java error--this compiles fine using javac and older Eclipse versions.

Environment:
JDK 1.4.1_01
Eclipse M5
Comment 1 Olivier Thomann CLA 2003-02-11 16:31:00 EST
This looks like a duplicate of bug 31398.
You can get the patch from the JDT/Core dev page.
See
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt-core-home/r2.1/main.html#updates

This link might be split by bugzilla. Let us know if this fixes the problem.
Comment 2 Erik Johnson CLA 2003-02-11 18:27:09 EST
The patch fixes this.  
Thanks!
Comment 3 Philipe Mulet CLA 2003-02-12 05:26:00 EST
Closing as duplicate of bug 31398

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