We're starting development on a new project and are targeting the upcoming Java 11 release. However, although our stub project compiles just fine in Maven, VS Code isn't able to provide intellisense, reports incorrect syntax errors, and fails to launch the project.
When the maven-compiler-plugin's source and target attributes are set from 11 down to 10, however, all the issues go away.
I suspect that whatever is interpreting the Java source/target version doesn't know to look for 11, sees a value it doesn't recognize, and then falls back to targeting the default source/target version (1.5?).
Below, I've attached my Maven POM and the stub class file that won't compile.
java version "11" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
Version: 1.26.1
Commit: 493869ee8e8a846b0855873886fc79d480d342de
Date: 2018-08-16T18:38:57.434Z
Electron: 2.0.5
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.shawmanz32na</groupId>
<artifactId>java-11-support-spike</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
src/main/java/com/github/shawmanz32na/java11supportspike/App.java
package com.github.shawmanz32na.java11supportspike;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public final class App {
public static void main(String[] args) {
System.out.println(Stream.of("Hello", "World!").collect(Collectors.joining(" ")));
}
}
Java 11 is not supported at the moment. It requires updates in the upstream Eclipse JDT project for vscode-java to support it. Hopefully we should be able to get a release synchronized with JDK 11 GA (but not guaranteed)
丕賱鬲丨爻賷賳
Latest CI build, compatible with Java 11, is available in http://download.jboss.org/jbosstools/jdt.ls/staging/?C=M;O=D.
Official release sometime on Monday
Most helpful comment
Java 11 is not supported at the moment. It requires updates in the upstream Eclipse JDT project for vscode-java to support it. Hopefully we should be able to get a release synchronized with JDK 11 GA (but not guaranteed)