Bug 290698 - [inline] inline method refactoring can produce visibility errors for private member accesses
Summary: [inline] inline method refactoring can produce visibility errors for private ...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 434745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-09-28 09:17 EDT by Johannes Gebauer CLA
Modified: 2023-06-25 13:15 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Gebauer CLA 2009-09-28 09:17:53 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Build Identifier: I20090611-1540

If the Method to be inlined accesses private features of the declaring class and is invoked in another class, the inlined code causes visibility errors.

Reproducible: Always

Steps to Reproduce:
1.
Create the following classes:
public class ReferencingType {

	DeclaringType d = new DeclaringType();
	
	public void n() {
		d.m();
	}
}

public class DeclaringType {
	
	private String privateField;
	
	public void m(){
		System.out.println(privateField);
		privateMethod();
	}
	
	private void privateMethod(){
		
	}
}


2.
Perform an inline method refactoring on DeclaringType.m() and inline all invocations.

3.
The resulting code for the ReferencingType class:

public class ReferencingType {
	
	DeclaringType d = new DeclaringType();
	
	public void n() {
		System.out.println(d.privateField);
		d.privateMethod();
	}
}

The following statements contain private field/method accesses that didn't produce an error in the RefactoringStatus but produce compile errors after the transformation.

System.out.println(d.privateField);
d.privateMethod();
Comment 1 Martin Mathew CLA 2014-05-14 23:05:58 EDT
*** Bug 434745 has been marked as a duplicate of this bug. ***
Comment 2 Eclipse Genie CLA 2019-03-17 10:24:17 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Dani Megert CLA 2019-03-22 12:44:42 EDT
Still broken in 4.11.
Comment 4 Eclipse Genie CLA 2021-07-03 09:29:57 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Eclipse Genie CLA 2023-06-25 13:15:45 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.