Bug 22428 - Compiler 1.4 - should report visibility issue for shadowed protected method
Summary: Compiler 1.4 - should report visibility issue for shadowed protected method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 23788 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-08-14 11:52 EDT by Philipe Mulet CLA
Modified: 2002-09-19 07:14 EDT (History)
1 user (show)

See Also:


Attachments

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