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

DocSourcePositions: add new getPosition method

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 17
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None

      Description

      com.sun.source.util.DocSourcePositions provides methods to determine the start and end positions of any DocTree node, but it does not provide any way to determine the file position of positions within the tree node. This is especially difficult for TextTree nodes, which may span many lines and so be discontinuous in the underlying file.

      We should add a new method along the lines of:

      long getPosition(CompilationUnitTree file, DocCommentTree comment, DocTree tree, int pos);

      While the signature should probably use `DocTree tree`, it may only make sense to define the method for "leaf" nodes, like TextTree, IdentifierTree, etc.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jjg Jonathan Gibbons
              Reporter:
              jjg Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: