Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 385101

Summary: [override method] Wrong visibility on implemented methods from annotated interface
Product: [Eclipse Project] JDT Reporter: Lukas Eder <lukas.eder>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 CC: deepakazad, manju656
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382690
Whiteboard:

Description Lukas Eder CLA 2012-07-14 06:54:06 EDT
Build Identifier: Version: 4.2.0 Release Build id: I20120608-1400

Generated code from the Override/Implement Method feature has a wrong visibility, if the implemented method is declared in an interface and annotated

Reproducible: Always

Steps to Reproduce:
Given the following code:

------------------------------
package test;

public @interface Annotation {
}
------------------------------
package test;

public interface Interface {
	@Annotation
	void foo();
}
------------------------------
package test;

public class Implementation implements Interface {
// 1. Right-click to open context menu here
// 2. Choose Source
// 3. Choose Override/Implement Methods
// 4. Click OK
// 5. Generated method has package visibility instead of public visibility
}
------------------------------

Follow the instructions in the Implementation class to get this:

------------------------------
package test;

public class Implementation implements Interface {

	@Override
	void foo() {
		// TODO Auto-generated method stub
		
	}
// Right-click to open context menu here
// Choose Source
// Choose Override/Implement Methods
// Click OK
// Generated method has package visibility instead of public visibility
}
------------------------------

Note, this may be related to:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382690
Comment 1 Martin Mathew CLA 2013-06-27 01:39:15 EDT
Fixed by bug 387940

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