Bug 24747 - incorrect compile error message
Summary: incorrect compile error message
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-14 09:50 EDT by Adam Kiezun CLA
Modified: 2002-11-13 06:19 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2002-10-14 09:50:54 EDT
class A {
    NonExistent[] f(){}
}

the message says '[] cannot be resolved (or is not a valid return type) for the 
method f'

(the type name is not mentioned)
Comment 1 Olivier Thomann CLA 2002-10-15 14:16:41 EDT
This is a bug in the shortReadableName() method.
Comment 2 Olivier Thomann CLA 2002-10-15 14:50:29 EDT
Proposal:
1) remove shortReadableName() on
org.eclipse.jdt.internal.compiler.lookup.TypeBinding
2) Add:
public char[] shortReadableName(){
	char[] brackets = new char[dimensions * 2];
	for (int i = dimensions * 2 - 1; i >= 0; i -= 2) {
		brackets[i] = ']';
		brackets[i - 1] = '[';
	}
	return CharOperation.concat(leafComponentType.shortReadableName(), brackets);
}
on org.eclipse.jdt.internal.compiler.lookup.ArrayBinding
3) Add:
public char[] shortReadableName(){
	return simpleName;
}
on org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding.
Comment 3 Olivier Thomann CLA 2002-10-15 14:55:43 EDT
The bug was simply that the method on TypeBinding was incorrectly calling
sourceName() and therefore the problemReferenceBinding method was never called.
It called sourceName() for the problemReferenceBinding instead which returns null.
Philippe - Could you please verify the proposal?
Comment 4 Olivier Thomann CLA 2002-10-17 16:41:48 EDT
Fixed and released in 2.1 stream.
Comment 5 David Audel CLA 2002-11-13 06:19:29 EST
Verified.