vscode-java: List.of seem broken while using jdk 17

i am using vscode with redhat extension and azul sdk 17 Screenshot 2022-11-22 at 12 52 16

    <properties>
        <java.version>17</java.version>
        <application.name>${project.artifactId}</application.name>
    </properties>
The method of() is undefined for the type List
The method of(String[]) is undefined for the type List

maven runs file, wheras vscode tells me

List.of

is not defined as well as

var

is reported as object (but that could be related to the first issue…

running commands from command line on mvn or from mvn extension all works fine, in the extension both test extension and intellisense/error reporting are wrong (seems they fetch an older java version??)

cheers

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

@jkone27 Could you try to add

<build>
	<pluginManagement>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.10.1</version>
				<configuration>
					<source>17</source>
					<target>17</target>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>
</build>

to your project’s pom.xml.