JDK-8268850 : Detect inferred local variable types in AST
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 10,11,17,18
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-06-15
  • Updated: 2021-07-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
The implementation of local variable type inference adds the inferred type to the AST: http://hg.openjdk.java.net/jdk10/master/rev/48ec75306997#l8.23

As discussed in JDK-8024098, it would be nice for the AST to more closely model the source code, including whether a particular local variable's type was explicit in source or inferred from a use of var; ideally pretty-printing a variable declaration would preserve whether or not the source used var.