JDK-8317222 : Implementation for javax.lang.model for Unnamed Variables & Patterns
  • Type: CSR
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 22
  • Submitted: 2023-09-28
  • Updated: 2023-10-19
  • Resolved: 2023-10-19
Related Reports
CSR :  
Description
Summary
-------

JEP 456: Unnamed Variables & Patterns finalizes unnamed variables in Java. javax.lang.model is updated accordingly.

Problem
-------

JEP 456 finalizes JEP 443 which was a preview feature to repurpose the underscore token (`_`) to denote unnamed variables in Java in various locations. 

JEP 443 modified the method javax.lang.model.element.VariableElement::getSimpleName() to return empty name in the case of unnamed variables, making it consistent with unnamed packages, unnamed modules and anonymous classes.

Also added a new predicate method javax.lang.model.element.VariableElement::isUnnamed(). The default implementation of this method examines whether getSimpleName() returns an empty name.

Solution
--------

We propose to finalize the changes in javax.lang.model that JEP 443 introduced, namely to update the version of javax.lang.model.element.VariableElement::isUnnamed().

Specification
-------------

The proposed API enhancements will be attached as `8317222.specdiff.zip`. These include the changes in javax/lang/model.



Comments
Moving to Approved. I looked over the javax.lang.model changes done for with feature in JDK and agree no further updates are necessarily on top of what is proposed in this CSR.
19-10-2023

Moving to Provisional.
28-09-2023