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