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

Bug 254756

Summary: [content assist] for method invocation in variable initializer should not guess variable
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: David Audel <david_audel>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2008-11-10 11:26:33 EST
I20081104-0916, same in 3.4

Enable content assist preference to insert best guessed arguments. Have:

import java.text.MessageFormat;
public class Try {
	public static void main(String[] args) {
		String fooBar= "Hi";
		String furchtbar= MessageFormat.format|
	}
}

At location of |, invoke content assist. Result:
		String furchtbar= MessageFormat.format(furchtbar, args)

The variable 'furchtbar' should not be guessed, since it is out of scope. Same problem inside field initializers.
Comment 1 Dani Megert CLA 2008-11-11 05:36:58 EST
org.eclipse.jdt.core.CompletionContext.getVisibleElements(String) should not return them.
Comment 2 David Audel CLA 2009-06-29 11:22:35 EDT

*** This bug has been marked as a duplicate of bug 236306 ***