Bug 374627 - Let "Generate Delegate Methods..." generate code for all visibilities
Summary: Let "Generate Delegate Methods..." generate code for all visibilities
Status: CLOSED DUPLICATE of bug 144259
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-19 05:31 EDT by Lukas Eder CLA
Modified: 2012-03-21 08:12 EDT (History)
2 users (show)

See Also:


Attachments
Eclipse project to reproduce the issue (2.88 KB, application/zip)
2012-03-19 05:33 EDT, Lukas Eder CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Eder CLA 2012-03-19 05:31:44 EDT
Build Identifier: Version: Indigo Release Build id: 20110615-0604

It seems that the feature "Generate Delegate Methods..." from the Java tooling only allows for generating delegates for public methods. In some class hierarchies, it would also be useful to generate methods with a lower visibility (i.e. protected and default). I'm guessing that generating private delegate methods doesn't make sense, though

Reproducible: Always

Steps to Reproduce:
1. Use the attached Eclipse project
2. Go to the "Wrapper" class
3. Right-click, choose "Source" > "Generate Delegate Methods..."
4. Only publicMethod() is offered, not protectedMethod(), defaultMethod()
Comment 1 Lukas Eder CLA 2012-03-19 05:33:06 EDT
Created attachment 212843 [details]
Eclipse project to reproduce the issue
Comment 2 Lukas Eder CLA 2012-03-19 05:36:18 EDT
For convenience, here's the code from the attached Eclipse project:
-----------------------------

public class Abstract {

  public void publicMethod() {
  }
  
  protected void protectedMethod() {
  }
  
  void defaultMethod() {
  }

  private void privateMethod() {
  }
}

public class Wrapper extends Abstract {
  private Abstract delegate;
  
  public Wrapper(Abstract delegate) {
    this.delegate = delegate;
  }
  
  // Right-click here, choose "Source" > "Generate Delegate Methods..."
  // Among all applicable methods in Abstract, only publicMethod() is 
  // offered, even if protectedMethod() and defaultMethod() would also
  // be applicable
}
Comment 3 Dani Megert CLA 2012-03-21 08:12:42 EDT

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