Bug 161557 - [assist] JavaTypeCompletionProposalComputer throws a runtime exception when using content assist on generics type argument with instance member arrays
Summary: [assist] JavaTypeCompletionProposalComputer throws a runtime exception when u...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 critical (vote)
Target Milestone: 3.2.2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 177916 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-10-19 08:46 EDT by R. Lemos CLA
Modified: 2007-03-19 05:28 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (3.29 KB, patch)
2006-10-19 12:15 EDT, David Audel CLA
no flags Details | Diff
Proposed fix for 3.2.2 (3.11 KB, patch)
2006-11-17 06:09 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 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. ***