Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java source/target version 11 not recognized #625

Closed
shawmanz32na opened this issue Aug 31, 2018 · 3 comments
Closed

Java source/target version 11 not recognized #625

shawmanz32na opened this issue Aug 31, 2018 · 3 comments

Comments

@shawmanz32na
Copy link

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.

Environment
  • Operating System: Windows 10 Pro (10.0.17134 Build 17134)
  • JDK version:
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)
  • Visual Studio Code version:
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
  • Java extension version: 0.29.0
Steps To Reproduce
  1. Create a stub Maven project with the compiler source and target set to Java 11
  2. Use a lambda when printing "Hello World!" in the main method

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(" ")));
    }
}
Current Result
  • Intellisense reports errors on Java syntax from 1.8+
  • Debugging the application from VS Code fails to launch with compilation errors
Expected Result
  • Business as usual
Additional Informations
@fbricon
Copy link
Collaborator

fbricon commented Aug 31, 2018

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)

@ralshammrei2
Copy link

التحسين

@fbricon fbricon added this to the End September 2018 milestone Sep 28, 2018
@fbricon
Copy link
Collaborator

fbricon commented Sep 29, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants