Bug 188097 - [inline] Cannot inline a constructor invocation that is used as a class instance creation
Summary: [inline] Cannot inline a constructor invocation that is used as a class insta...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-21 10:22 EDT by Benno Baumgartner CLA
Modified: 2007-05-25 07:12 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benno Baumgartner CLA 2007-05-21 10:22:41 EDT
Given:
package test;
public class E01 {
	public static E01 create() {
		return new E01(10);
	}
	public E01(int j) {
		this(j, 10);
	}
	public E01(int j, int i) {}
}
1. Select first constructor decl 'E01'
2. Refactor>Inline...
3. OK
Is:
 Error Status: 'Cannot inline a constructor invocation that is used as a class instance creation'

a) Why?
b) Are constructor invocations that are not used as a class instance creation possible in java?

Should:
package test;
public class E01 {
	public static E01 create() {
		return new E01(10, 10);
	}
	public E01(int j, int i) {}
}
Comment 1 Markus Keller CLA 2007-05-25 07:12:19 EDT
> b) Are constructor invocations that are not used as a class instance creation
> possible in java?

Yes, you can e.g. inline 'this(j, 10);'