Martin Ahrer

Thinking outside the box

0001-01-01 1 min read

Before Java 25, constructor bodies were restricted - all statements had to appear after the explicit constructor invocation (super() or this()).

Constructor Before Java25
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/lang/FlexibleConstructorBodies.java[tag=constructorBeforeJava25]
Constructor With Java25
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/lang/FlexibleConstructorBodies.java[tag=constructorWithJava25]

Java 25 allows statements that don’t reference the instance being created to appear before the explicit constructor invocation, providing more flexibility.

Continue reading

0001-01-01 1 min read

Java 25 also allows instance main methods within classes, eliminating the need for static methods and making object-oriented concepts more natural for beginners.

Static Main Before Java25
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/lang/InstanceMainMethods.java[tag=staticMainBeforeJava25]
Instance Main Method
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/lang/InstanceMainMethods.java[tag=instanceMainMethod]
Continue reading

0001-01-01 1 min read
Module Import With Java25
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfive/lang/ModuleImportDeclarations.java[tag=moduleImportWithJava25]

Java 25 introduces module import declarations that allow importing all exported packages from a module with a single statement using the import module syntax.

0001-01-01 2 min read

The following describes selected improvements of the Java language. See the Java 25 release notes. See Java Language Updates for Java SE 25.

Java 25 is introducing the following finalized language enhancements.

  • JEP 511 is finalizing Module Import Declarations. Enhance the Java programming language with the ability to succinctly import all of the packages exported by a module. This simplifies the reuse of modular libraries, but does not require the importing code to be in a module itself.

  • JEP 512 is finalizing Compact Source Files and Instance Main Methods. Enhance the Java programming language so that students can write their first programs without needing to understand language features designed for large programs.

  • JEP 513 is finalizing Flexible Constructor Bodies. In constructors in the Java programming language, allow statements that do not reference the instance being created to appear before an explicit constructor invocation.

Continue reading

0001-01-01 1 min read

The following describes selected improvements of the Java platform and tooling. See the Java 25 release notes.

Java 25 is introducing the following platform and tooling enhancements.

  • JEP 503 is Remove the 32-bit x86 Port. Remove the 32-bit x86 port (linux-x86) from the JDK, continuing the modernization of supported platforms.

  • JEP 514 is introducing Ahead-of-Time Command-Line Ergonomics. Improve the usability of ahead-of-time compilation by enhancing command-line tools and their ergonomics for better developer experience.

  • JEP 515 is introducing Ahead-of-Time Method Profiling. Enable method-level profiling information to be collected and used during ahead-of-time compilation to improve application startup and performance.

Continue reading

0001-01-01 1 min read

Before Java 24, working with Java class files required third-party libraries like ASM or BCEL. The new Class-File API provides a standard way to parse, generate, and transform Java class files.

Parse Class File
Unresolved directive in <stdin> - include::../../../../../../../../src/main/java/twentyfour/api/ClassFileApi.java[tag=parseClassFile]
Generate Class File
Continue reading

0001-01-01 2 min read

The following describes selected improvements of the Java API. See the Java 24 release notes.

Java 24 is introducing the following finalized API enhancements.

  • JEP 484 is finalizing the Class-File API. Provide a standard API for parsing, generating, and transforming Java class files. This API will replace the need for third-party libraries like ASM.

  • JEP 485 is finalizing Stream Gatherers. Enhance the Stream API to support custom intermediate operations. This will allow stream pipelines to transform data in ways that are not easily achievable with the existing built-in intermediate operations.

  • JEP 496 is introducing Quantum-Resistant Module-Lattice-Based Key Encapsulation Mechanism. Provide implementations of KEM based on the Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) standard specified in FIPS 203.

  • JEP 497 is introducing Quantum-Resistant Module-Lattice-Based Digital Signature Algorithm. Provide implementations of the Module-Lattice-Based Digital Signature Algorithm (ML-DSA) standard specified in FIPS 204.

Continue reading
Older posts Newer posts