GitHub
The Java Version Almanac
javaalmanac.io
Feedback on this page?

New APIs in Java 21

Comparing Java 21 (21.0.5+11-LTS-tem) with Java 20 (20.0.2+9-tem).

Element Modification
java.base
    java.io
      • + sealed
      java.lang.constant
        ConstantDescs
          ClassDesc
            MethodHandleDesc
              MethodTypeDesc
                • + abstract
                java.lang.foreign
                  Arena
                    isCloseableBy(Thread)
                    openConfined()
                    openShared()
                    scope()
                    GroupLayout
                      withBitAlignment(long)
                      Linker.Option.CaptureCallState
                      Linker.Option
                        captureCallState(String...)
                        Linker
                          • + abstract
                          upcallStub(MethodHandle, FunctionDescriptor,...
                          MemoryLayout.PathElement
                            MemoryLayout
                              bitAlignment()
                              bitOffset(MemoryLayout.PathElement...)
                              bitOffsetHandle(MemoryLayout.PathElement...)
                              bitSize()
                              • + abstract
                              valueLayout(Class, ByteOrder)
                              withBitAlignment(long)
                              MemorySegment
                                allocateNative(MemoryLayout, SegmentScope)
                                allocateNative(long, SegmentScope)
                                allocateNative(long, long, SegmentScope)
                                array()
                                • + abstract
                                get(ValueLayout.OfAddress, long)
                                getAtIndex(ValueLayout.OfAddress, long)
                                ofAddress(long, long)
                                ofAddress(long, long, SegmentScope)
                                ofAddress(long, long, SegmentScope, Runnable)
                                scope()
                                set(ValueLayout.OfAddress, long, MemorySegment)
                                setAtIndex(ValueLayout.OfAddress, long,...
                                PaddingLayout
                                  withBitAlignment(long)
                                  SegmentAllocator
                                    allocate(ValueLayout.OfAddress, MemorySegment)
                                    nativeAllocator(SegmentScope)
                                    SegmentScope
                                    SequenceLayout
                                      withBitAlignment(long)
                                      StructLayout
                                        withBitAlignment(long)
                                        SymbolLookup
                                          libraryLookup(Path, SegmentScope)
                                          libraryLookup(String, SegmentScope)
                                          UnionLayout
                                            withBitAlignment(long)
                                            VaList.Builder
                                            VaList
                                            ValueLayout.OfAddress
                                            ValueLayout.OfBoolean
                                              withBitAlignment(long)
                                              ValueLayout.OfByte
                                                withBitAlignment(long)
                                                ValueLayout.OfChar
                                                  withBitAlignment(long)
                                                  ValueLayout.OfDouble
                                                    withBitAlignment(long)
                                                    ValueLayout.OfFloat
                                                      withBitAlignment(long)
                                                      ValueLayout.OfInt
                                                        withBitAlignment(long)
                                                        ValueLayout.OfLong
                                                          withBitAlignment(long)
                                                          ValueLayout.OfShort
                                                            withBitAlignment(long)
                                                            ValueLayout
                                                              withBitAlignment(long)
                                                              java.lang.invoke
                                                                ClassSpecializer.Factory
                                                                ClassSpecializer.SpeciesData
                                                                StringConcatFactory
                                                                  VarHandle
                                                                    • - final
                                                                    java.lang.reflect
                                                                      ClassFileFormatVersion
                                                                        java.lang.runtime
                                                                          • - preview
                                                                          java.lang
                                                                            Character
                                                                              Class
                                                                                Compiler
                                                                                FdLibm.Cbrt
                                                                                FdLibm.Hypot
                                                                                FdLibm.Pow
                                                                                • - preview
                                                                                Math
                                                                                  StrictMath
                                                                                    • + implements Appendable
                                                                                    • + implements Appendable
                                                                                    String
                                                                                      ThreadGroup
                                                                                        allowThreadSuspension(boolean)
                                                                                        Thread
                                                                                          • - preview
                                                                                          • - preview
                                                                                          • - preview
                                                                                          • - preview
                                                                                          • - preview
                                                                                          allowSetThreadLocals(boolean)
                                                                                          • - preview
                                                                                          allowSetThreadLocals(boolean)
                                                                                          • - preview
                                                                                          allowSetThreadLocals(boolean)
                                                                                          java.nio.channels
                                                                                            FileChannel
                                                                                              map(FileChannel.MapMode, long, long, SegmentScope)
                                                                                              java.security.cert
                                                                                                CertStore
                                                                                                  • + final
                                                                                                  java.util.concurrent
                                                                                                    ConcurrentSkipListMap
                                                                                                      ConcurrentSkipListSet
                                                                                                        CopyOnWriteArrayList
                                                                                                          DelayQueue
                                                                                                            Executors
                                                                                                              • - preview
                                                                                                              • - preview
                                                                                                              java.util.regex
                                                                                                                Pattern
                                                                                                                  java.util
                                                                                                                    ArrayList
                                                                                                                      • + final
                                                                                                                      Collections
                                                                                                                        • - implements Map
                                                                                                                        • + implements SequencedMap
                                                                                                                        • - implements Set
                                                                                                                        • + implements SequencedSet
                                                                                                                        LinkedList
                                                                                                                          Locale
                                                                                                                            TreeMap
                                                                                                                              TreeSet
                                                                                                                                • + implements SequencedCollection
                                                                                                                                • - implements Collection
                                                                                                                                • + implements SequencedCollection
                                                                                                                                NavigableMap
                                                                                                                                  NavigableSet
                                                                                                                                    • - implements Map
                                                                                                                                    • + implements SequencedMap
                                                                                                                                    • + implements SequencedSet
                                                                                                                                    javax.crypto
                                                                                                                                      javax.net.ssl
                                                                                                                                        KeyManagerFactory
                                                                                                                                          • + final
                                                                                                                                          TrustManagerFactory
                                                                                                                                            • + final
                                                                                                                                            java.compiler
                                                                                                                                              javax.lang.model.element
                                                                                                                                                TypeElement
                                                                                                                                                  VariableElement
                                                                                                                                                    javax.lang.model
                                                                                                                                                      SourceVersion
                                                                                                                                                        java.desktop
                                                                                                                                                          javax.swing.plaf.synth
                                                                                                                                                            SynthComboBoxUI
                                                                                                                                                              SynthLookAndFeel
                                                                                                                                                                • + deprecated
                                                                                                                                                                • + forRemoval
                                                                                                                                                                javax.swing.text.html
                                                                                                                                                                  AccessibleHTML.HTMLAccessibleContext
                                                                                                                                                                    java.management.rmi
                                                                                                                                                                      javax.management.remote.rmi
                                                                                                                                                                        RMIIIOPServerImpl
                                                                                                                                                                        java.management
                                                                                                                                                                          javax.management.remote
                                                                                                                                                                            JMXConnector
                                                                                                                                                                              • + deprecated
                                                                                                                                                                              • + forRemoval
                                                                                                                                                                              java.net.http
                                                                                                                                                                                java.net.http
                                                                                                                                                                                  • + implements AutoCloseable
                                                                                                                                                                                  java.xml.crypto
                                                                                                                                                                                    javax.xml.crypto.dsig
                                                                                                                                                                                      SignatureMethod

                                                                                                                                                                                        This report is based on simple comparison of all public and protected APIs of the java.* and javax.* packages of JDK builds 21.0.5+11-LTS-tem and 20.0.2+9-tem. It does not make statements about compatibility.

                                                                                                                                                                                        For the latest Java versions the corresponding CSRs (Compatibility & Specification Review) are linked for a quick reference to find out about the reasoning of the change.