Bug 322596 - [DOM] ASTNode APIs should specify types of property descriptors
Summary: [DOM] ASTNode APIs should specify types of property descriptors
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-12 18:12 EDT by Markus Keller CLA
Modified: 2010-09-15 03:26 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (161.52 KB, patch)
2010-09-02 14:43 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.