Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340386

Summary: CompilerBindings - method "toTypeName": wrong computation on primitives
Product: z_Archived Reporter: Andreas Kaluza <andreas>
Component: RecommendersAssignee: Marcel Bruch <marcel.bruch>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Andreas Kaluza CLA 2011-03-17 21:02:35 EDT
The primitive type "int" leads to the output "Lint" --> should be "I" IMHO
The primitive array type "int[]" --> should be "[I" IMHO
Comment 1 Andreas Kaluza CLA 2011-03-17 21:07:07 EDT
Problem is in the class IntelligentCompletionContext: the method getExpectedType() returns "Lint" on the primitive "int". If I like to test isPrimitive on the return, the result is false.
Comment 2 Marcel Bruch CLA 2011-03-18 05:24:43 EDT
Added:

if (binding.isArrayType()) {
            final int dimensions = binding.dimensions();
            final TypeBinding leafComponentType = binding.leafComponentType();
            return VmTypeName.get(StringUtils.repeat("[", dimensions) + toTypeName(leafComponentType));
        }
        String signature = String.valueOf(binding.computeUniqueKey());
        if (signature.length() == 1) {
            return VmTypeName.get(signature);
        }
...

However, this string parsing stuff is somewhat error prone and happens in several different places. we need to get rid of this somehow and put it into one single place... I'll keep an eye on this
Comment 3 Marcel Bruch CLA 2012-02-02 01:41:44 EST
Closing this issue. Please give latest dev build (v0.5) a try:

http://download.eclipse.org/recommenders/updates/dev/e37/
http://download.eclipse.org/recommenders/updates/dev/e42/
Comment 4 Marcel Bruch CLA 2012-02-02 01:41:57 EST
Closing this issue. Please give latest dev build (v0.5) a try:

http://download.eclipse.org/recommenders/updates/dev/e37/
http://download.eclipse.org/recommenders/updates/dev/e42/