Bug 211881

Summary: [assist] Code assist fails inside an if statement
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: benno.baumgartner
Version: 3.3   
Target Milestone: 3.4 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description David Audel CLA 2007-12-04 09:49:07 EST
build  I20071127-0800

1) create X.java
public class X{
	void foo() {
		if ((superType).equals(null)) ;

		int superType = 0;
		superTyp| // ctrl+space at |
	}
}
2) do ctrl+space at | location
'superType' isn't not proposed.

An exception occurred and is caught by CompletionEngine:
java.lang.ArrayIndexOutOfBoundsException: -1
	at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.consumeToken(CompletionParser.java:3210)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9127)
	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)
Comment 1 David Audel CLA 2008-01-04 07:26:28 EST
*** Bug 213031 has been marked as a duplicate of this bug. ***
Comment 2 David Audel CLA 2008-01-04 07:27:49 EST
Created attachment 86183 [details]
Proposed fix
Comment 3 David Audel CLA 2008-01-04 07:30:26 EST
Released for 3.4M5

Tests added
  CompletionTests#testCompletionAfterIf1() -> testCompletionAfterIf2()
Comment 4 Frederic Fusier CLA 2008-02-05 04:30:20 EST
Verified for 3.4M5 using I20080204-0010 build.