Changes in the JDK Software Since 1.1

This document lists the changes between versions 1.1 and 1.2 of the Java Development Kit. It is divided into these sections:

To find the JDK software version, execute:
    java -version

For information on version compatibility, including a comprehensive list of compatibility problems, see Java Development Kit 1.2 Compatibility Page on the Java Software web site.

Changes in 1.2 Beta 4

Extended Floating Point Semantics

Sun is proposing to revise the Java virtual machine and Java programming language specifications to enable floating-point calculations to use IEEE 754 extended-precision formats. Sun is making this proposal in cooperation with its industry partners. Information regarding the proposed changes will be made available for public review on the Java Software web site, java.sun.com, at roughly the same time as this Beta 4 release.

A detailed discussion of this proposed extension is beyond the scope of this document. Here is a brief summary of how this extension affects the JDK 1.2 Beta 4 software:

File Organization

All class libraries in the JDK are now JAR archive files. ZIP archives still work as class libraries, but tend to get extracted and removed by people who think that this is mandatory.

The files that implement the Java platform are now separate from files that implement the development tools. Thus the JDK software is deployed much like a Java application with a "private" Java Runtime Environment, with all the platform files within a jre subdirectory.

In previous releases, a single class library, classes.zip contained all non-extension classes. In this release, the classes that implement the development tools are in a separate tools.jar library (in the lib subdirectory).

Launcher Tool Changes

The launcher tools have underdone a number of changes:

Keytool Transition Issues

If you have been using the keystore implementation supplied by the "SUN" provider in the JDK software, note that Beta 4 security tools do not recognize keystores created by previous releases. Create new keystores using the Beta 4 software.

None of these issues apply if you're using your own keystore implementation.

JAR Tool Options

New command line options in the jar tool allow you to update an existing archive and change directories before accessing a file.

Servlet API Now Separate Product

The Servlets Standard Extension (javax.servlet.*) is no longer included in the JDK software. This API is now available as a separate, free product, the Java Servlet Development Kit. For more information, go to the
Servlet Product Page on the Java Software web site.

Swing Classes Revert to Old Names

In this release, the Swing APIs have been renamed to make them consistent with the Java Foundation Classes 1.1. Class and package names that began with the java.awt.swing qualifier in Beta3 begin with com.sun.java.swing in Beta 4. This change accomodates the large code base that has been written for Java 1.1 platform using the Java Foundation Classes product.

AWT and Multithreading

In java.awt.EventQueue, two new methods, invokeLater, and invokeAndWait run Runnable objects on the dispatch thread. These methods make it easy to run all AWT operations on a single thread. This is safer than allowing each thread to access the AWT directly.

These methods are similar to methods in com.sun.java.swing.SwingUtilities. However, the EventQueue methods are implemented using a public API, java.awt.event.InvocationEvent. Programmers can use InvocationEvent to write their own invokeLater and invokeAndWait methods.

MenuShortcut

In previous releases, java.awt.MenuShortcut provided an equals method that required a MenuShortcut argument. This failed to override the equals in Object. This release adds a variant that takes an Object argument.

Component Uses Preallocated Objects

In java.awt.Component, new variants of getBounds, getSize, and getLocation place their values in pre-allocated objects, instead of allocating new objects on the heap. This can substantially reduce the overhead required by short-lived objects.

PrintStream Constructors No Longer Deprecated

In 1.1, the public constructors for java.io.PrintStream were deprecated, in order to encourage use of java.io.PrintWriter. Experience indicates that replacing PrintStream with PrintWriter is not always practical. This release removes the deprecations from the PrintStream constructors.

Input Method Framework

In java.awt.im.InputContext, a new method, removeNotify, notifies the Input Method Framework that a client control has been removed or disabled.

In java.awt.im.InputMethodRequests, the method getOffsetLocation has undergone minor respecification and renamed getTextLocation. These changes reflect future support for as a "below-the-spot" input as a user option.

KeyEvent Constants

Numerous virtual key constants have been added to java.awt.event.KeyEvent. These include constants for the Euro currency symbol and for various Asian keyboards.

JDBC

The signature of java.sql.Timestamp.equals has been changed from equals(Timestamp) to equals(Object). This change prevents java.util.Date.equals from being invoked inappropriately on a TimeStamp object.

The JDBC classes have been upgraded to the JDBC 2.0 Specification. This involves numerous minor changes. For further information, see the The JDBC Features Page.

Some classes in java.sql have undergone minor changes. These include renaming the method ReadBlobLocator in SQLInput to readBlob, and making various methods throw SQLException.

BitSet Changes

A number of changes have been made to java.util.BitSet:

Property

In java.util.Property, the save method has been deprecated. In its place, use store, which throws java.io.IOException.

Random Range

In java.util.Random, a new variant of nextInt generates a pseudorandom integer between 0 (inclusive) and a specified value (exclusive).

BreakIterator Text Boundaries

In java.text.BreakIterator, two new methods, isBoundary and preceding make word selection easier and faster.

Two-digit Years

The class java.text.SimpleDateFormat has been modified to support entry of two-digit years. Two new methods, set2DigitYearStart and get2DigitYearStart, set and get the beginning of the hundred-year period assumed for two-digit years.

Time Zones

Various changes to java.util.SimpleTimeZone support more flexible definitions of Daylight Savings Time.

In java.util.TimeZone, the new getDisplayName method returns a user-readable description of the time zone.

Calendar

In java.util.Calendar, two new methods, getActualMinimum and getActualMaximum make it easier to find the length of the current month in an arbitrary calendar.

Currency Characters

In java.text.DecimalFormatSymbols, the following new methods support independent setting and getting of currency formatting symbols:

Decoding Numbers

The new methods Float.parseFloat and Double.parseDouble, parse floating point numbers in strings. They are similar to the existing Integer.parseInt and Double.parseInst. These methods return the primitive data types float, double, int, and long, respectively.

The new method Long.decode decodes long integers. It is similar to Integer.decode. These methods return objects of type Integer and Long, respectively.

Collections and Set

In java.util.Collections, a new static method and two new constants support java.util.Set operations:
singleton
Returns a new, immutable Set object with one member.
EMPTY_SET
An empty Set object.
EMPTY_LIST
An empty java.util.List object.

Collections and List

In java.util.Collections, three new static methods (plus one overloaded variant) support java.util.List operations:
fill
Fill the members of a list.
copy
Copy the contents of a list.
shuffle
Randomly permute a list.

Map Method Name

In java.util.Map, the entries method has been renamed entrySet. The new name is consistent with the related method keySet

Arrays

The class java.util.Arrays has undergone a number of changes:

List Changes

The static method, subList, has been removed from java.util.Collections and replaced by an ordinary subList method in java.util.List.

List no longer has a removeRange method or subrange variants of the indexOf or lastIndexOf methods.

ArrayList

The specification for java.util.ArrayList no longer includes the idea of a "capacity increment." The ArrayList constructor that required a capcity incrment argument has been removed.

Native Libraries

The following additions support loading of native libraries:

New Privileged Blocks API

Privileged code now uses a new closure-based API in place of the old beginPrivileged/endPrivileged calls. Refer to
New API for Privileged Blocks.

Passwords as Character Arrays

Several classes that previously passed passwords as String objects now use char arrays instead. This allows a program to dispose of a password by overwriting it, minimizing the time a password is in memory.

The following classes are affected:

Permissions

In java.security.SecureClassLoader and java.net.URLClassLoader, new getPermissions methods allow applications to add permissions to a class as it is loaded.

In java.security.Policy, the existing method evaluate has been renamed getPermissions.

CodeSource uses Certificate

The class java.security.CodeSource now uses java.security.cert.Certificate instead of java.security.PublicKey. The constructor has changed appropriately, and the getKeys method has been replaced by getCertificates. There are a number of secondary changes:

Changed Use of ProtectionDomain

Two changes related to java.security.ProtectionDomain:

CodeSource Implication

In java.security.CodeSource, a new method, implies determines if one CodeSource object "implies" another.

Signatures

In java.security.Signature and java.security.Signature.Spi, new varians of sign and engineSign use pre-allocated buffers, instead of allocating new buffers on the heap.

New Cryptography Classes and Interfaces

The following classes and interfaces have been moved to the Core API from the Java Cryptography Extension:

RevokedCertificate Becomes X509CRLEntry

A java.security.cert.RevokedCertificate object was often assumed to represent a certificate that had been revoked. It really represented a X509 Certificate Revocation List Entry. To prevent confusion, this class has been renamed X509CRLEntry.

CertificateFactory and CertificateFactorySpi

The new class java.security.cert.CertificateFactory generates Certificates or CRLs based on a Service Provider Interface (SPI). The new abstract class java.security.cert.CertificateFactorySpi defines the required methods of such an SPI.

CRL

The new abstract class java.security.cert.CRL is an abstraction of certificate revocation lists (CRLs) that have different formats but important common uses.

Unsupported X509 Extensions

In previous releases, using an X509 certificate or CRL with an unsupported critical extension caused a SecurityException. In this release, the same situation simply sets an internal flag. The value of this flag is returned by a method in java.security.cert.X509Extension, hasUnsupportedCriticalExtension.

User-Defined Randomness in Key Pair Generation

KeyPairGenerator now supports user-defined randomness. Two new variations of the initialize method take a SecureRandom object that specifies a source of randomness.

CertificateFactory Enhancement

Previously, a CertificateFactory object could generate precisely one Certificate or CRL object at a time. Two new methods, generateCertificates and generateCRLs return Collections of zero or more Certificates or CRLs, based on an input stream.

Identity Classes

Both java.security.Identity and java.security.IdentityScope have been deprecated. Identity has also reverted to the form it has in the 1.1 platform. This includes changing Identity back to an abstract class.

KeyStore Made Generic

The class java.security.KeyStore now stores generic Key objects, not just PrivateKey objects. The API has been modified and extended to support this change.

Additional Abstract Service Provider Classes

Two new Abstract classes, java.security.KeyStoreSpi and java.security.cert.CertificateFactorySpi support pluggable Service Provider Interfaces (SPIs).

Improved StringBuffer Editing

StringBuffer now offers a more complete set of editing and extraction operations:

Operation Single-Character Method Multiple-Character Method
Append append append
Insert insert insert
Delete deleteCharAt* delete*
Replace setCharAt replace*
Extract charAt substring*
*New methods.

StyledString Removed

Two classes in java.awt.font have been removed: StyledString and StyleStringIterator. Some of the features of these classes have been moved to java.text.AttributedString. The existing addAttribute method has a new argument sequence. AttributedString has a getIterator method that returns a java.text.AttributedCharacter object.

A number of APIs that used StyledString have changed:

java.awt.Graphics2D
java.awt.print.ProxyGraphics2D
java.awt.print.PeekGraphics
The drawString method that used StyledString has been replaced by an equivalent method that uses AttributedCharacterIterator.

The hitString method has been removed.

java.awt.font.TextLayout
The constructor that used StyleString has been removed. An existing constructor uses AttributedCharacterIterator.

AttributedString

New constructors in java.text.AttributedString simplify coding of an input method event.

AttributedCharacterIterator

In java.text.AttributedCharacterIterator, methods that previously used java.util.Enumeration objects now use java.util.Set. The variants of getRunLimit and getRunStart that previously used took an Enumeration argument now take a Set argument. The getAllAttributeNames method, which returned an Enumeration, has been replaced by getAllAttributeKeys, which returns a Set

The getAttributes method now returns a java.util.Map instead of a java.text.AttributeSet

In previous releases, text attribute names were specified as String values. This was inefficient and had some potential for name collision. In this release, attributes are enumerated by an inner class, Attribute, or one one of its subclasses. This requires a number of secondary changes:

Manifest Attribute Names

In place of the old Manifest Attributes, Package-Sealed and Archive-Sealed, URLClassLoader now uses Sealed Manifest Attributes for both kinds of seals. The kind of seal is indicated by the location of the Manifest Attribute.

The Manifest Attributes Package-Version, Package-Vendor, and Package-Title have been renamed to Implementation-Version, Implementation-Vendor, and Implementation-Title, respectively. This provides consistency with the related Manifest Attributes, Specification-Version, Specification-Vendor, and Specification-Title.

New And Changed URLClassLoader Methods

In java.net.URLClassloader, a new protected method, addURL, dynamically extends the list of URLs searched for classes and resources.

The existing methods findLocalClass, getLocalResource, and getLocalResources have been renamed to findClass, getResource and getResources, respectively. The use of "Local" in the old method names was found to be inappropriate and potentially confusing.

Flexible Class Loading

In java.lang.Class, a new, overloaded forName method is more flexible than the existing forName. The new forName takes additional arguments that control initialization and specify the class loader used.

Flexible Resource Loading

In java.util.ResourceBundle, a new, overloaded getBundle method takes an additional argument that specifies the class loader.

Socket Buffer Sizes

In java.net.Socket and java.net.DatagramSocket, new methods set and query buffer sizes.

DatagramPacket

In java.net.DatagramPacket, two new constructors use a buffer offset, so that packet data doesn't have to be at the beginning of a buffer.

URLDecoder

The new class java.net.URLDecoder decodes the strings encoded by java.net.URLEncoder.

Connection Callbacks

A connection object can now have a "callback" object that responds to various events in the course of a connection. This facility is supported by changes to java.net.URLConnection, including various new methods and an abstract inner class, URLConnection.Callback.

New HttpURLConnection Method

In java.net.HttpURLConnection, a new method, getErrorStream provides access to the message stream after an HTTP error. This is useful when the server returns both an error header and a document. The document is typically a message explaining the error.

FileFilter

The new interface java.io.FileFilter is similar to java.io.FileNameFilter. FileFilter uses abstract pathnames, in the form of java.io.File instances, instead of path name strings. FileFilter objects can be passed to the new listFiles method in the File class.

Improved Abstract File Class

The specification for java.io.File has been upgraded to provide a better abstract representation of file and directory path names. Class implementation has changed to support the new specification. The new specification does a better job of supporting complex file system features, such as drive letters, UNC share names, and multiple separator characters. The new specification is compatible with the original intended behavior of File, and is also compatible with current common uses of the class.

The following java.io.File methods are new or changed:

Subclassing PrintWriter

A number of changes to java.io.PrintWriter make it easier to write subclasses:

ThreadLocal

In java.lang.ThreadLocal, the initialize method, which doesn't actually initialize anything, has been renamed initialValue.

Unscaled BigDecimal

In java.math.BigDecimal, a new method, unscaledValue returns the unscaled value as a BigInteger.

Drag and Drop

Various changes to java.awt.dnd classes support Drag and Drop on multiple files.

In java.awt.dnd.DragSourceContext, the cancelDrag method has been removed.

New Drag and Drop classes abstract platform-dependent user gestures to platform-independent events. These classes are:

The new java.awt.Toolkit method, createDragGestureRecognizer creates recognizer objects.

No Reference Subclasses

The constructors for java.lang.ref.Reference have been made package-private. It is no longer possible to create new subclasses of Reference.

Weak Hash Maps

A new class, java.util.WeakHashMap, implements the most common use of Weak References, the Weak Hash Map. An entry in a WeakHashMap will be removed automatically when its key is no longer in ordinary use. More precisely, the presence of a mapping for a given key does not prevent the key from being discarded by the garbage collector -- that is, made finalizable, finalized, and then reclaimed.

Soft References

Support for Soft References in the 1.2 platform has undergone a number of changes:

Font Enhancements

Numerous changes have been made to the 2D classes to support improved font rendering and metrics, facilitate better used of native fonts, and add text layout features.

RenderingHints

The new class java.awt.RenderingHints class is used by various classes to express rendering hints:

Image

In the java.awt.image package, numerous changes have been made to make the API more consistent and to make use of the new java.awt.RenderingHints class.

Serialization Substitution

The interfaces java.io.Replaceable and java.io.Resolvable have been eliminated. Replace references to these interfaces with java.io.Serializable. Serialization now uses Reflection to invoke methods previous declared by Replaceable and Resolvable. Refer to the API documentation for the method signatures of writeReplace and readResolve.

Serialized Form

New javadoc tags @serial, @serialField, and @serialData document the serialized form of Serializable classes.

Explicitly Defining Serializable Fields

For security reasons, the special Serializable class member, serialPersistentFields must be declared private. Previously, this member could have any access. Serialization accesses this member using reflection. If it is not declared private, Serialization ignores it and uses default Serialization to compute the serializable fields of the Serializable class.

Changes in 1.2 Beta 3

Collection Classes Changes

The Collection Classes have undergone numerous design changes. For a summary, see Java Collections API Summary.

Java Accessibility (JFC)

This release reorganizes package java.awt.accessibility to make it more flexible and open. Most of the features previously defined by interface Accessible are now defined by new interfaces AccesibleAction, AccessibleComponent, AccessibleSelection, and AccessibleText.

Serialization Protocol Versions

Serialization output streams default to a new format that is not compatible with the old format. Backward compatibility is supported by java.io.ObjectOutputStream.useProtocolVersion(). To indicate the old format, use java.io.ObjectStreamConstants.PROTOCOL_VERSION_1. For the new format, use java.io.ObjectStreamConstants.PROTOCOL_VERSION_2.

Input streams automatically detect and use the correct format.

Collections Classes

The classes java.util.ArrayMap and java.util.ArraySet have been removed. These classes were intended as alternatives to java.util.HashMap and java.util.HashSet, optimized for very small collections. ArrayMap and ArraySet proved to offer negligible benefits.

The method java.util.Map.entries() now returns a java.util.Set instead of a java.util.Collection. This guarantees that two maps are equal if and only if their contents are equal. [Bug 4109773]

Java Virtual Machine Debugger Interface

A new set of class introspection functions were added. Global objects are now managed through a set of allocation callbacks.

Extensions Framework

The Extensions Framework is still in a preliminary form, and is not enabled by default. To simplify testing of Extensions software, a -new option has been temporarily added to the launcher too. See the README.

Input Method Framework

The Input Method Framework now works with Swing controls.

Additional features were added to the Input Method Framework. These include new methods in java.awt.im.InputContext and support for Internet-Intranet Input Method Protocol (IIIMP). The IIIMP adapter uses the Extensions Framework, which is currently not enabled by default. See the README for this release.

Reference Objects

The class java.lang.ref.CachedReference has been renamed java.lang.ref.SoftReference.

No Debugging Launcher

Debugging no longer requires a special non-optimized launcher. For that reason, the java_g tool has been removed from the JDK. Use the java tool instead.

JDBC

JDBC was upgraded from JDBC 1.2 to a preliminary version of JDBC 2.0.

Java 2D

In the Beta 3 release, java.awt.font.StyledString.getAttributes(int) has been removed. The method getAttributesAt(int) of the StyledString class should be used in its place.

Security Enhancements

The launcher tool (java) now includes a -usepolicy option, for specifying a security policy on the command line. This makes it unnecessary to invoke sun.misc.Launcher and set various properties in order to specify a security policy.

By default, a program started by the java launcher has no security policy, and thus no security restrictions.

Changes from 1.1 to 1.2 Beta 2

Starting with 1.1_Final, the API and feature set were frozen. At that time JDK 1.2 became the focus for new development. Any further releases of JDK 1.1 will be Maintenance Releases. This section describes JDK 1.2 Beta 2, the first public release of JDK 1.2. The 1.2 API offers the new functionality and enhancements in the following areas:
The JDK is a product of Sun Microsystems, Inc.

Copyright © 1997, 1998 Sun Microsystems, Inc.
901 San Antonio Road, Palo Alto, California 94303 USA.
All rights reserved.