Bug 161557

Summary: [assist] JavaTypeCompletionProposalComputer throws a runtime exception when using content assist on generics type argument with instance member arrays
Product: [Eclipse Project] JDT Reporter: R. Lemos <rslemos>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: philippe_mulet, schierlm
Version: 3.2   
Target Milestone: 3.2.2   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Proposed fix for 3.2.2 none

Description R. Lemos CLA 2006-10-19 08:46:13 EDT
Example:

class A {
  private Collection<I> a[];
                      ^
}

Using content assist to get proposals for Collection type argument will throw the following exception:

java.lang.NullPointerException
        at org.eclipse.jdt.internal.codeassist.CompletionEngine.isValidParent(CompletionEngine.java:6334)
        at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:733)
        at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1766)
        at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:123)
        at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:313)


Note that it works perfectly using the other array declaration syntax:

class A {
  private Collection<I>[] a;
                      ^
}

It also works, regardless of the syntax used, when the declaration is local to a method:

public void method() {
  Collection<I> a[];
              ^
  Collection<I>[] b;
              ^
}
Comment 1 R. Lemos CLA 2006-10-19 08:48:43 EDT
It may be somewhat related to bug #154993
Comment 2 Frederic Fusier CLA 2006-10-19 09:20:21 EDT
Not sure this is related to bug 154993 as stack trace is different.

What's your build ID (3.2 or 3.2.1)?
Comment 3 R. Lemos CLA 2006-10-19 09:31:42 EDT
Using Linux (Debian GNU/Linux x86) Platform:
Version: 3.2.0
Build id: M20060629-1905


Using Windows XP Platform:
Version: 3.2.1
Build id: M20060921-0945

(In reply to comment #2)
> Not sure this is related to bug 154993 as stack trace is different.
> 
> What's your build ID (3.2 or 3.2.1)?
> 

Comment 4 David Audel CLA 2006-10-19 12:15:26 EDT
Created attachment 52325 [details]
Proposed fix
Comment 5 David Audel CLA 2006-10-19 12:18:18 EDT
Released for 3.3 M3.

Test added
  CompletionTests_1_5#test0294().

This is not a duplicate of bug 154993.
Comment 6 Olivier Thomann CLA 2006-10-30 15:05:21 EST
Verified for 3.3 M3 using warm-up build I20061030-0800
Comment 7 David Audel CLA 2006-11-17 06:09:05 EST
Reopen to be backported to 3.2.2.
Comment 8 David Audel CLA 2006-11-17 06:09:57 EST
Created attachment 54060 [details]
Proposed fix for 3.2.2
Comment 9 Philipe Mulet CLA 2006-11-20 06:52:15 EST
+1 for 3.2.2
Comment 10 David Audel CLA 2006-11-20 07:02:16 EST
Released for 3.2.2.

Test added
  CompletionTests_1_5#test0294().
Comment 11 Frederic Fusier CLA 2007-01-16 05:19:10 EST
Verified for 3.2.2 using build M20060112-1200.
Comment 12 David Audel CLA 2007-03-19 05:28:00 EDT
*** Bug 177916 has been marked as a duplicate of this bug. ***