Skip to content

Add support for running Java 21 "Unnamed classes and Instance main method" #1444

@fbricon

Description

@fbricon

vscode-java now provides support for Java 21 preview feature Unnamed classes and Instance main method, however, we're missing the Run/Debug codelens on the main() method

Environment
  • Operating System: MacOS 14.3 (23D56)
  • JDK version: 21.0.1 temurin
  • Visual Studio Code version: 1.86.2
  • Java extension version: 1.28.1
  • Java Debugger extension version: 0.56.2024020601 pre-release
Steps To Reproduce
  1. Set Java 21 as the default runtime
  2. Create a hello.java file
  3. Paste this code:
String greeting = "Hello, World!";

void main() {
    System.out.println(greeting);
}
Current Result

No Run/Debug codelenses
Screenshot 2024-02-21 at 10 49 05

Expected Result

Should be able to Run/Debug the class via codelenses either at the top of the file or over the main() method

Additional Informations

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions