JDK 15 RFR of JDK-8239092: Provide explicit specification for getKinds methods of javax.lang.model

Joe Darcy joe.darcy at oracle.com
Fri Feb 14 20:33:35 UTC 2020


Hi Jon,

Thanks for the fixes; I'll push a corrected form of the change.

In terms of how to best add the spec for getKind, in this case, I 
thought concentrating the change at the getKind method on the root 
interface offered the best discoverability / bloat ratio. A different 
approach is taken for Element. getEnclosedElements where the definition 
in the Element is augmented by type-specific overrides to state the 
explicit behavior. The semantics of getEnclosedElements is less 
"obvious" than getKind so I think the expanded treatment is warranted in 
this case but not getKind.

Thanks,

-Joe

On 2/14/2020 10:44 AM, Jonathan Gibbons wrote:
> Joe,
>
> I fixed a few grammatical and typographic errors in the CSR for you.
>
> I guess I had considered (as an alternative) adding a sentence to the 
> class-level comment for each subtype, or maybe using a <table> to 
> describe the mapping, but the narrative list is OK too, and at least 
> makes it easier to describe the "non-standard" entries in the mapping.
>
> CSR reviewed.
>
> -- Jon
>
>
> On 02/14/2020 09:41 AM, Joe Darcy wrote:
>> Hello,
>>
>> As discussed in the review of Pavel's JDK-8238598, the getKind 
>> methods in javax.lang.model don't give an explicit type-to-kind 
>> mapping. Please review the webrev and CSR to add such a mapping:
>>
>>     JDK-8239092: Provide explicit specification for getKinds methods 
>> of javax.lang.model
>>     http://cr.openjdk.java.net/~darcy/8239092.0/
>>     https://bugs.openjdk.java.net/browse/JDK-8239093
>>
>> The text as rendered is below.
>>
>> Thanks,
>>
>> -Joe
>>
>> ElementKind getKind()
>> Returns the kind of this element.
>>
>>     The kind of a package is PACKAGE.
>>     The kind of a module is MODULE.
>>     The kind of a type element is one of ANNOTATION, CLASS, ENUM, 
>> INTERFACE, or RECORD.
>>     The kind of a variable is one of ENUM_CONSTANT, 
>> EXCEPTION_PARAMETER, FIELD, LOCAL_VARIABLE, PARAMETER, 
>> RESOURCE_VARIABLE, or BINDING_VARIABLE.
>>     The kind of an executable is one of CONSTRUCTOR, INSTANCE_INIT, 
>> METHOD, or STATIC_INIT.
>>     The kind of a type parameter is TYPE_PARAMETER.
>>     The kind of a record component is RECORD_COMPONENT.
>>
>> ModuleElement.DirectiveKind getKind()
>> Returns the kind of this directive.
>>
>>     The kind of an requires directive is REQUIRES.
>>     The kind of an exports directive is EXPORTS.
>>     The kind of an opens directive is OPNES.
>>     The kind of an uses directive is USES.
>>     The kind of an provides directive is PROVIDES.
>>
>>
>> TypeKind getKind()
>> Returns the kind of this type.
>>
>>     The kind of a primitive type is one of the kinds for which 
>> TypeKind.isPrimitive() returns true.
>>     The kind of a null type is NULL.
>>     The kind of an array type is ARRAY.
>>     The kind of an declared type is DECLARED.
>>     The kind of an error type is ERROR.
>>     The kind of a type variable is TYPEVAR.
>>     The kind of a wildcard type is WILDCARD.
>>     The kind of an executable type is EXECUTABLE.
>>     The kind of an pseudo-type type is one of VOID, PACKAGE, MODULE, 
>> or NONE.
>>     The kind of an union typeis UNION.
>>     The kind of an intersection type is INTERSECTION.
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20200214/f0088b81/attachment-0001.htm>


More information about the compiler-dev mailing list