Class JavacTokens.CommentWithTextAndPosition

  • Enclosing class:
    JavacTokens

    static class JavacTokens.CommentWithTextAndPosition
    extends java.lang.Object
    A Tokens.Comment that saves its text and start position.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int endPos  
      private int pos  
      private java.lang.String text  
    • Constructor Summary

      Constructors 
      Constructor Description
      CommentWithTextAndPosition​(int pos, int endPos, java.lang.String text)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getSourcePos​(int index)
      Returns the source position of the character at index index in the comment text.
      java.lang.String getText()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • pos

        private final int pos
      • endPos

        private final int endPos
      • text

        private final java.lang.String text
    • Constructor Detail

      • CommentWithTextAndPosition

        public CommentWithTextAndPosition​(int pos,
                                          int endPos,
                                          java.lang.String text)
    • Method Detail

      • getSourcePos

        public int getSourcePos​(int index)
        Returns the source position of the character at index index in the comment text.

        The handling of javadoc comments in javac has more logic to skip over leading whitespace and '*' characters when indexing into doc comments, but we don't need any of that.

      • getText

        public java.lang.String getText()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object