Community
Participate
Working Groups
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)
This is a bug in the shortReadableName() method.
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.
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?
Fixed and released in 2.1 stream.
Verified.