Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8358604

Trees for `var` do not have end positions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • 25
    • tools
    • None

      When trees for inferred local variable types are synthesized, the nodes are given a start position but not an end position: https://github.com/archiecobbs/jdk/blob/151d9882befe4424aa0b5856a3d17855b5c6ae41/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java#L5717

      The end positions can be retrieved using com.sun.source.util.SourcePositions#getEndPosition (e.g. by javac plugins), and end positions are available for explicitly typed local variables, so it would be helpful if these synthetic types also recorded an end position for consistency.

      See also discussion in https://github.com/openjdk/jdk/pull/23683

            acobbs Archie Cobbs
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: