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

Bug 336201

Summary: [inline] refactoring produces different result depending on whether declaration is inlined or the invocation
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, kenneth
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Deepak Azad CLA 2011-02-03 04:33:27 EST
3.7 M5

---------------------------------------------------
package argument_in;

public class TestArray {

	public int bar(int a[]) {   //2
		return a[0];
	}
	
	public void main() {
		int i= bar(new int[] {1});  //1
	}
}
---------------------------------------------------
1. Inline the method invocation 'bar'
=> int i= (new int[] {1})[0];  => Good.

2. Inline the method declaration 'bar'
=> int i= ((int[]) new int[] {1})[0]; => Bad
There is an unnecessary cast, plus the result is different in both cases.
Comment 1 Eclipse Genie CLA 2019-02-21 11:37:45 EST
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 2 Dani Megert CLA 2019-02-22 05:01:22 EST Comment hidden (obsolete)
Comment 3 Kenneth Styrberg CLA 2019-05-02 15:57:37 EDT
Tested with 2019-06_M1+ and could not reproduce
Comment 4 Dani Megert CLA 2019-05-03 04:54:38 EDT
(In reply to Kenneth Styrberg from comment #3)
> Tested with 2019-06_M1+ and could not reproduce
Indeed. Not sure what I did.