Bug 322596

Summary: [DOM] ASTNode APIs should specify types of property descriptors
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: trivial    
Priority: P3 CC: amj87.iitr
Version: 3.7   
Target Milestone: 3.7 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description Markus Keller CLA 2010-08-12 18:12:04 EDT
HEAD

In the ASTNode APIs, all fields and static accessors of type StructuralPropertyDescriptor (or a subtype thereof) should specify the type of elements the property holds. This information is already stored in the implementation, but is always a pain that it's not readily available in the API documentation.

Example:
- MethodDeclaration#typeParameters() specifies:
    (element type: <code>TypeParameter</code>)
  => better:
    (element type: {@link TypeParameter})

- MethodDeclaration#TYPE_PARAMETERS_PROPERTY specifies:
    The "typeParameters" structural property of this node type
  => should say:
    The "typeParameters" structural property of this node type
    (element type: {@link TypeParameter})

Likewise, accessors for inherited properties should be documented, e.g.:
- BodyDeclaration#getJavadocProperty() and MethodDeclaration#JAVADOC_PROPERTY
  => should say:
    (child type: {@link Javadoc})

Note: This bug becomes obsolete when the DOM APIs are generified (which would also be a very welcome solution).
Comment 1 Olivier Thomann CLA 2010-09-02 14:43:09 EDT
Created attachment 178084 [details]
Proposed fix
Comment 2 Olivier Thomann CLA 2010-09-02 14:43:35 EDT
Released for 3.7M2.
Verification has to be done by code inspection.
Comment 3 Markus Keller CLA 2010-09-03 09:08:09 EDT
Looks mostly good, but I disagree with the description of properties with a primitive type. The Javadoc should not use the boxed type. The setters and getters that use property descriptors deal with the boxing/unboxing.

E.g. BooleanLiteral#BOOLEAN_VALUE_PROPERTY says "(type: {@link Boolean})", but the SimplePropertyDescriptor is created with "boolean.class" and thus SimplePropertyDescriptor#getValueType() also returns "boolean.class" and not "Boolean.class".

Regex to narrow down the places that need adjustments: \b[a-z]+\.class\b
Comment 4 Olivier Thomann CLA 2010-09-03 09:13:54 EDT
So you suggest:
(type: {@link boolean.class})
?
Comment 5 Markus Keller CLA 2010-09-03 09:31:18 EDT
> (type: {@link boolean.class})

Unfortunately, Javadoc can't create @link links to primitive types, so it would be (type: <code>boolean</code>).

But thinking about it again, we should probably leave it as you did it. When SimplePropertyDescriptor gets generified, the type argument for boolean properties will also be Boolean and not boolean. Marking as fixed again.
Comment 6 Ayushman Jain CLA 2010-09-15 03:26:01 EDT
Verified for 3.7M2 using code inspection.