JDK15: java 15 Features - What's New in java 15 (2020) | TechGeekNext >>








Java 15 - What's new features in Java15

Java 15, the next new version of Java is being now underway as Java 14 is out. We'll keep you posted during its development and all of the Java 15 news.

Java 15 release date
Java 15 is expected to come out in September 2020.

JDK 15 has now been officially confirmed, listed below features/enhancements as part of the open jdk 15.

  1. JEP 339: Edwards-Curve Digital Signature Algorithm (EdDSA)
  2. JEP 360: Sealed Classes (Preview)
  3. JEP 371: Hidden Classes
  4. JEP 372: Remove the Nashorn JavaScript Engine
  5. JEP 374: Disable and Deprecate Biased Locking
  6. JEP 375: Pattern Matching for instanceof (Second Preview)
  7. JEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production)
  8. JEP 378: Text Blocks (Standard)
  9. JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector (Production)
  10. JEP 381: Remove the Solaris and SPARC Ports
  11. JEP 383: Foreign-Memory Access API (Second Incubator):
  12. JEP 384: Records (Second Preview):
  13. JEP 385: Deprecate RMI Activation for Removal:
  • JEP 339: Edwards-Curve Digital Signature Algorithm (EdDSA):

    It introduces cryptographic signatures using the Edwards-Curve Digital Signature Algorithm (EdDSA) as defined in RFC 8032.

    EdDSA is a modern elliptical curve signing method with numerous advantages in comparison to the existing JDK signature schemes. The SunEC provider will add new Signature, KeyFactory and KeyPairGenerator services to support EdDSA. New classes and interfaces to represent EdDSA keys will be added to the API, and new standard algorithm names to represent EdDSA signature schemes will be included. The API will use the NamedParameterSpec class developed for XDH to describe the parameters of the curve domain and the variants of EdDSA.


    Example: Create a key pair and sign
    KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("Ed25519");
    KeyPair keyPair = keyPairGen.generateKeyPair();
    // use Ed25519 algorithm
    signaturenature signature = signaturenature.getInstance("Ed25519");
    signature.initsignaturen(keyPair.getPrivate());
    signature.update(msg);
    byte[] s = signature.signaturen();
    Create a public key using KeyFactory
    KeyFactory keyFactory = KeyFactory.getInstance("EdDSA");
    boolean param1 = ...
    BigInteger param2 = ...
    NamedParameterSpec paramsSpec = new NamedParameterSpec("Ed25519");
    EdECPublicKeySpec publicSpec = new EdECPublicKeySpec(paramsSpec, new EdPoint(param1, param2));
    PublicKey publicKey = keyFactory.generatePublic(publicSpec);
  • JEP 360: Sealed Classes (Preview):

    Sealed classes and interfaces restrict/limit, which other classes or interfaces may extend or implement them. It enhance the Java programming language with sealed classes and interfaces.

    A class can be sealed by using the sealed modifier - permits to its declaration. After which any extends and implements clauses, the permits clause specifies the classes that are permitted/allowed to extend the sealed class.

    Example: Below example shows how Animal class specifies three permitted subclasses:
    package com.techgeeknext.example.species;
    
    public sealed class Animal
        permits Dog, Monkey, Leopard {...}
    Note: The classes specified by permits must be located close to the superclass, either in the same module or in the same package.
    package com.techgeeknext.example.species;
    
    public sealed class Animal
    	com.techgeeknext.example.species.canis.Dog,
    	com.techgeeknext.example.species.macaca.Monkey,
    	com.techgeeknext.example.species.rana.Leopard
    	{....}
  • JEP 371: Hidden Classes:

    Hidden classes are classes which can not be used directly by the bytecode of other classes. Hidden classes are intended to be used by frameworks that generates classes at runtime and use them indirectly through reflection. A hidden class can be defined as a member of the access control nest and can be unloaded independently of other classes.

    Deprecate the non-standard API sun.misc.Unsafe::defineAnonymousClass, with the intent to deprecate it for removal in a future release.

  • JEP 372: Remove the Nashorn JavaScript Engine:

    Removes the Nashorn JavaScript script engine, the APIs and the jjs tool as mentioned below as it was already deprecated in java 11.

    1. jdk.scripting.nashorn : It contains the jdk.nashorn.api.scripting and jdk.nashorn.api.tree packages.
    2. jdk.scripting.nashorn.shell : It contains the jjs tool.

  • JEP 374: Disable and Deprecate Biased Locking:

    Biased locking is always enabled and available before Java 15. Biased locking will no longer be enabled with this JEP, when HotSpot is started unless -XX:+UseBiasedLocking is set on the command line.

    JEP will deprecate the UseBiasedLocking option and all options related to the configuration and use of biased locking. Options will still be accepted and acted upon, but a warning of deprecation will be issued.

    1. Product options: BiasedLockingStartupDelay, BiasedLockingBulkRebiasThreshold, BiasedLockingBulkRevokeThreshold, BiasedLockingDecayTime and UseOptoBiasInlining
    2. Diagnostic options: PrintBiasedLockingStatistics and PrintPreciseBiasedLockingStatistics

  • JEP 375: Pattern Matching for instanceof (Second Preview):

    Instanceof is used to check whether the object reference is and instance of given Type or not, and return boolean flag. It improves the programming language for Java with pattern matching for the operator instanceOf. Pattern matching allows for the more clear and efficient expression of common logic in a system, namely the conditional removal of components from objects.

    Pattern matching, instanceof was suggested by JEP 305 in mid-2017, targeting in JDK 14 at the end of 2019 as a preview feature.

    This JEP suggested to re-preview the feature in JDK 15, without any changes to the preview in JDK 14, in order to collect additional feedback.


    Before- Without this feature
    if (obj instanceof String) {
        String str = (String) obj; // need to declare and cast again the object
        .. str.contains(..) ..
    }else{
         str = ....
    }
    

    With this feature enhancements
    if (!(obj instanceof String str)) {
        .. str.contains(..) .. // no need to declare str object again with casting
    } else {
        .. str....
    }
  • For more examples visit JDK 14 - instanceof (Preview)

  • JEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production)

    JDK 11 has introduced Z Garbage Collector as experimental feature. With Java 15, it seems the time may have come for ZGC to become a production feature.

    In addition to the existing enhancements, it also improves important features as given below:

    1. Concurrent class unloading
    2. Uncommitting unused memory (JEP 351)
    3. Maximum heap size increased from 4TB to 16TB
    4. Minimum heap size decreased to 8MB
    5. -XX:SoftMaxHeapSize
    6. Support for the JFR leak profiler
    7. Support for class-data sharing
    8. Limited and discontiguous address spaces
    9. Support for placing the heap on NVRAM
    10. Improved NUMA awareness
    11. Multi-threaded heap pre-touching
  • JEP 378: Text Blocks(Standard):

    In mid-2019, JDK 13 introduced Text Block as Preview feature, which then re-visited by adding two new escape sequences in Java 14 as Second Preview.
    JDK 14 feedback indicates that the Text Blocks feature is now ready to become permanent and final as a Standard feature in Java 15.

    In Java, to embed HTML, XML, SQL, or JSON snippet into a code is often hard to read and hard to keep, and to overcome this problem, Java 14 has introduced Text Block.

    A text block is a multi-line string literals which prevents the need for most escape sequences, formats the string automatically, and allows the developer and gives control to format the string if necessary.

    HTML Example With Text Block
    String html = """
                  <html>
                      <body>
                          <p>Hello, world</p>
                      </body>
                  </html>
                  """;
  • JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector (Production):

    Shenandoah was introduced into JDK 12 - JEP 189 as Experimental Feature. Shenandoah is now become ready as a production feature in Java 15.

    Shenandoah reduces GC pause times by doing evacuation work at the same time as running Java threads. Shenandoah pause times are independent of the Heap Size, which means you will have the same consistent pause times whether your heap is 200 MB or 200 GB.

  • JEP 381: Remove the Solaris and SPARC Ports:

    It remove all source code related to Solaris operating system, SPARC architecture. These were deprecated in JDK 14 with the express intention of removing them in the future version.

    Many currently developing projects and features, such as Valhalla, Loom and Panama, need significant CPU architecture and OS code changes. Removing support for Solaris and SPARC ports will enhance the development of new features that move the platform forward with help from contributors of the OpenJDK community.

Take a look at our suggested post on Java :


Quick glance on earlier Java Versions Features :


Java 14 Features - JDK 14


Java 14 is now available!
Java 14 (Java SE 14) and its Java Development Kit 14 (JDK 14) open-source has been released on 17 March 2020, the most common coding language and application platform in the world.

A significant number of Java Enhancement Proposals (JEPs) have been released in version 14. (Even more JEPs than Java 12 and 13 combined)

JAVA 14 addresses a total of 16 main enhancements/changes (JEPs) ranging from the Java language support to the latest APIs for ongoing JDK flight recorder monitoring. The entire feature list consists of:

  1. Pattern Matching for instanceof
  2. Non-Volatile Mapped Byte Buffers
  3. Helpful NullPointerExceptions
  4. Switch Expressions (Standard)
  5. Packaging Tool (Incubator)
  6. NUMA-Aware Memory Allocation for G1
  7. JFR Event Streaming
  8. Records (Preview)
  9. Deprecate the Solaris and SPARC Ports
  10. Remove the Concurrent Mark Sweep (CMS) Garbage Collector
  11. ZGC on macOS
  12. ZGC on Windows
  13. Deprecate the ParallelScavenge + SerialOld GC Combination
  14. Remove the Pack200 Tools and API
  15. Text Blocks (Second Preview)
  16. Foreign-Memory Access API

Java 13 Features - JDK 13


Java 12 Features

  • Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
  • Microbenchmark Suite
  • Switch Expressions (Preview)
  • JVM Constants API
  • One AArch64 Port, Not Two
  • Default CDS Archives
  • Abortable Mixed Collections
  • Promptly Return Unused Committed Memory from G1

Java 11 Features


Java 10 Features

  • Local-variable type inference
  • Experimental Java-based JIT compiler.This is the integration of the Graal dynamic compiler for the Linux x64 platform
  • Application class-data sharing. This allows application classes to be placed in the shared archive to reduce startup and footprint for Java applications
  • Time-based release versioning
  • Parallel full GC
  • Garbage-collector interface
  • Additional Unicode language-tag extensions
  • Root certificates
  • Thread-local handshakes
  • Heap allocation on alternative memory devices
  • Remove the native-header generation tool - javah
  • Consolidate the JDK forest into a single repository

Java 9 Features

  • Modularization of the JDK under Project Jigsaw (Java Platform Module System)
  • jshell: The Java Shell (a Java REPL)
  • Ahead-of-time compilation
  • XML catalogs
  • More concurrency updates. It includes a Java implementation of Reactive Streams, including a new Flow class that included the interfaces previously provided by Reactive Streams
  • Variable handles: define a standard means to invoke the equivalents of various java.util.concurrent.atomic and sun.misc.Unsafe operations
  • jlink: The Java Linker: create a tool that can assemble and optimize a set of modules and their dependencies into a custom run-time image. It effectively allows to produce a fully usable executable including the JVM to run it
  • JavaDB was removed from JDK
  • HiDPI graphics: automatic scaling and sizing

Java 8 Features

  • Language-level support for lambda expressions and default methods (virtual extension methods) which allow the addition of methods to interfaces without breaking existing implementations.
  • Project Nashorn, a JavaScript runtime which allows developers to embed JavaScript code within applications
  • Annotation on Java types
  • Unsigned integer arithmetic
  • Repeating annotations
  • Date and time API
  • Statically-linked JNI libraries
  • Launch JavaFX applications (direct launching of JavaFX application JARs)
  • Remove the permanent generation

Java 7 Features

  • JVM support for dynamic languages
  • Compressed 64-bit pointers
  • Strings in switch
  • Automatic resource management in try-statement
  • Improved type inference for generic instance creation, aka the diamond operator <>
  • Simplified varargs method declaration
  • Binary integer literals
  • Allowing underscores in numeric literals
  • Catching multiple exception types and rethrowing exceptions with improved type checking
  • Concurrency utilities
  • New file I/O library adding support for multiple file systems
  • Timsort is used to sort collections and arrays of objects instead of merge sort
  • Library-level support for elliptic curve cryptography algorithms
  • An XRender pipeline for Java 2D, which improves handling of features specific to modern GPUs
  • New platform APIs for the graphics features
  • Enhanced library-level support for new network protocols, including SCTP and Sockets Direct Protocol
  • Upstream updates to XML and Unicode
  • Java deployment rule sets

Java 6 Features

  • Support for older Win9x versions dropped
  • Scripting Language Support
  • Dramatic performance improvements for the core platform, and Swing.
  • Improved Web Service support through JAX-WS.
  • JDBC 4.0 support.
  • Java Compiler API
  • Upgrade of JAXB to version 2.0
  • Support for pluggable annotations
  • Many GUI improvements, such as integration of SwingWorker in the API, table sorting and filtering, and true Swing double-buffering (eliminating the gray-area effect).
  • JVM improvements include: synchronization and compiler performance optimizations, new algorithms and upgrades to existing garbage collection algorithms, and application start-up performance.
  • Java 6 can be installed to Mac OS X 10.5 (Leopard) running on 64-bit (Core 2 Duo and higher) processor machines.[54] Java 6 is also supported by both 32-bit and 64-bit machines running Mac OS X 10.6

Java 5 Features

  • Generic
  • Metadata
  • Autoboxing/unboxing
  • Enumerations
  • Varargs
  • Enhanced for each loop
  • Improved
  • Static imports
  • Improvements - Semantics of execution for multi-threaded Java programs
  • Improvements - Automatic stub generation for RMI objects
  • Improvements - Swing: New skinnable look and feel, called synth
  • Improvements - The concurrency utilities in package java.util.concurrent
  • Improvements - Scanner class for parsing data from various input streams and buffers


















































































































Recommendation for Top Popular Post :