Get Internal Comments By Using Eclipse JDT ASTParser

You may try to use Eclipse JDT ASTParser to parse Java source files, but cannot get the list of internal comments in the .java file. There is a method called getCommentList from the CompilationUnit class. But if you use it, you find that it returns a list of empty comments. How to get internal comments … Read more

Eclipse JDT tutorial: Parse a Java method by using ASTParser

This tutorial belongs to Eclipse JDT Tutorial Series. ASTParser can use its setKind() method to set source to be parsed as a compilation unit, single expression, a sequence of statements, or a sequence of class body declarations. parser.setKind(ASTParser.K_COMPILATION_UNIT);parser.setKind(ASTParser.K_COMPILATION_UNIT); Any of those four can not handle a single independent method. This is not pleasant. Following the … Read more