Bug 210273 - Content Assist cannot cope with explicit parameter types
Summary: Content Assist cannot cope with explicit parameter types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-19 12:07 EST by Johannes Rieken CLA
Modified: 2007-12-11 09:06 EST (History)
3 users (show)

See Also:


Attachments
Proposed fix (4.09 KB, patch)
2007-11-21 07:48 EST, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Rieken CLA 2007-11-19 12:07:11 EST
Build ID: 3.3

Steps To Reproduce:
1. have the following CU

public class CU {
	
	void foo() {
		Map<String, Number> map= new HashMap<String, Number>();
		map.put("float", 1.23F);
		map.put("long", 123L);
			
		printFloat(this.<Float>bar(<CARET>));
	}
	
	void printFloat(float n) {
		// ...
	}
	
	<T extends Number> T bar(String name, Map<String, Number> map) {
		Number number= map.get(name);
		if(number == null)
			return null;
		return (T) number;
	}
}

2. CTRL+SPACE at <CARET>
 > you dont get any proposals
   [with "this.<Float>bar("float", <CARET>)" it's no better]


More information:
Comment 1 David Audel CLA 2007-11-20 07:02:21 EST
Reproduce with this smaller test case:

public class CU {
	void foo() {
		this.<Object>bar();
	}
}

An ArrayIndexOutOfBoundsException occurs in completion parser recovery

java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.checkInvocation(CompletionParser.java:1388)
	at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.completionIdentifierCheck(CompletionParser.java:1825)
	at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.updateRecoveryState(CompletionParser.java:4413)
	at org.eclipse.jdt.internal.compiler.parser.Parser.resumeOnSyntaxError(Parser.java:10274)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9109)
	at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:1358)
	at org.eclipse.jdt.internal.codeassist.impl.AssistParser.parseBlockStatements(AssistParser.java:1211)
	at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:288)
	at org.eclipse.jdt.internal.codeassist.impl.Engine.parseBlockStatements(Engine.java:251)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2351)
	at ...
Comment 2 David Audel CLA 2007-11-21 07:48:48 EST
Created attachment 83426 [details]
Proposed fix
Comment 3 David Audel CLA 2007-11-21 09:37:51 EST
Released for 3.4M4

Test added
  GenericsCompletionParserTesr#test0215_Diet() -> test0215_Method()
Comment 4 Eric Jodet CLA 2007-12-11 09:06:10 EST
Verified for 3.4 M4 using build I20071210-1800