question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax error with Java 14 records

See original GitHub issue

I 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
  1. git clone https://github.com/pascalpoizat/previews
  2. cd previews
  3. open . -a Visual\ Studio\ Code
  4. 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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
snjezacommented, May 28, 2020

@pascalpoizat have you run ‘./gradlew eclipseJdt’?

jdk14

1reaction
fbriconcommented, May 28, 2020

Instructions to enable Preview features are available in the wiki: https://github.com/redhat-developer/vscode-java/wiki/Enabling-Java-preview-features#gradle-projects

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found