Bug 559939 - [postfix] Incorrect local variable insert with posfix completions
Summary: [postfix] Incorrect local variable insert with posfix completions
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.15   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-08 04:16 EST by Gayan Perera CLA
Modified: 2024-01-24 06:38 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gayan Perera CLA 2020-02-08 04:16:58 EST
When editing the statement as below to extract a location variable

((IAdaptable) object).getAdapter(IJavaStackFrame.class).var

it ends up as

((IAdaptable) object).getAdapter(Object name = IJavaStackFrame.class);


The expected result should be

IJavaStackFrame frame = ((IAdaptable) object).getAdapter(IJavaStackFrame.class)
Comment 1 Gayan Perera CLA 2020-02-08 04:21:49 EST
My code block

	public Object[] findSourceElements(Object object) throws CoreException {
		Object[] result = super.findSourceElements(object);
		if (result.length == 0) {
			if(object instanceof IAdaptable) {
				IJavaStackFrame frame = ((IAdaptable) object).getAdapter(IJavaStackFrame.class);
				JavaDebugUtils.resolveDeclaringType(frame);

			}

			JavaDebugUtils.resolveDeclaringType(object)
		}
		return result;
	}


Seems like this happens when there is a error in the code only. But the syntax errors should not effect the postfix completions i guess.
Comment 2 Gayan Perera CLA 2020-02-11 14:29:39 EST
Another example

		((URLClassLoader)Application.class.getClassLoader()).var
expands to 
		((URLClassLoader)ClassLoader name = Application.class.getClassLoader());
Comment 3 Gayan Perera CLA 2020-02-11 14:30:29 EST
I think the original plugin didn't had these problems as i remember.
Comment 4 Eclipse Genie CLA 2022-02-01 14:53:16 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 5 Gayan Perera CLA 2022-02-02 14:50:52 EST
I will retest with latest releases.
Comment 6 Eclipse Genie CLA 2024-01-24 06:38:09 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.