Bug 271303 - [1.5][compiler] Override and package visibility issue
Summary: [1.5][compiler] Override and package visibility issue
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-06 08:03 EDT by Yannick Welsch CLA
Modified: 2009-04-28 09:25 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch and testcase (3.26 KB, patch)
2009-04-06 13:47 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yannick Welsch CLA 2009-04-06 08:03:28 EDT
The jdt compiler raises an error for a legal (JLS-conform) Java program:


Code to reproduce error:

------------- A.java ---------------
package p1;

public class A {
    void m() {}
}

------------- B.java ---------------
package p2;

public class B extends p1.A {
    void m() {}
}

------------- C.java ---------------
package p1;

public class C extends p2.B {
    @Override void m() {}
}


This gives the following error:


1. ERROR in p1/C.java (at line 4)
	@Override void m() {}
	               ^^^
The method m() of type C must override or implement a supertype method


According to the JLS(3) sections 8.4.8.1 and 8.4.8.3, the method m in C overrides the method m in A.


The javac (1.6.0_07) compiler does not raise an error and is in this respect spec-conform.
Comment 1 Kent Johnson CLA 2009-04-06 13:47:45 EDT
Created attachment 131026 [details]
Proposed patch and testcase
Comment 2 Kent Johnson CLA 2009-04-06 15:23:26 EDT
Fix and test released for 3.5M7
Comment 3 Jay Arthanareeswaran CLA 2009-04-28 06:42:46 EDT
Verified for 3.5M7 using build I20090426-2000