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

New APIs in Java 21

Comparing Java 21 (21-ea+24-2086-open) with Java 20 (20.0.1+9-tem).

Element Modification
java.base
    java.io
      • + sealed
      java.lang.constant
        ConstantDescs
          ClassDesc
            MethodHandleDesc
              MethodTypeDesc
                • added
                • added
                java.lang.foreign
                  Arena
                    isCloseableBy(Thread)
                    openConfined()
                    openShared()
                    scope()
                    GroupLayout
                      withBitAlignment(long)
                      • removed
                      • added
                      Linker.Option.CaptureCallState
                      Linker.Option
                        captureCallState(String...)
                        Linker
                          • + abstract
                          upcallStub(MethodHandle, FunctionDescriptor,...
                          MemoryLayout.PathElement
                            MemoryLayout
                              bitAlignment()
                              • removed
                              bitOffset(MemoryLayout.PathElement...)
                              • removed
                              bitOffsetHandle(MemoryLayout.PathElement...)
                              • removed
                              bitSize()
                              • removed
                              • + abstract
                              valueLayout(Class, ByteOrder)
                              withBitAlignment(long)
                              • removed
                              • added
                              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)
                                  • removed
                                  • added
                                  SegmentAllocator
                                    allocate(ValueLayout.OfAddress, MemorySegment)
                                    nativeAllocator(SegmentScope)
                                    SegmentScope
                                    SequenceLayout
                                      withBitAlignment(long)
                                      • removed
                                      • added
                                      StructLayout
                                        withBitAlignment(long)
                                        • removed
                                        • added
                                        SymbolLookup
                                          libraryLookup(Path, SegmentScope)
                                          libraryLookup(String, SegmentScope)
                                          • added
                                          UnionLayout
                                            withBitAlignment(long)
                                            • removed
                                            • added
                                            VaList.Builder
                                            VaList
                                            ValueLayout.OfAddress
                                            ValueLayout.OfBoolean
                                              withBitAlignment(long)
                                              • removed
                                              • added
                                              ValueLayout.OfByte
                                                withBitAlignment(long)
                                                • removed
                                                • added
                                                ValueLayout.OfChar
                                                  withBitAlignment(long)
                                                  • removed
                                                  • added
                                                  ValueLayout.OfDouble
                                                    withBitAlignment(long)
                                                    • removed
                                                    • added
                                                    ValueLayout.OfFloat
                                                      withBitAlignment(long)
                                                      • removed
                                                      • added
                                                      ValueLayout.OfInt
                                                        withBitAlignment(long)
                                                        • removed
                                                        • added
                                                        ValueLayout.OfLong
                                                          withBitAlignment(long)
                                                          • removed
                                                          • added
                                                          ValueLayout.OfShort
                                                            withBitAlignment(long)
                                                            • removed
                                                            • added
                                                            ValueLayout
                                                              withBitAlignment(long)
                                                              • removed
                                                              • added
                                                              java.lang.invoke
                                                                ClassSpecializer.Factory
                                                                • removed
                                                                ClassSpecializer.SpeciesData
                                                                • removed
                                                                StringConcatFactory
                                                                  java.lang.reflect
                                                                    ClassFileFormatVersion
                                                                      java.lang.runtime
                                                                        • added
                                                                        • added
                                                                        • added
                                                                        • - preview
                                                                        java.lang
                                                                          Character
                                                                            Compiler
                                                                            FdLibm.Cbrt
                                                                            • removed
                                                                            FdLibm.Hypot
                                                                            • removed
                                                                            FdLibm.Pow
                                                                            • removed
                                                                            • - 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
                                                                                                                    • added
                                                                                                                    • added
                                                                                                                    • added
                                                                                                                    • added
                                                                                                                    • - 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.net.ssl
                                                                                                                                  KeyManagerFactory
                                                                                                                                    • + final
                                                                                                                                    TrustManagerFactory
                                                                                                                                      • + final
                                                                                                                                      java.compiler
                                                                                                                                        javax.lang.model.element
                                                                                                                                          VariableElement
                                                                                                                                            • added preview
                                                                                                                                            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
                                                                                                                                                                                • added
                                                                                                                                                                                • added

                                                                                                                                                                                This report is based on simple comparison of all public and protected APIs of the java.* and javax.* packages of JDK builds 21-ea+24-2086-open and 20.0.1+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.

                                                                                                                                                                                More detailed API comparisons based on the japicmp tool can be found here.