Bug 463477 - [inline] Inline local variable adds extra parenthesis with ArrayCreation having initializer
Summary: [inline] Inline local variable adds extra parenthesis with ArrayCreation havi...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-30 11:12 EDT by Noopur Gupta CLA
Modified: 2023-04-11 17:57 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Noopur Gupta CLA 2015-03-30 11:12:53 EDT
Example:

class T {
	static final int[][] f1 = new int[][] {{0}};
	{
		f1[0][0] = 0;
		
		int[][] m1 = new int[][] {{0}};
		m1[0][0] = 0;		
	}
}

Inlining "m1" adds extra parentheses and results in:
(new int[][] {{0}})[0][0] = 0;

Inlining the constant "f1" doesn't add extra parentheses.

This is because InlineTempRefactoring#getInitializerSource invokes NecessaryParenthesesChecker#needsParentheses with a copy node which checks for the node's initializer value, and that is null for the copied node.
Comment 1 Eclipse Genie CLA 2019-04-01 14:06:23 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 2 Dani Megert CLA 2019-04-02 10:01:17 EDT
Still an issue in 4.11.
Comment 3 Eclipse Genie CLA 2021-03-24 09:08:59 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 4 Eclipse Genie CLA 2023-04-11 17:57:21 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.