Syntax error with Java 14 records
See original GitHub issueI get a syntax error when using Java 14 records, while all is OK when I build & run the project in the CLI using gradle.
Environment
- Operating System: macOS Mojave 10.14.6
- JDK version: 14.0.1 2020-04-14
- Visual Studio Code version: 1.45.1
- Java extension version: Java extension pack 0.9.1, language support for Java 0.62.0
Steps To Reproduce
- git clone https://github.com/pascalpoizat/previews
- cd previews
- open . -a Visual\ Studio\ Code
- open file src/main/java/App.java or src/main/java/Person.java
Sample project is at: https://github.com/pascalpoizat/previews
Screenshots of the error(s), together with logs can be found at : https://github.com/pascalpoizat/previews/tree/master/ERROR
Current Result
Syntax error on the record
keyword.
Syntax error on token "record", record expectedJava(1610612940)
Expected Result
No error, the project builds.
Additional Informations
- my settings.json file is also in https://github.com/pascalpoizat/previews/tree/master/ERROR.
- there
java.home
points to JDK 14 - my build.gradle file includes arguments relative to Java 14 new features, see https://github.com/pascalpoizat/previews/blob/master/build.gradle
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Java 14 Syntax error on token "record", record expected
I'm engaged in building something in Java 14. I wrote a class named for PersonInJava14 shown below. package recordexample; public record ...
Read more >Java 14 Syntax error on token "record", record expected
... von Esthi und Robert https://stackoverflow.com/questions/61019063/ java - 14 - syntax - error -on-token- record - record -expectedWelcome to E...
Read more >Java 14 Syntax Error On Token "Record", Record ... - ADocLib
A syntax error means you violated the language requirements and wrote a program in something Java-like but isn't Java. The Java compiler is...
Read more >[SOLVED] Syntax error on token - CodeRanch
The exact error is: Syntax error on token "foo", Identifier expected after this token . I'm pretty new to Java still - but...
Read more >Java 14 Record Keyword - Baeldung
As with regular Java classes, we can also include static variables and methods in our records. We declare static variables using the same...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pascalpoizat have you run ‘./gradlew eclipseJdt’?
Instructions to enable Preview features are available in the wiki: https://github.com/redhat-developer/vscode-java/wiki/Enabling-Java-preview-features#gradle-projects