Community
Participate
Working Groups
I20050202 (jdt-core from I20050207) CompletionProposal.getDeclarationSignature states that it may return null for some proposal types. However, from the description I assumed that it was guaranteed not to return null *if* the proposal was of kind METHOD_REF. For methods on array objects, the declaration is always null, however. It would make sense to return "Ljava.lang.Object;" since this is where all the methods are declared that an array has. For FIELD_REF proposals to the "length" field of an array, it would probably make sense to return the array type, although this is not as important for us as there is no javadoc associated with the field.
For an array object the only proposals without 'declaration signature' are the FIELD_REF 'length' and the METHOD_REF 'clone' and they are not defined inside Object. I can return: null (as now) or Ljava.lang.Object; (Object is not really the declaring type) or [Ljava.lang.Object; or [RealTypeSignature (RealTypeSignature could be a base type)
sorry for not replying earlier... > For an array object the only proposals without 'declaration signature' are the > FIELD_REF 'length' and the METHOD_REF 'clone' and they are not defined inside > Object. > > I can return: > null (as now) -1 as comment 0 says, I believe this is unexpected. > or Ljava.lang.Object; (Object is not really the declaring type) -1 as this would be simply not true. > or [Ljava.lang.Object; ok - albeit this could be interpreted to imply that the declaring type is an Object[] > or [RealTypeSignature (RealTypeSignature could be a base type) I like this one best, because this is the correct answer to the question "which types declares the field 'length'?"
Fixed and tests added CompletionTests#testArrayLength() CompletionTests#testArrayClone()
Verified in I20050510-0010 + JDT/Core v_556