Bug 31591 - abstract method in base class, defined in a subclass results in compile error
Summary: abstract method in base class, defined in a subclass results in compile error
Status: RESOLVED DUPLICATE of bug 31398
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-11 16:13 EST by Erik Johnson CLA
Modified: 2003-02-12 05:26 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***