Community
Participate
Working Groups
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).
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?
fixed