update java parser language level

This commit is contained in:
Martin Lippert
2020-11-16 13:09:00 +01:00
parent 7391c3e49c
commit ad7a2a2e39
3 changed files with 8 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2018 Pivotal, Inc.
* Copyright (c) 2017, 2020 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -74,9 +74,9 @@ public class BootJavaReferencesHandler implements ReferencesHandler {
}
private List<? extends Location> provideReferences(TextDocument document, int offset) throws Exception {
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.JLS14);
Map<String, String> options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_10, options);
JavaCore.setComplianceOptions(JavaCore.VERSION_14, options);
parser.setCompilerOptions(options);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setStatementsRecovery(true);

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2019 Pivotal, Inc.
* Copyright (c) 2017, 2020 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -273,7 +273,7 @@ public final class CompilationUnitCache implements DocumentContentProvider {
private static CompilationUnit parse2(char[] source, String docURI, String unitName, List<Classpath> classpaths, INameEnvironmentWithProgress environment) throws Exception {
Map<String, String> options = JavaCore.getOptions();
String apiLevel = JavaCore.VERSION_11;
String apiLevel = JavaCore.VERSION_14;
JavaCore.setComplianceOptions(apiLevel, options);
if (environment == null) {
environment = CUResolver.createLookupEnvironment(classpaths.toArray(new Classpath[classpaths.size()]));
@@ -300,7 +300,7 @@ public final class CompilationUnitCache implements DocumentContentProvider {
}
private static List<Classpath> createClasspath(String[] classpathEntries) {
ASTParser parser = ASTParser.newParser(AST.JLS11);
ASTParser parser = ASTParser.newParser(AST.JLS14);
String[] sourceEntries = new String[] {};
parser.setEnvironment(classpathEntries, sourceEntries, null, false);
return CUResolver.getClasspath(parser);

View File

@@ -506,9 +506,9 @@ public class SpringIndexerJava implements SpringIndexer {
String[] classpathEntries = getClasspathEntries(project);
String[] sourceEntries = getSourceEntries(project);
ASTParser parser = ASTParser.newParser(AST.JLS11);
ASTParser parser = ASTParser.newParser(AST.JLS14);
Map<String, String> options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_11, options);
JavaCore.setComplianceOptions(JavaCore.VERSION_14, options);
parser.setCompilerOptions(options);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setStatementsRecovery(true);