History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-18154
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Dmitry Jemerov
Reporter: Alexander Chernikov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Refactor / Inline class: methods with parameters of inlined class are processed incorrectly

Created: 20 Jun 07 14:57   Updated: 16 Oct 07 00:07
Component/s: Refactoring
Fix Version/s: Diana Final

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 7,025


 Description  « Hide
Provide class which has a method with parameter of the same class. Provide usages of parameter. Like:
public class SelfParams {
	private int myVar = 0;

	private int myProp = 0;
	public int getProp() {
		return myProp;
	}
	public void setProp(int prop) {
		myProp = prop;
	}

	public void copy(SelfParams sp) {
		this.myVar = sp.myVar;
		this.myProp = sp.getProp();
	}
}

Provide class using this one:

public class Client {
	public void meth() {
		SelfParams sp1 = new SelfParams();
	}
}

Inline SelfParams. Result:

public class Client {
	public void meth() {
		Object sp1 = new Object() {
			private int myVar = 0;
			private int myProp = 0;

			public int getProp() {
				return myProp;
			}

			public void setProp(int prop) {
				myProp = prop;
			}

			public void copy(Object sp) {
				this.myVar = sp.myVar;
				this.myProp = sp.getProp();
			}
		};
	}
}

Error: references to myVar and getProp() are not resolved.



 All   Comments   Work Log   Change History      Sort Order:
Alexander Chernikov - 20 Jun 07 15:05
Notice also the case with constructor like:
public OurClass(OurClass oc) {
    // similar copy-like initialization
}

The issue is that usages of non-default constructor are replaced with initializations generated in anonymous body (IDEADEV-17886). In the case like above generated initializations are also incorrect.