update parser code to accept java 11 langauge level code

This commit is contained in:
Martin Lippert
2018-12-28 09:04:25 +01:00
parent 09380b75ed
commit f26d4c6d9d
2 changed files with 3 additions and 3 deletions

View File

@@ -165,7 +165,7 @@ public final class CompilationUnitCache implements DocumentContentProvider {
}
public static CompilationUnit parse(char[] source, String docURI, String unitName, String[] classpathEntries) throws Exception {
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.JLS11);
Map<String, String> options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_10, options);
parser.setCompilerOptions(options);

View File

@@ -322,7 +322,7 @@ public class SpringIndexer {
private void scanProject(IJavaProject project, String[] files) {
try {
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.JLS11);
String[] classpathEntries = getClasspathEntries(project);
scanFiles(project, parser, files, classpathEntries);
@@ -333,7 +333,7 @@ public class SpringIndexer {
}
private void scanFile(IJavaProject project, String docURI, String content, String[] classpathEntries) throws Exception {
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.JLS11);
Map<String, String> options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_10, options);
parser.setCompilerOptions(options);