logic: extend language support to Java 12 (issue #752) (#844)

* update java indexer dependencies
* update java language support to java 12
* enable java preview features by default
* add test for Java 12 support
This commit is contained in:
Malte Langkabel
2019-12-16 15:54:00 +01:00
committed by Eberhard Graether
parent d7e16d30e0
commit 8a7ba18b8a
132 changed files with 259 additions and 590 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+28 -28
View File
@@ -48,100 +48,100 @@
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.commands</artifactId>
<version>3.9.200</version>
<version>3.9.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.commands-3.9.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.commands-3.9.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.contenttype</artifactId>
<version>3.7.200</version>
<version>3.7.400</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.contenttype-3.7.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.contenttype-3.7.400.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.expressions</artifactId>
<version>3.6.200</version>
<version>3.6.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.expressions-3.6.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.expressions-3.6.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.filesystem</artifactId>
<version>1.7.200</version>
<version>1.7.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.filesystem-1.7.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.filesystem-1.7.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.jobs</artifactId>
<version>3.10.200</version>
<version>3.10.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.jobs-3.10.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.jobs-3.10.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.resources</artifactId>
<version>3.13.200</version>
<version>3.13.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.resources-3.13.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.resources-3.13.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.runtime</artifactId>
<version>3.15.100</version>
<version>3.16.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.core.runtime-3.15.100.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.core.runtime-3.16.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.app</artifactId>
<version>1.4.0</version>
<version>1.4.300</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.equinox.app-1.4.0.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.equinox.app-1.4.300.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>3.10.200</version>
<version>3.10.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.equinox.common-3.10.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.equinox.common-3.10.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.preferences</artifactId>
<version>3.7.200</version>
<version>3.7.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.equinox.preferences-3.7.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.equinox.preferences-3.7.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.registry</artifactId>
<version>3.8.200</version>
<version>3.8.500</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.equinox.registry-3.8.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.equinox.registry-3.8.500.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.13.102</version>
<version>3.19.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.jdt.core-3.13.102.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.jdt.core-3.19.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.13.200</version>
<version>3.15.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.osgi-3.13.200.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.osgi-3.15.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>org.eclipse.text</artifactId>
<version>3.8.0</version>
<version>3.9.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/org.eclipse.text-3.8.0.jar</systemPath>
<systemPath>${basedir}/lib/org.eclipse.text-3.9.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
@@ -41,19 +41,23 @@ public class JavaIndexer
Path path = Paths.get(filePath);
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.JLS12);
parser.setResolveBindings(true); // solve "bindings" like the declatarion of the type used in a var decl
parser.setResolveBindings(true); // solve "bindings" like the declaration of the type used in a var decl
parser.setKind(ASTParser.K_COMPILATION_UNIT); // specify to parse the entire compilation unit
parser.setBindingsRecovery(true); // also return bindings that are not resolved completely
parser.setStatementsRecovery(true);
{
Hashtable<String, String> options = JavaCore.getOptions();
String convertedLanguageStandard = convertLanguageStandard(languageStandard);
astVisitorClient.logInfo("using language standard " + convertedLanguageStandard);
JavaCore.setComplianceOptions(convertedLanguageStandard, options);
Hashtable<String, String> options = JavaCore.getOptions();
options.put(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
options.put(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
options.put(JavaCore.COMPILER_SOURCE, convertedLanguageStandard);
options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, convertedLanguageStandard);
options.put(JavaCore.COMPILER_COMPLIANCE, convertedLanguageStandard);
parser.setCompilerOptions(options);
}
@@ -136,7 +140,7 @@ public class JavaIndexer
{
String packageName = "";
ASTParser parser = ASTParser.newParser(AST.JLS10);
ASTParser parser = ASTParser.newParser(AST.JLS12);
parser.setKind(ASTParser.K_COMPILATION_UNIT); // specify to parse the entire compilation unit
parser.setSource(fileContent.toCharArray());
CompilationUnit cu = (CompilationUnit) parser.createAST(null);
@@ -176,8 +180,12 @@ public class JavaIndexer
case "9":
return JavaCore.VERSION_9;
case "10":
default:
return JavaCore.VERSION_10;
case "11":
return JavaCore.VERSION_11;
case "12":
default:
return JavaCore.VERSION_12;
}
}