Skip to content

Java 25 feature migration recipes #839

@timtebeek

Description

@timtebeek

What problem are you trying to solve?

Upgrade to Java 25, picking up features since Java 21. Each of these can be picked up as a separate sub issue.
https://jdk.java.net/25/release-notes

  • New Method Process.waitFor(Duration) (JDK-8336479)
    A new, overloaded method, java.lang.Process#waitFor(Duration), has been added. The existing waitFor() method with timeout needs both a primitive time out value and its unit. The new method uses java.time.Duration so that the user will not be confused with the unit.

  • java.util.zip.ZipError Is Deprecated for Removal (JDK-8336843)
    java.util.zip.ZipError has been deprecated for removal. This error class has been obsolete for many releases and has not been used by the reference implementation since Java 8.
    Any existing code that used to throw java.util.zip.ZipError should consider throwing java.util.zip.ZipException instead. Code needing to catch this error when running on releases prior to Java 9 may be updated to catch the parent java.lang.InternalError class instead.

  • Rewrite non-used variables to _ #720

  • java.util.zip.Inflater and java.util.zip.Deflater Enhanced To Implement AutoCloseable (JDK-8225763)
    core-libs/java.util.jar
    java.util.zip.Inflater and java.util.zip.Deflater now implement AutoCloseable and can be used with the try-with-resources statement. Applications could previously invoke the end() method to release the resources held by the Inflater/Deflater instance. Now, either the end() or the close() method can be invoked to do the same.

  • New Reader.of(CharSequence) Method (JDK-8341566)
    The static factory method java.io.Reader.of(CharSequence) has been added to get a Reader that reads characters from a CharSequence, String and StringBuilder are examples of a CharSequence. The returned Reader is more efficient than using a java.io.StringReader in some cases, as the latter requires conversion to String and synchronization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions