Skip to content

Visual Studio Code complains if <release>8</release> #50

@Logics4

Description

@Logics4

I use Visual Studio Code (version 1.50.1 as I write this) with the Language Support for Java(TM) extension by RedHat (version 0.69.0 as I write this) to pretty much write all my Java code.

I have it like this in my pom.xml file:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <release>8</release>
            <source>11</source>
            <target>11</target>
            <compilerArgs>
                <arg>-Xplugin:jabel</arg>
            </compilerArgs>
        </configuration>
    </plugin>
</plugins>

Just like how it says to do on this project's README. However, the Java support extension read the <release>8</release> tag and sets the language level of the project to JavaSE-1.8, so VS Code complains if I use syntax from Java 9+:

image

My project compiles correctly through the command prompt, though.
VS Code won't give me an error if I set the <release> tag to 11, as it will set the language level to JavaSE-11, or if I omit it from the pom.xml, as it will default to the JDK I use to run the Java support extension (11 is the minimum):

image

... but then I imagine the compiler won't actually make the final jar a Java 8 app, right?
Is there a way to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions