Bug 22428

Summary: Compiler 1.4 - should report visibility issue for shadowed protected method
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: snickell
Version: 2.0   
Target Milestone: 2.1 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2002-08-14 11:52:58 EDT
Build R2.0

When compiling the following test case, javac 1.4 reports an error, where the 
Eclipse compiler (1.4) doesn't.

package p;
public class X {
  protected void foo(){}
}
class Z {
  void bar(){
    new q.Y().foo(); // should complain about visibility
  }
}

package q;
public class Y extends p.X {
  protected void foo(){}
}
Comment 1 Philipe Mulet CLA 2002-08-14 11:56:11 EDT
Two fixes are possible:

1- either change the #canBeSeenBy implementation to check for shadowing 
protected methods (somewhat similar to package visible check)

2- or change the #findMethod implementation to explicitly filter out the 
shadowed method during lookup (leaving the non-visible one in for complaining).

Releasing fix #2.
Comment 2 David Audel CLA 2002-09-19 07:01:07 EDT
Verified.
Comment 3 Philipe Mulet CLA 2002-09-19 07:13:37 EDT
*** Bug 23788 has been marked as a duplicate of this bug. ***
Comment 4 Philipe Mulet CLA 2002-09-19 07:14:22 EDT
*** Bug 23788 has been marked as a duplicate of this bug. ***