RFR: 8302344: Compiler Implementation for Unnamed patterns and variables [v2]
Joe Darcy
darcy at openjdk.org
Wed Apr 26 17:52:53 UTC 2023
On Wed, 26 Apr 2023 15:28:24 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>>
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>
> Introduce new flag to track unnamed variables
>
> - Return underscore for Tree API and empty name for javax.lang.model.element.VariableElement.getSimpleName()
src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 716:
> 714: * @since 21
> 715: */
> 716: default boolean hasEmptyName(Element element) {
Updating some suggestions from an off-list discussion, ModuleElement and PackageElement both have an isUnnamed predicate. VariableElement could get an isUnnamed predicate (as a default method returning false and an implSpec tag requiring that) or Elements.isUnnamed(VariableElement) could be added similarly.
Presumably, at least any newly-defined methods should get marked as some category of preview method.
Also, please file a issue against core-libs/javax.lang.model for javax.lang.model support for this JEP; having a separate issue makes doing the JSR 269 maintenance release work easier.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1178201512
More information about the kulla-dev
mailing list