Skip to content

Don't emit "Implicitly Declared Classes and Instance Main Methods is a preview feature and disabled by default." in Compact Source Files + OpenJDK 25 #4126

Closed

Description

@tats-u
  1. Do either of:
    • Download OpenJDK 25 from https://jdk.java.net/25/, extract it, and place it at some place
    • Install Eclipse Temurin 25 or something similar
  2. Create a .java file:
    void main() {
        IO.println("Hello, world!");
    }
  3. Set java.jdt.ls.java.home to the extracted directory if the path to java is not set
  4. Open the .java file
  • Expected: no errors in favor of JEP 512 (stable)
  • Actual: Implicitly Declared Classes and Instance Main Methods is a preview feature and disabled by default. Use --enable-preview to enableJava(4195407)

Activity

  1. physcrowley commented on Sep 10, 2025

    @physcrowley

    ^ Yes. Classes have started and this needs to be addressed for any of the "implicitly declared classes and instance main methods" JEPs (512 most recently, and the only non-preview one) to be useful for beginners.

    It doesn't make sense for us to have to jump through configuration hoops to have access to the JEP, or to have to ignore the Play button and instead run programs through the terminal. Students will naïvely follow whatever proposed corrections are presented and end up with Standard Java at best, a lot of random, broken code at worst.

  2. physcrowley commented on Sep 10, 2025

    @physcrowley

    ^ Yes. Classes have started and this needs to be addressed for any of the "implicitly declared classes and instance main methods" JEPs (512 most recently, and the only non-preview one) to be useful for beginners.

    It doesn't make sense for us to have to jump through configuration hoops to have access to the JEP, or to have to ignore the Play button and instead run programs through the terminal. Students will naïvely follow whatever proposed corrections are presented and end up with Standard Java at best, a lot of random, broken code at worst.

    Well... Java 25 isn't General Availability until the September 16th (10 days from this post). How long after that will it be for JavaSE-25 to be available in VS Code, or is the new version added essentially on the GA date?

  3. physcrowley commented on Sep 10, 2025

    @physcrowley
    1. Download OpenJDK 25 EA from https://jdk.java.net/25/, extract it, and place it at some place
    2. Create a .java file:
      void main() {
      IO.println("Hello, world!");
      }
    3. Set java.jdt.ls.java.home to the extracted directory
    4. Open the .java file
    • Expected: no errors in favor of JEP 512 (stable)
    • Actual: Implicitly Declared Classes and Instance Main Methods is a preview feature and disabled by default. Use --enable-preview to enableJava(4195407)

    The list of configurable runtimes does not include JavaSE-25 yet. So even if with a more recent JDK, both jdt (default compiler) and javac (experimental compiler via jdt.ls.javac.enable --> on) are limited to JavaSE-24.

  4. changed the title [-]Don't emit "Implicitly Declared Classes and Instance Main Methods is a preview feature and disabled by default." in OpenJDK 25 EA[/-] [+]Don't emit "Implicitly Declared Classes and Instance Main Methods is a preview feature and disabled by default." in Compact Source Files + OpenJDK 25[/+] on Sep 26, 2025
  5. rgrunber commented on Sep 26, 2025

    @rgrunber
    Member

    The behaviour here was expected prior to the release of Java 25. It was only released in September, as you've noted. See eclipse-jdtls/eclipse.jdt.ls#3536 (comment) . This should behave as expected.

    Closing for now, but let me know if there are still issues.

    This hasn't been released yet. That's expected early October, but the vscode-java pre-releases contain the support.

  6. added
    javaPull requests that update java code
    on Sep 26, 2025
  7. tats-u commented on Sep 27, 2025

    @tats-u
    Author

    Confirmed that it does work in the latest pre-release version.

    Image
  8. physcrowley commented on Sep 27, 2025

    @physcrowley

    Same here. I had all students switch versions yesterday and we are good to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    javaPull requests that update java code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions