Hi to all,
I want to parse java code with jdt from commandline and so I wrote a small tool, which parses the java files in the following kind:
ASTParser parser = ASTParser.newParser(AST.JLS8);
parser.setEnvironment(classpath, srcPaths, encodings, false);
parser.setSource(//String of file read before);
parser.setResolveBindings(true);
parser.setBindingsRecovery(true);
parser.setUnitName(name of File);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
With this code I get an OOM with 2GB after reading 1300 java files, but I can resolve e.g. MethodInvocations. If i skip the
parser.setBindinsRecovery(true)
the tool finishes, but the whole bindings are not resolved.
My small and perhaps easy question: How can I implement this with less memory consumption and better performance AND getting all things resolved? I guess jdt implementaion in eclipse itself needs maximum some MBs to read the AST.
Thanks for your help
Markus