Class JavaParser


  • public final class JavaParser
    extends Object
    Helper methods to parse java source files.
    • Method Detail

      • parse

        public static DetailAST parse​(FileContents contents)
                               throws CheckstyleException
        Static helper method to parses a Java source file.
        Parameters:
        contents - contains the contents of the file
        Returns:
        the root of the AST
        Throws:
        CheckstyleException - if the contents is not a valid Java source
      • appendHiddenCommentNodes

        public static DetailAST appendHiddenCommentNodes​(DetailAST root)
        Appends comment nodes to existing AST. It traverses each node in AST, looks for hidden comment tokens and appends found comment tokens as nodes in AST.
        Parameters:
        root - of AST
        Returns:
        root of AST with comment nodes