Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339806 - ChainCompletionContext: expected type is null on array types
Summary: ChainCompletionContext: expected type is null on array types
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Marcel Bruch CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-12 16:40 EST by Andreas Kaluza CLA
Modified: 2019-07-24 14:36 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kaluza CLA 2011-03-12 16:40:23 EST
The computation of the expected type in the ChainCompletionContext will lead to null if the chain completion is triggered on an array type. A test case is the method2 in the CompletionOnArrayMemberAccessInMethod class (*.tests.fixtures.rcp.codecompletion.chain).

Problem: Look at the toJdtType method in the JavaElementResolver class. The output is null, which should not happen. In the mentioned test case the input is [Ljava/util/concurrent/atomic/AtomicInteger. This input could not be found in the cache (IType jdtType = (IType) cache.get(recType); --> null).
Comment 1 Marcel Bruch CLA 2011-03-14 05:08:07 EDT
I investigated this issue. Unfortunately JDT does not allow you to specify ITypes that have an array dimension, e.g., there is no IType MyType[] in JDT. 

I may return either the array base type (MyType) or the type "Array". the latter seems reasonable but not perfect. I would prefer to return null or even throw an exception if someone puts an array type in here.

Looking at Marko's JDT implementation shows how he dealt with this issue (see class TypeWithArrayDepth).

How can I support you further?
Comment 2 Andreas Kaluza CLA 2011-03-14 06:14:12 EDT
fixed