Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 209317 - Encapsulate Field Doesn't Check for Invalid Overloading
Summary: Encapsulate Field Doesn't Check for Invalid Overloading
Status: RESOLVED DUPLICATE of bug 194996
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-09 05:04 EST by Max Schaefer CLA
Modified: 2007-11-12 12:24 EST (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 Max Schaefer CLA 2007-11-09 05:04:50 EST
Build ID: M20070212-1330

Steps To Reproduce:
Take the following program:

  class A {
    public int i;
  }

  class B extends A {
    private int getI() { return 42; }
  }

Using "Encapsulate Field" on A.i generates (without warning) a public getter method A.getI(), which triggers a compiler error, since B.getI() is private and cannot override it. Related problems occur if, for example, the return type of B.getI() is something other than "int".

More information:
This is similar to bug 209316.
Comment 1 Martin Aeschlimann CLA 2007-11-12 12:24:37 EST

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