Showing posts with label classlist. Show all posts
Showing posts with label classlist. Show all posts

27 December 2019

New Classes in Java 11

Java 11 is a LTS (Long Term Support) release, which means that it will get public updates till September 2022 and extended support until September 2026. While it is an important release, it does not add much to the platform, much like Java Update 10. Still Simon Ritter found 90 new features and APIs in JDK 11. Let's have a look at the new classes.

New HTTP Client
The Standard HTTP Client has been moved from jdk.incubator.http to java.net.http:
java.net.http.HttpClient
java.net.http.HttpClient$Builder
java.net.http.HttpClient$Redirect
java.net.http.HttpClient$Version
java.net.http.HttpConnectTimeoutException
java.net.http.HttpHeaders
java.net.http.HttpRequest
java.net.http.HttpRequest$BodyPublisher
java.net.http.HttpRequest$BodyPublishers
java.net.http.HttpRequest$Builder
java.net.http.HttpResponse
java.net.http.HttpResponse$BodyHandler
java.net.http.HttpResponse$BodyHandlers
java.net.http.HttpResponse$BodySubscriber
java.net.http.HttpResponse$BodySubscribers
java.net.http.HttpResponse$PushPromiseHandler
java.net.http.HttpResponse$ResponseInfo
java.net.http.HttpTimeoutException
java.net.http.WebSocket
java.net.http.WebSocket$Builder
java.net.http.WebSocket$Listener
java.net.http.WebSocketHandshakeException
Security
JEP 324: Key Agreement with Curve25519 and Curve448 comes with a few classes,
java.security.interfaces.XECKey
java.security.interfaces.XECPrivateKey
java.security.interfaces.XECPublicKey
java.security.spec.NamedParameterSpec
java.security.spec.XECPrivateKeySpec
java.security.spec.XECPublicKeySpec
as do the ChaCha20 and Poly1305 Cryptographic Algorithms: javax.crypto.spec.ChaCha20ParameterSpec.

Other Smaller Changes
There are around 20 other new classes including support for Dynamic Class-File Constants and the jaotc command.
java.lang.invoke.ConstantBootstraps

javax.print.attribute.standard.DialogOwner

jdk.nio.Channels
jdk.nio.Channels$SelectableChannelCloser

jdk.swing.interop.DispatcherWrapper
jdk.swing.interop.DragSourceContextWrapper
jdk.swing.interop.DropTargetContextWrapper
jdk.swing.interop.internal.InteropProviderImpl
jdk.swing.interop.LightweightContentWrapper
jdk.swing.interop.LightweightFrameWrapper
jdk.swing.interop.SwingInterOpUtils

jdk.tools.jaotc.aarch64.AArch64ELFMacroAssembler
jdk.tools.jaotc.aarch64.AArch64InstructionDecoder
jdk.tools.jaotc.binformat.elf.AArch64JELFRelocObject
jdk.tools.jaotc.binformat.elf.AMD64JELFRelocObject
Removal
Besides these few new classes, the real new thing in Java 11 is removal. The new Java drops much from the JDK. Really much: JavaFX is removed - it was just added in Java 8 and 9. Dropped packages are
javafx.* [8-10]
javafx.css [9-10]
javafx.css.converter [9-10]
javafx.fxml [9-10]
javafx.scene [9-10]
javafx.util [9-10]
Java EE and CORBA Modules are dropped:
javax.activation [6-10]
javax.activity [5-10]
javax.annotation [6-10]
javax.jnlp [5-10]
javax.jws [6-10]
javax.rmi.CORBA [3-10]
javax.security.auth.Policy [4-10]
javax.transaction [3-10]
javax.xml.bind [6-10]
javax.xml.soap [6-10]
javax.xml.ws [6-10]
jdk.management.cmm.SystemResourcePressureMXBean [8-10]
jdk.management.resource [8-10]
jdk.packager.services.singleton [only 10]
jdk.packager.services.userjvmoptions [9-10]
org.omg.CORBA [2-10]
Most of these classes have been added with Java 6, some even in the previous release (10).

List of all public classes
You can download the complete history of all public classes ever available in Java from version 1.0 to 11.0.2. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5].

4 December 2019

New Classes in Java 10

New in Java 10As Java developer I used to monitor the new features of Java very closely. As Code Cop my focus on programming languages is much broader. Currently I am working with clients using C#, Java, JavaScript, Kotlin, Oracle PL/SQL, PHP, Python and TypeScript. (And I would love a few more clients using some F#, Go or Scheme.) Since version 9, Java is released much more often than it used to be and I lost track of its new features. Eventually I had to catch up. Here is the list of all new classes in Java 10. Java 10 was launched March 2018 and went EOL September 2018. While it is not relevant as a version on its own, I want to be explicit about it as it is part of 11 and all later releases.

Local-Variable Type Inference
The most interesting new feature is the var keyword, Local-Variable Type Inference. This is a compiler feature and is not visible in the public classes available in the JRE/JDK. The var causes a lot of discussions about readability of source code. I recommend checking out the Style Guidelines for Local Variable Type Inference in Java to avoid confusion.

Experimental Java-Based JIT Compiler
JEP 317 enables the Java-based JIT compiler named Graal. It comes with the jaotc command which produces native code for compiled Java methods. While this is a feature of Java 9, JEP 295, the new class jdk.tools.jaotc.Main and the packages jdk.tools.jaotc.* show up for the first time.

Other Smaller Changes
The number of new classes in Java 10 is below 50, of which 40 classes are the jaotc. The remaining are
javafx.scene.control.TabPane$TabDragPolicy

jdk.incubator.http.HttpRequest$BodyPublisher
jdk.incubator.http.HttpResponse$BodySubscriber
jdk.incubator.http.HttpResponse$MultiSubscriber

jdk.jfr.events.FileForceEvent

jdk.packager.services.singleton.SingleInstanceListener
jdk.packager.services.singleton.SingleInstanceNewActivation
jdk.packager.services.singleton.SingleInstanceService
a change to JavaFX, drag policies for tabs in a TabPane, providing Flow implementations for the experimental HTTP 2 client, something in the Oracle Flight Recorder, a commercial feature that must be unlocked before being used and Single Instance functionality for Java Packager.

This is a very small release, still Simon Ritter from Azul Systems managed to find 109 New Features In JDK 10. Check them out!

List of all public classes
You can download the complete list of all classes available in Java from version 1.0 to 10.0.2. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5].

10 May 2018

New Classes in Java 9

JigsawJava 10 was released few months ago, marking the end of free public updates for Java 9 at the same time. High time to have a look what is new in Java 9. Like for Java 8 and Java 7 before, I follow the same approach and list the new classes shipped in the release. I use my JavaClass Ruby gem to find all public classes. There were two minor additions to the Java class file format which I hade to deal with: Two new constant pool tags (Module 19 and Module 20) and a new access modifier (Module 0x8000).

Java Platform Module System (JPMS)
Java Modularity aka Project Jigsaw is probably the biggest change in Java 9, outlined by JEP 261. It brings the following classes for modules, tools and SPI providers necessary to decouple modules.
java.lang.instrument.UnmodifiableModuleException
java.lang.LayerInstantiationException
java.lang.Module
java.lang.ModuleLayer

java.lang.module.Configuration
java.lang.module.FindException
java.lang.module.InvalidModuleDescriptorException
java.lang.module.ModuleDescriptor
java.lang.module.ModuleFinder
java.lang.module.ModuleReader
java.lang.module.ModuleReference
java.lang.module.ResolutionException
java.lang.module.ResolvedModule

javax.lang.model.element.ModuleElement
javax.lang.model.element.UnknownDirectiveException

jdk.tools.jimage.Main
jdk.tools.jimage.resources.jimage

jdk.tools.jlink.builder.DefaultImageBuilder
jdk.tools.jlink.builder.ImageBuilder
jdk.tools.jlink.plugin.Plugin
jdk.tools.jlink.plugin.ResourcePool
jdk.tools.jlink.plugin.ResourcePoolBuilder
jdk.tools.jlink.plugin.ResourcePoolEntry
jdk.tools.jlink.plugin.ResourcePoolModule
jdk.tools.jlink.plugin.ResourcePoolModuleView

jdk.tools.jmod.JmodTask
jdk.tools.jmod.Main

java.net.spi.URLStreamHandlerProvider
java.util.spi.AbstractResourceBundleProvider
java.util.spi.ResourceBundleProvider
java.util.spi.ToolProvider
javax.accessibility.AccessibilityProvider
jdk.nio.zipfs.ZipFileSystemProvider
Reactive Streams
JEP 266 is quite interesting, it adds the Flow API, a minimal API version of Reactive Streams:
java.util.concurrent.Flow
java.util.concurrent.Flow$Processor
java.util.concurrent.Flow$Publisher
java.util.concurrent.Flow$Subscriber
java.util.concurrent.Flow$Subscription
Other Smaller Changes
Then we have BeanInfo Annotations which allows us to use annotations to provide BeanInfo information. Now it is possible to Filter Incoming Serialization Data which fixes a security vulnerability and we get XML Catalogs.
java.beans.BeanProperty
java.beans.JavaBean
javax.swing.SwingContainer

java.io.ObjectInputFilter
java.io.ObjectInputFilter$Config
java.io.ObjectInputFilter$FilterInfo
java.io.ObjectInputFilter$Status

javax.xml.catalog.Catalog
javax.xml.catalog.CatalogException
javax.xml.catalog.CatalogFeatures
javax.xml.catalog.CatalogManager
javax.xml.catalog.CatalogResolver
UI Related Changes
I thought Java on the fat client side is not a thing, but there are a bunch of UI related JEPs: New Platform-Specific Desktop Features, support for Multi-Resolution Images, TIFF Image I/O and even some changes to good old Swing:
java.awt.desktop                  java.awt.image
...AboutEvent/-Handler            ...AbstractMultiResolutionImage
...AppEvent                       ...BaseMultiResolutionImage
...AppForegroundEvent/-Listener   ...MultiResolutionImage
...AppHiddenEvent/-Listener
...AppReopenedEvent/-Listener     javax.imageio.plugins.tiff
...FilesEvent                     ...BaselineTIFFTagSet
...OpenFilesEvent/-Handler        ...ExifGPSTagSet
...OpenURIEvent/-Handler          ...ExifInteroperabilityTagSet
...PreferencesEvent/-Handler      ...ExifParentTIFFTagSet
...PrintFilesEvent/-Handler       ...ExifTIFFTagSet
...QuitEvent/-Handler             ...FaxTIFFTagSet
...QuitResponse                   ...GeoTIFFTagSet
...QuitStrategy                   ...TIFFDirectory
...ScreenSleepEvent/-Listener     ...TIFFField
...SystemEventListener            ...TIFFImageReadParam
...SystemSleepEvent/-Listener     ...TIFFTag
...UserSessionEvent/-Listener     ...TIFFTagSet

java.awt.Taskbar                  javax.swing.plaf.synth.SynthIcon
java.awt.peer.TaskbarPeer         javax.swing.UIClientPropertyKey
Incubator HTTP 2 Client
Java 9 introduces the concept of an incubator area, where Oracle wants to try out new features. There we have a new HTTP 2 Client,
jdk.incubator.http.HttpClient
jdk.incubator.http.HttpHeaders
jdk.incubator.http.HttpRequest
jdk.incubator.http.HttpResponse
jdk.incubator.http.HttpTimeoutException
jdk.incubator.http.MultiMapResult
jdk.incubator.http.WebSocket
jdk.incubator.http.WebSocketHandshakeException
As it is not a final API it might change in future Java releases.

Other changes
There is The Java Shell (Read-Eval-Print Loop) (main class jdk.jshell.JShell) and the Parser API for Nashorn. The Doclet API jas been moved from com.sun. to jdk.javadoc.doclet and the jdk.​dynalink package enables Dynamic Linking of Language-Defined Object Models - I have no idea what that is for ;-)

Finally there is a bunch of individual classes implementing Indify String Concatenation, Variable Handles, Process API Updates, the New Version-String Scheme, the Stack-Walking API, Platform Logging API and Service, the usual security updates like DRBG-Based SecureRandom Implementations, Merge Selected Xerces 2.11.0 Updates into JAXP and even some additions to CORBA.
java.lang.invoke.StringConcatFactory
java.lang.invoke.StringConcatException

java.lang.invoke.VarHandle

java.lang.IllegalCallerException
java.lang.ProcessHandle
java.lang.ref.Cleaner
java.lang.reflect.InaccessibleObjectException
java.lang.Runtime$Version
java.lang.StackWalker
java.lang.System$Logger

java.sql.ConnectionBuilder
java.sql.ShardingKey/-Builder
javax.sql.PooledConnectionBuilder
javax.sql.XAConnectionBuilder

java.util.concurrent.SubmissionPublisher
java.util.zip.CRC32C
jdk.nio.zipfs.ZipInfo

javax.annotation.processing.Generated
javax.management.ConstructorParameters
javax.tools.StandardJavaFileManager$PathFactory

java.security.cert.URICertStoreParameters
java.security.DrbgParameters
java.security.SecureRandomParameters
javax.security.auth.kerberos.EncryptionKey
javax.security.auth.kerberos.KerberosCredMessage
jdk.security.jarsigner.JarSigner
jdk.security.jarsigner.JarSignerException

javax.xml.bind.JAXBContextFactory
javax.xml.xpath.XPathEvaluationResult
javax.xml.xpath.XPathNodes
org.w3c.dom.ElementTraversal

org.omg.CORBA.BoundsHelper
org.omg.CORBA.ORBPackage.InvalidNameHelper
org.omg.CORBA.TypeCodePackage.BadKindHelper
org.omg.CORBA.TypeCodePackage.BoundsHelper
To learn more about Java 9
The list above shows new classes only. There are many more changes in Java 9. I recommend watching Venkat Subramaniam's Exploring Java 9 The Key Parts talk from Devoxx 2017. The recording contains more than two and a half hours material presented in Venkat's dry and at the same time entertaining way. It is the most complete presentation on new features in Java 9 which I found. A big part of it is about using JShell and Jigsaw. It is an amazing talk. Go watch it.

Summary
Java 9 contains around 500 new classes, similar to Java releases 6, 5 and 1.2. You can download the complete list of all classes available in Java from version 1.0 to 9.0.4. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5].

30 September 2015

New Classes in Java 8

Jumping Spider #1Java (SE) 8 was released on the 18th of March 2014. Unlike previous releases it did not have a code name like Tiger or Dolphin. Spider was proposed as unofficial name on Code Ranch because of "8 legs, and a strong association with webs." It was an exciting release with huge changes, with probably similar or even larger impact than Java 5, which brought Generics. The new features (and the ones that did not make it into Java 8 yet) show that Java is on its way to be a modern and productive programming language.

Numbers
The rt.jar and other JARs located in the lib folder of the JRE contain many classes. For each new release I take a look at the new (public) classes. The list of new classes complements the list of new language features. Java 8 adds more than 1000 public classes, mainly in the packages javafx.*. Without JavaFX there are 251 added classes, similar to Java 7.

Java Classes by JDK/JSE
Lambdas and Streams
The major library changes are to support Lambda Expressions and the related Stream API. The new java.util.function package contains all types of possible function types.
java.lang.FunctionalInterface

java.lang.invoke.LambdaConversionException
java.lang.invoke.LambdaMetafactory
java.lang.invoke.MethodHandleInfo
java.lang.invoke.SerializedLambda

java.util.function.
BiFunction                Function                   Predicate
ToDoubleBiFunction        DoubleFunction             BiPredicate
ToIntBiFunction           IntFunction                DoublePredicate
ToLongBiFunction          LongFunction               IntPredicate
                                                     LongPredicate
BinaryOperator            DoubleToIntFunction
DoubleBinaryOperator      DoubleToLongFunction       Supplier
IntBinaryOperator         IntToDoubleFunction        BooleanSupplier
LongBinaryOperator        IntToLongFunction          DoubleSupplier
                          LongToDoubleFunction       IntSupplier
Consumer                  LongToIntFunction          LongSupplier
BiConsumer                ToDoubleFunction
DoubleConsumer            ToIntFunction              UnaryOperator
IntConsumer               ToLongFunction             DoubleUnaryOperator
LongConsumer                                         IntUnaryOperator
ObjDoubleConsumer                                    LongUnaryOperator
ObjIntConsumer
ObjLongConsumer
The Streams are in the package java.util.stream,
Stream
Stream$Builder
StreamSupport
BaseStream
DoubleStream
DoubleStream$Builder
IntStream
IntStream$Builder
LongStream
LongStream$Builder

Collector
Collector$Characteristics
Collectors
as well as some additions to java.util for splitting and collecting.
java.util.DoubleSummaryStatistics
java.util.IntSummaryStatistics
java.util.LongSummaryStatistics

java.util.Spliterator
java.util.Spliterator$OfDouble
java.util.Spliterator$OfInt
java.util.Spliterator$OfLong
java.util.Spliterator$OfPrimitive
java.util.Spliterators
java.util.Spliterators$AbstractDoubleSpliterator
java.util.Spliterators$AbstractIntSpliterator
java.util.Spliterators$AbstractLongSpliterator
java.util.Spliterators$AbstractSpliterator
java.util.SplittableRandom

java.util.StringJoiner
Java 8 Date and Time API
The next big change is the new date and time API. It contains a lot of new classes to model and use dates and time in your code.
java.time.Clock                     ...format.DateTimeFormatter
java.time.DateTimeException         ...format.DateTimeFormatterBuilder
java.time.DayOfWeek                 ...format.DateTimeParseException
java.time.Duration                  ...format.DecimalStyle
java.time.Instant                   ...format.FormatStyle
java.time.LocalDate                 ...format.ResolverStyle
java.time.LocalDateTime             ...format.SignStyle
java.time.LocalTime                 ...format.TextStyle
java.time.Month
java.time.MonthDay                  ...temporal.ChronoField
java.time.OffsetDateTime            ...temporal.ChronoUnit
java.time.OffsetTime                ...temporal.IsoFields
java.time.Period                    ...temporal.JulianFields
java.time.Year                      ...temporal.Temporal
java.time.YearMonth                 ...temporal.TemporalAccessor
java.time.ZonedDateTime             ...temporal.TemporalAdjuster
java.time.ZoneId                    ...temporal.TemporalAdjusters
java.time.ZoneOffset                ...temporal.TemporalAmount
                                    ...temporal.TemporalField
...chrono.AbstractChronology        ...temporal.TemporalQueries
...chrono.ChronoLocalDate           ...temporal.TemporalQuery
...chrono.ChronoLocalDateTime       ...temporal.TemporalUnit
...chrono.Chronology                ...temporal.UnsupportedTemporalTypeException
...chrono.ChronoPeriod              ...temporal.ValueRange
...chrono.ChronoZonedDateTime       ...temporal.WeekFields
...chrono.Era
...chrono.HijrahChronology          ...zone.ZoneOffsetTransition
...chrono.HijrahDate                ...zone.ZoneOffsetTransitionRule
...chrono.HijrahEra                 ...zone.ZoneOffsetTransitionRule$TimeDefinition
...chrono.IsoChronology             ...zone.ZoneRules
...chrono.IsoEra                    ...zone.ZoneRulesException
...chrono.JapaneseChronology        ...zone.ZoneRulesProvider
...chrono.JapaneseDate
...chrono.JapaneseEra
...chrono.MinguoChronology
...chrono.MinguoDate
...chrono.MinguoEra
...chrono.ThaiBuddhistChronology
...chrono.ThaiBuddhistDate
...chrono.ThaiBuddhistEra
And Other Classes
There are several new classes all over the place. The most notable are:
  • Reflection for Type Annotations.
  • Finally a Base 64 encoder and decoder.
  • Optional.
  • CompletableFuture and StampedLock.
java.lang.annotation.Native                      java.io.UncheckedIOException
java.lang.annotation.Repeatable
                                                 java.net.URLPermission
java.lang.reflect.AnnotatedArrayType
java.lang.reflect.AnnotatedParameterizedType     java.sql.DriverAction
java.lang.reflect.AnnotatedType                  java.sql.JDBCType
java.lang.reflect.AnnotatedTypeVariable          java.sql.SQLType
java.lang.reflect.AnnotatedWildcardType
java.lang.reflect.Executable                     java.util.Base64
java.lang.reflect.MalformedParametersException   java.util.Base64$Decoder
java.lang.reflect.Parameter                      java.util.Base64$Encoder

java.security.DomainLoadStoreParameter           java.util.Calendar$Builder
java.security.KeyStore$Entry$Attribute           java.util.Locale$FilteringMode
java.security.PKCS12Attribute                    java.util.Locale$LanguageRange
java.security.spec.DSAGenParameterSpec
                                                 java.util.Optional
java.security.cert.CertPathChecker               java.util.OptionalDouble
java.security.cert.PKIXRevocationChecker         java.util.OptionalInt
java.security.cert.PKIXRevocationChecker$Option  java.util.OptionalLong

java.util.spi.CalendarDataProvider               java.util.PrimitiveIterator
java.util.spi.CalendarNameProvider               java.util.PrimitiveIterator$OfDouble
java.util.spi.ResourceBundleControlProvider      java.util.PrimitiveIterator$OfInt
                                                 java.util.PrimitiveIterator$OfLong
java.util.concurrent.atomic.DoubleAccumulator
java.util.concurrent.atomic.DoubleAdder
java.util.concurrent.atomic.LongAccumulator
java.util.concurrent.atomic.LongAdder

java.util.concurrent.CompletableFuture
java.util.concurrent.CompletableFuture$AsynchronousCompletionTask
java.util.concurrent.CompletionException
java.util.concurrent.CompletionStage
java.util.concurrent.ConcurrentHashMap$KeySetView
java.util.concurrent.CountedCompleter

java.util.concurrent.locks.StampedLock
Additional changes cover additions to UI capabilities - JavaFX is now part of the JRE. The Java Language Model has been updated (javax.lang.model) and Rhino has been replaced by Nashorn (package jdk.nashorn). There are more changes, e.g. stronger security algorithms, but these do not show up as new classes.

Summary
Java 8 brings big changes for the language, finally adding closures to Java. This is as ground breaking as Java 5's Generics. Lambdas and Streams will change the way we write Java and allow a more functional style in our code.

You can download the complete list of all classes available in Java 8. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5]. Package access classes are marked by a lowercase p, e.g. java.lang.CharacterName [7p].

28 October 2012

Java 7 aka Dolphin

DolphinFour years after the last major release, Java 7 was released July 28th 2011. It brought several new features, the most commonly mentioned were the Diamond Operator, using strings in switch statements, automatic resource management, numeric literals with underscores and improved exception handling. Further there were additions to NIO, the Fork/Join framework and invokedynamic. You have probably heard of all these things by now. There were also some minor additions, but the previous ones have been talked about since long before Java 7 was released.

A good start to check the new features of Java 7 is the presentation about the 55 New Features You (Probably) Didn't Hear About. It also covers some lesser known additions. For a complete list of all changes see the Java 7 Release Notes. They are really worth reading, and include links into the Java Tutorial for more complex topics.

Classlist
Always when a new version of Java comes out, I take a look at its new classes, using my Java Class File Parser. The list of new classes complements the list of new features. Java 7 adds 211 public classes to rt.jar, where Java 6 had 490 and Java 5 even added 547. So it looks like a smaller release.

invokedynamic
I heard that a lot of work went into the invokedynamic byte code instruction which was added to the JVM. It comes with a small, new package java.lang.invoke.
java.lang.invoke.CallSite
java.lang.invoke.ConstantCallSite
java.lang.invoke.MethodHandle
java.lang.invoke.MethodHandleProxies
java.lang.invoke.MethodHandles
java.lang.invoke.MethodType
java.lang.invoke.MutableCallSite
java.lang.invoke.SwitchPoint
java.lang.invoke.VolatileCallSite
java.lang.invoke.WrongMethodTypeException
While this package contains just ten classes, there are another 16 package access classes (not shown here), so invokedynamic is definitely more complex than it looks.

NIO Channels
A more practical addition are some new NIO channels, most noteworthy the AsynchronousChannels, which allow network and file access in an asynchronous way, together with their exceptions.
java.nio.channels.AcceptPendingException
java.nio.channels.AlreadyBoundException
java.nio.channels.AsynchronousByteChannel
java.nio.channels.AsynchronousChannel
java.nio.channels.AsynchronousChannelGroup
java.nio.channels.AsynchronousFileChannel
java.nio.channels.AsynchronousServerSocketChannel
java.nio.channels.AsynchronousSocketChannel
java.nio.channels.CompletionHandler
java.nio.channels.IllegalChannelGroupException
java.nio.channels.InterruptedByTimeoutException
java.nio.channels.MembershipKey
java.nio.channels.MulticastChannel
java.nio.channels.NetworkChannel
java.nio.channels.ReadPendingException
java.nio.channels.SeekableByteChannel
java.nio.channels.ShutdownChannelGroupException
java.nio.channels.WritePendingException

java.nio.channels.spi.AsynchronousChannelProvider
NIO.2
The new java.nio.file package is the largest addition, it contains a brand new API for file access together with file attributes like POSIX permissions, file system and file storage abstractions.
java.nio.file.AccessDeniedException
java.nio.file.AccessMode
java.nio.file.AtomicMoveNotSupportedException
java.nio.file.ClosedDirectoryStreamException
java.nio.file.ClosedFileSystemException
java.nio.file.ClosedWatchServiceException
java.nio.file.CopyOption
java.nio.file.DirectoryIteratorException
java.nio.file.DirectoryNotEmptyException
java.nio.file.DirectoryStream
java.nio.file.FileAlreadyExistsException
java.nio.file.Files
java.nio.file.FileStore
java.nio.file.FileSystem
java.nio.file.FileSystemAlreadyExistsException
java.nio.file.FileSystemException
java.nio.file.FileSystemLoopException
java.nio.file.FileSystemNotFoundException
java.nio.file.FileSystems
java.nio.file.FileVisitOption
java.nio.file.FileVisitor
java.nio.file.FileVisitResult
java.nio.file.InvalidPathException
java.nio.file.LinkOption
java.nio.file.LinkPermission
java.nio.file.NoSuchFileException
java.nio.file.NotDirectoryException
java.nio.file.NotLinkException
java.nio.file.OpenOption
java.nio.file.Path
java.nio.file.PathMatcher
java.nio.file.Paths
java.nio.file.ProviderMismatchException
java.nio.file.ProviderNotFoundException
java.nio.file.ReadOnlyFileSystemException
java.nio.file.SecureDirectoryStream
java.nio.file.SimpleFileVisitor
java.nio.file.StandardCopyOption
java.nio.file.StandardOpenOption
java.nio.file.StandardWatchEventKinds
java.nio.file.Watchable
java.nio.file.WatchEvent
java.nio.file.WatchKey
java.nio.file.WatchService

java.nio.file.attribute.AclEntry
java.nio.file.attribute.AclEntryFlag
java.nio.file.attribute.AclEntryPermission
java.nio.file.attribute.AclEntryType
java.nio.file.attribute.AclFileAttributeView
java.nio.file.attribute.AttributeView
java.nio.file.attribute.BasicFileAttributes
java.nio.file.attribute.BasicFileAttributeView
java.nio.file.attribute.DosFileAttributes
java.nio.file.attribute.DosFileAttributeView
java.nio.file.attribute.FileAttribute
java.nio.file.attribute.FileAttributeView
java.nio.file.attribute.FileOwnerAttributeView
java.nio.file.attribute.FileStoreAttributeView
java.nio.file.attribute.FileTime
java.nio.file.attribute.GroupPrincipal
java.nio.file.attribute.PosixFileAttributes
java.nio.file.attribute.PosixFileAttributeView
java.nio.file.attribute.PosixFilePermission
java.nio.file.attribute.PosixFilePermissions
java.nio.file.attribute.UserDefinedFileAttributeView
java.nio.file.attribute.UserPrincipal
java.nio.file.attribute.UserPrincipalLookupService
java.nio.file.attribute.UserPrincipalNotFoundException

java.nio.file.spi.FileSystemProvider
java.nio.file.spi.FileTypeDetector
The new abstraction for files is the Path, and the helper classes Files and Paths are the main entry points for using the new functionality. The good old java.io.File is not deprecated but considered legacy from now on. Now plain Java can do everything and we do not need to include commons-io any more.

JSR 166y Concurrency Additions
JSR 166y added the Fork/Join framework and a few concurrency related classes which did not make it into Java 5 on time, where the original JSR 166 went in.
java.util.concurrent.ConcurrentLinkedDeque
java.util.concurrent.ForkJoinPool
java.util.concurrent.ForkJoinTask
java.util.concurrent.ForkJoinWorkerThread
java.util.concurrent.LinkedTransferQueue
java.util.concurrent.Phaser
java.util.concurrent.RecursiveAction
java.util.concurrent.RecursiveTask
java.util.concurrent.ThreadLocalRandom
java.util.concurrent.TransferQueue
The main class is the ForkJoinPool together with its two workers, RecursiveAction and RecursiveTask.

Other Classes
There are several new classes all over the JDK,
java.awt.SecondaryLoop
java.beans.Transient
java.lang.AutoCloseable
java.lang.BootstrapMethodError
java.lang.ClassValue
java.lang.ReflectiveOperationException
java.lang.SafeVarargs
java.lang.management.BufferPoolMXBean
java.lang.management.PlatformLoggingMXBean
java.lang.management.PlatformManagedObject
java.net.ProtocolFamily
java.net.SocketOption
java.net.StandardProtocolFamily
java.net.StandardSocketOptions
java.nio.charset.StandardCharsets
java.security.AlgorithmConstraints
java.security.CryptoPrimitive
java.security.cert.CertificateRevokedException
java.security.cert.CRLReason
java.security.cert.Extension
java.security.cert.PKIXReason
java.sql.PseudoColumnUsage
java.util.IllformedLocaleException
java.util.Objects
javax.crypto.AEADBadTagException
javax.crypto.spec.GCMParameterSpec
javax.net.ssl.ExtendedSSLSession
javax.net.ssl.X509ExtendedTrustManager
javax.print.attribute.standard.DialogTypeSelection
javax.security.auth.kerberos.KeyTab
javax.sound.midi.MidiDeviceReceiver
javax.sound.midi.MidiDeviceTransmitter
javax.sql.rowset.RowSetFactory
javax.sql.rowset.RowSetProvider
javax.swing.border.StrokeBorder
javax.swing.JLayer
javax.swing.Painter
javax.swing.plaf.nimbus.AbstractRegionPainter
javax.swing.plaf.nimbus.NimbusLookAndFeel
javax.swing.plaf.nimbus.NimbusStyle
javax.swing.plaf.nimbus.State
javax.xml.bind.JAXBPermission
javax.xml.ws.EndpointContext
javax.xml.ws.spi.Invoker
javax.xml.ws.spi.http.HttpContext
javax.xml.ws.spi.http.HttpExchange
javax.xml.ws.spi.http.HttpHandler
The changes cover additions to UI capabilities, e.g. NimbusLookAndFeel, new security algorithms and updated JDBC, XML and WS packages. The most interesting classes are AutoCloseable for the new try-with-resources statement and Objects with its requireNonNull(T obj) method.

Summary
Java 7 has some nice additions to core Java, but still feels like a smaller release, not as ground breaking as Java 5. The most useful thing might be the Diamond Operator because it saves a lot of typing.

See the complete list of all classes available in Java 7. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5]. Package access classes are indicated by a lowercase p, e.g. java.lang.CharacterName [7p].

5 April 2010

Evolution of Java Platform Classes

Back in 2006 I started creating a list of all Java classes available in the Java runtime. I wrote about the new classes of Java 5 and Java 6 in the past. Such lists of classes come handy if you want to know all classes of the JDK/ Standard Edition or if you want to be a Java Champion like Heinz Kabutz. I mention Heinz because I mailed him my lists some time ago and he confessed that he had not known that Short and Void were added with Java 1.1. Shame on you Heinz ;-) He said it was difficult to get these really old Java versions nowadays.

And there were really interesting things happening. Sometimes private (package access) classes were promoted to public top level ones. This happened in almost all major upgrades,
  • from JDK 1.1 to J2SE 1.2
    java.io.ObjectStreamConstants
    java.io.ObjectStreamField
    java.net.SocketOptions
  • from J2SE 1.2 to J2SE 1.3
    java.awt.datatransfer.MimeTypeParseException
    java.awt.font.TextMeasurer
    javax.swing.plaf.basic.BasicHTML
    javax.swing.plaf.metal.MetalInternalFrameTitlePane
  • from J2SE 1.3 to J2SE 1.4
    java.awt.ScrollPaneAdjustable
    javax.swing.Popup
    javax.swing.PopupFactory
    javax.swing.text.html.ImageView
    
  • from Java 5 to Java 6
    java.awt.GridBagLayoutInfo
    javax.management.loading.MLetContent
    
The Disappearing Gnomes!!While these classes appeared as new ones in the specified release, they have been around inside their package for at least two years. Some of them, e.g. ObjectStreamConstants states a (for this list) correct @since JDK 1.1, whereas others show the Java version they became public in their @since tag. I guess their JavaDoc was added when they were made public, or maybe they have been rewritten? This must be true for java.text.Normalizer which was available as package access class in Java 1.3, then dropped in Java 1.4 and came back as a public class in Java 1.6.

The opposite change, from public to private class, is rare. I only found one class, javax.management.timer TimerAlarmClockNotification, which was removed from the public API in Java 6. It was added with Java 5 but marked as deprecated. I guess it came in with JMX 1.1 where it had been deprecated for some time.

According to my list there are only two classes that ever disappeared completely from the JDK, java.text.resources DateFormatZoneData and javax.swing.beaninfo SwingBeanInfo. The DateFormatZoneData was inside i18n.jar which was removed in 1.4 and SwingBeanInfo even lived inside lib/dt.jar, far away from jre/lib/rt.jar, which indicated it had been created to be used by development tools only.

11 December 2008

New in Java 6

Java 6 New Features coverIt has been two years since Java 6 was released, so it's really high time to get to know it better.

Book about new features
Earlier this year I read Java 6 New Features by Budi Kurniawan to get an idea of the new features. I liked the book a lot because it is really unique. All the other books you find for Java 6 are general Java books that more or less cover the new features of Mustang. I do not want to read about the methods of java.lang.Object or the Collections Framework again. Budi Kurniawan does an excellent job focusing only on the new stuff. If you want to know what is new in release 6, go for this book!

List of all new classes in Mustang
Then I updated my list of all classes included in the runtime of Java, similar to what I did two years ago. I used Sun's Java 1.6.0_11 and created the updated list of all runtime environment classes in Java 1.6. Let's see what I found: Java 6 added only 74 new types in the java. name-space,
java.awt.Desktop
java.awt.font.LayoutPath
java.awt.geom.Path2D
java.awt.GridBagLayoutInfo
java.awt.LinearGradientPaint
java.awt.MultipleGradientPaint
java.awt.RadialGradientPaint
java.awt.SplashScreen
java.awt.SystemTray
java.awt.TrayIcon
java.beans.ConstructorProperties
java.io.Console
java.io.IOError
java.lang.management.LockInfo
java.lang.management.MonitorInfo
java.net.CookieManager
java.net.CookiePolicy
java.net.CookieStore
java.net.HttpCookie
java.net.IDN
java.net.InterfaceAddress
java.security.PolicySpi
java.security.URIParameter
java.sql.ClientInfoStatus
java.sql.NClob
java.sql.RowId
java.sql.RowIdLifetime
java.sql.SQLClientInfoException
java.sql.SQLDataException
java.sql.SQLFeatureNotSupportedException
java.sql.SQLIntegrityConstraintViolationException
java.sql.SQLInvalidAuthorizationSpecException
java.sql.SQLNonTransientConnectionException
java.sql.SQLNonTransientException
java.sql.SQLRecoverableException
java.sql.SQLSyntaxErrorException
java.sql.SQLTimeoutException
java.sql.SQLTransactionRollbackException
java.sql.SQLTransientConnectionException
java.sql.SQLTransientException
java.sql.SQLXML
java.sql.Wrapper
java.text.Normalizer
java.text.spi.BreakIteratorProvider
java.text.spi.CollatorProvider
java.text.spi.DateFormatProvider
java.text.spi.DateFormatSymbolsProvider
java.text.spi.DecimalFormatSymbolsProvider
java.text.spi.NumberFormatProvider
java.util.ArrayDeque
java.util.concurrent.BlockingDeque
java.util.concurrent.ConcurrentNavigableMap
java.util.concurrent.ConcurrentSkipListMap
java.util.concurrent.ConcurrentSkipListSet
java.util.concurrent.LinkedBlockingDeque
java.util.concurrent.locks.AbstractOwnableSynchronizer
java.util.concurrent.locks.AbstractQueuedLongSynchronizer
java.util.concurrent.RunnableFuture
java.util.concurrent.RunnableScheduledFuture
java.util.Deque
java.util.NavigableMap
java.util.NavigableSet
java.util.ServiceConfigurationError
java.util.ServiceLoader
java.util.spi.CurrencyNameProvider
java.util.spi.LocaleNameProvider
java.util.spi.LocaleServiceProvider
java.util.spi.TimeZoneNameProvider
java.util.zip.DeflaterInputStream
java.util.zip.InflaterOutputStream
java.util.zip.ZipError
and around 400 in javax. packages,
javax.activation
javax.annotation
javax.jws
javax.lang.model
javax.script
javax.smartcardio
javax.tools
javax.xml.bind
javax.xml.crypto
javax.xml.soap
javax.xml.stream
javax.xml.transform.stax
javax.xml.ws
mainly the Java Activation Framework, some extended annotations and the model of the Java language. Further there are the new Scripting (JSR 223) and Compiler (JSR 199) APIs. More than half of the new classes are XML related, including XML Binding/JAXB 2.0 (JSR 222), XML signatures (JSR 105), Streaming API 4 XML/StaX (JSR 175) and XML based Web Services/JAX-WS 2.0 (JSR 224).

The need for a better tool
Till now I used some ugly shell scripts to extract the needed information about the classes in rt.jar. With the growth of the JRE the repeated call of javap -public %class% for each class took more and more time. I needed something else to determine the accessibility of each class. I remembered that there was a field that determined various attributes of a class. I wanted to load the class file's bytes, jump to the offset of this field and read the package/public flag. The Java class file format is simple, but unfortunately not that simple. In order to read the access_flags, one needs to understand the whole constant pool because the access flag is stored afterwards and the constant pool is of variable length. So I started disassembling the class files. I do not know why, but I happened to write the new script in Ruby:
# Unpack HI-LO byte orders contained in the String.
class String
  # Return the _index_ 'th and the next element as unsigned word.
  def u2(index)
    self[index..index+1].unpack('n')[0]
  end
end

class JavaClassHeader

  # Parse the binary _data_ from the class file.
  def initialize(data)

    # u4 magic;
    # u2 minor_version;
    # u2 major_version;

    # u2 constant_pool_count;
    # cp_info constant_pool[constant_pool_count-1];

    constant_pool_count = data.u2(8)
    pos = 10
    cnt = 1
    while cnt <= constant_pool_count - 1
      case data.u1(pos) # cp_info_tag
        when 7
          pos += 3
        when 9
          pos += 5
        when 10
          pos += 5
        when 11
          pos += 5
        when 8
          pos += 3
        when 3
          pos += 5
        when 4
          pos += 5
        when 5
          pos += 9
          cnt += 1
        when 6
          pos += 9
          cnt += 1
        when 12
          pos += 5
        when 1
          length = data.u2(pos+1)
          pos += 3 + length
        else
          raise "const ##{cnt} unknown tag #{data[pos]}"
      end
      cnt += 1
    end

    # u2 access_flags;
    @access_flags = data.u2(pos)
  end
After (sort of) parsing the class file, the check if a class is public or only package accessible was straight forward to implement.
  ACC_PUBLIC = 0x0001

  # Return +true+ if the class is public.
  def accessible?
   (@access_flags & ACC_PUBLIC) != 0
  end
This improved performance a lot and I am looking forward to the release of Java 7 to use my new ClassList script again.

(Download the list of all classes in Mustang.)

Update 14 Mar 2009

javaclass-rb Project Initiated

The ClassList script was fun and made me want to play more with class files. Based on the source code above, I created javaclass-rb, a parser and disassembler for Java class files, similar to the javap command. The initial version reads the class file version and the package/public flag of a class as well as the constant pool. Expect updates soon!

3 September 2006

What is in Java 5

Tiger, Tiger Floating LightDid you ever wonder when a particular class was introduced into the JDK? Or did you ever want to get a quick overview of all new classes included in a new release of Java? That is why I maintain my personal list of all public classes together with the JRE's version they were introduced. I started the list in 2002 and have been updating it whenever a new version of Java came out. Now, almost two years after the release of Tiger, it is high time to update my list with Java 5.

Source of Truth
There is only one true source of the contents of a JRE, and that is rt.jar. Getting a plain list of all *.class files inside the archive is not enough because some classes are package accessible and cannot be used in Java code directly. I use a series of shell scripts that generate a text file with all Java classes of rt.jar. After unpacking rt.jar a script iterates all class names and calls javap -public %class% >> access.log for each of them. Stripping all public content from access.log reveals the package accessible classes, e.g.
java.awt.MutableBoolean
java.beans.ReflectionUtils
java.util.JumboEnumSet
java.util.XMLUtils
...
The list of new classes is the list of all classes found in rt.jar minus the package accessible classes, minus all classes of all earlier versions of Java.

Java 5
Tiger adds 172 new public types in the java. name-space. The new classes are
java.awt.datatransfer.FlavorEvent
java.awt.datatransfer.FlavorListener
java.awt.MouseInfo
java.awt.peer.KeyboardFocusManagerPeer
java.awt.peer.MouseInfoPeer
java.awt.PointerInfo
java.beans.IndexedPropertyChangeEvent
java.io.Closeable
java.io.Flushable
java.lang.Appendable
java.lang.Deprecated
java.lang.Enum
java.lang.EnumConstantNotPresentException
java.lang.Iterable
java.lang.Override
java.lang.ProcessBuilder
java.lang.Readable
java.lang.reflect.AnnotatedElement
java.lang.reflect.GenericArrayType
java.lang.reflect.GenericDeclaration
java.lang.reflect.GenericSignatureFormatError
java.lang.reflect.MalformedParameterizedTypeException
java.lang.reflect.ParameterizedType
java.lang.reflect.Type
java.lang.reflect.TypeVariable
java.lang.reflect.WildcardType
java.lang.StringBuilder
java.lang.SuppressWarnings
java.lang.TypeNotPresentException
java.math.MathContext
java.math.RoundingMode
java.net.CacheRequest
java.net.CacheResponse
java.net.CookieHandler
java.net.HttpRetryException
java.net.Proxy
java.net.ProxySelector
java.net.ResponseCache
java.net.SecureCacheResponse
java.rmi.server.RemoteObjectInvocationHandler
java.security.AuthProvider
java.security.CodeSigner
java.security.interfaces.ECKey
java.security.interfaces.ECPrivateKey
java.security.interfaces.ECPublicKey
java.security.KeyRep
java.security.spec.ECField
java.security.spec.ECFieldF2m
java.security.spec.ECFieldFp
java.security.spec.ECGenParameterSpec
java.security.spec.ECParameterSpec
java.security.spec.ECPoint
java.security.spec.ECPrivateKeySpec
java.security.spec.ECPublicKeySpec
java.security.spec.EllipticCurve
java.security.spec.MGF1ParameterSpec
java.security.Timestamp
java.security.UnrecoverableEntryException
java.util.AbstractQueue
java.util.DuplicateFormatFlagsException
java.util.EnumMap
java.util.EnumSet
java.util.FormatFlagsConversionMismatchException
java.util.Formattable
java.util.FormattableFlags
java.util.Formatter
java.util.FormatterClosedException
java.util.IllegalFormatCodePointException
java.util.IllegalFormatConversionException
java.util.IllegalFormatException
java.util.IllegalFormatFlagsException
java.util.IllegalFormatPrecisionException
java.util.IllegalFormatWidthException
java.util.InputMismatchException
java.util.InvalidPropertiesFormatException
java.util.jar.Pack200
java.util.logging.LoggingMXBean
java.util.MissingFormatArgumentException
java.util.MissingFormatWidthException
java.util.PriorityQueue
java.util.Queue
java.util.regex.MatchResult
java.util.Scanner
java.util.UnknownFormatConversionException
java.util.UnknownFormatFlagsException
java.util.UUID
as well as 86 classes of the four completely new packages
java.lang.annotation
java.lang.instrument
java.lang.management
java.util.concurrent
Further there are around 300 new types in javax. packages. The JMX Management Extension 1.2, javax.management, adds more than 170 classes and is a major addition. Further there are several smaller new packages, mainly
javax.jnlp
javax.sql.rowset
javax.xml.datatype
javax.xml.namespace
javax.xml.validation
javax.xml.xpath
i.e. JNLP-Client 1.0 for JavaWebStart, SQL RowSet implementations and several XML functions from JAXP 1.3 like schema mapping, name-spaces, schema validation and XPath.

Full Class List
Here is the complete list of all classes from Java 1.0 to 1.5, to be more precise from Sun's JDK 1.02 and 1.1.8_09, J2SE 1.2.2_13, 1.3.1_08 and 1.4.2_03, and the new Java5 1.5.0_07. This list gets more and more valuable because it becomes more and more difficult to get older JDKs.