Bug 211881 - [assist] Code assist fails inside an if statement
Summary: [assist] Code assist fails inside an if statement
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 M5   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 213031 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-04 09:49 EST by David Audel CLA
Modified: 2008-02-05 04:30 EST (History)
1 user (show)

See Also:


Attachments
Proposed fix (5.72 KB, patch)
2008-01-04 07:27 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 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.