Java

Java Community ProcessSM Maintenance Review
for Java SETM 6 Beta

 

Introduction

This document provides descriptions of specification changes being made in version 6 Beta of the Java Platform, Standard Edition (Java SE).

Version 6 includes a set of new Java Specification Requests (JSRs) that introduce major new functionality. This Maintenance Review does not cover new APIs defined through those JSRs; it documents only smaller changes made under the JCP Maintenance Review process. Moreover, this Maintenance Review does not cover updates to specifications that are contained in Java SE 6 but that are also available stand-alone. Separate Maintenance Reviews will be held for any changes to such specifications.

The descriptions in this document correspond to platform changes made since the release of J2SE 5.0. The specification change descriptions are provided for purposes of Java Community ProcessSM public maintenance review.

Java SE 6 is a feature release containing significant API changes. The Java SE 6 specification requires a new Java Compatibility Kit (JCK).

Feedback

Please use the following address to provide review feedback on the specification changes described here.

mustang-jsr-review@sun.com

Change Descriptions

All changes to the specification made between J2SE 5.0 and Java SE 6 Beta, including trivial changes such as corrections of typographical errors and misspellings, are indicated in the following document, where insertions are conveniently shown in bold and deletions are shown in strike-thru:

Specification Difference Pages

Some of the more significant specification clarifications are described in the following sections of this document.

Core Libraries

User Interface

Native Interfaces for Tools

Deployment


Core Libraries

Accessibility

Accessibility: Added constants: AccessibleAction.CLICK and AccessibleAction.TOGGLE_POPUP

Two definitions for user-actions have been added as constants to javax.accessibility.AccessibleAction.

These action definitions allow assistive technologies such as screen readers to report the actions associated with user-interface components. The action descriptions can then be localized for the appropriate locale. These changes are necessary for user-interface component that support "click" actions or "toggle popup" actions in order to be compliant with Section 508 requirements.

The two new accessibility constants are:

The RFE associated with this change is 4984658.

Beans

Beans: EventHandler documentation and exception handling improvements

The following improvements have been made to java.beans.EventHandler documentation and exception handling:

The RFE associated with this change is 6204552.

Beans: EventHandler target property syntax improved

The EventHandler target property now supports the same syntax as the event property.

This change affects the following class:

The RFE associated with this change is 6271692.

Collections

Collections: Sorted Collection Classes with bidirectional navigation

New interfaces java.util.NavigableMap, java.util.NavigableSet and java.util.concurrent.ConcurrentNavigableMap

The new APIs provide Sets and Maps with more capabilities, in particular the ability to search bidirectionally, and to find elements strictly less or strictly greater than a given element.

This change adds the following interfaces:

The existing classes java.util.TreeMap and java.util.TreeSet have been enhanced to implement the above interfaces.

The new classes java.util.concurrent.ConcurrentSkipListMap and java.util.concurrent.ConcurrentSkipListSet are concurrent implementations of the above interfaces.

The RFE associated with this change is 4155650.

Collections: Documented that Arrays.fill(Object[],...) throws ArrayStoreException

Previously, the documentation for java.util.Arrays.fill(Object[], Object) and java.util.Arrays.fill(Object[], int, int, Object) did not mention the situation when array contains objects that are not comparable with key value. In fact, ArrayStoreException is thrown.

With this change, the documentation is updated for those two methods.

The bug report associated with this change is 4229892.

Collections: Documented that Vector.copyInto throws ArrayStoreException

When the runtime type of an argument is not a supertype of the runtime type of every element in this Vector, the copyInto method of the vector class throws java.lang.ArrayStoreException. However, this was not documented before.

The documentation for java.util.Vector.copyInto now mentions this exception.

The bug report associated with this change is 4936876.

Collections: New methods for conveniently and efficiently copying, shrinking, and growing arrays

This change adds new methods to java.util.Arrays to copy part or all of an array to another array. In addition to their convenience, they are more efficient than user code which invokes java.lang.System.arrayCopy because they do not zero-out the destination memory prior to the copy. Two basic patterns of methods are provided. The first copies an entire array to a new array, truncating or padding with nulls as necessary.

The second pattern copies a range of values to a new array. With these methods, the initial from index must lie between zero and the length of the original array, and the final to index must be greater than from (and may be greater than the length of the original). The resulting copy will be truncated or padded with nulls as necessary.

The methods shown above are for object types, but methods are also provided for all primitive types, for example:

The RFE associated with this change is 4655503.

Collections: Collection classes' API documentation improved

This change improves the readability and accuracy of the API documentation of the Collection classes in many minor ways.

The bug reports associated with this change are 5018849, 5108057, 6186175, 6192476, 6261984, 6269713, 6269739, 6269785, 6270647, 6269720.

Collections: Double-ended queues (deques) added

This change provides bi-directional variants of queues and lists and iterators that visit their elements in a descending direction. This is a straightforward extension of the Queue interface and related classes.

Two new interfaces are provided:

Two new classes are provided that implement the above interfaces:

The java.util.ArrayDeque class is likely to be faster than java.util.Stack when used as a stack, and faster than java.util.LinkedList when used as a queue. One existing class has been modified to implement the new interface: java.util.LinkedList

One new method is added which returns a Queue view of a Deque:

The RFEs associated with this change are 6192552 and 6324846.

Collections: New Collections.newSetFromMap(Map<E,Boolean>) method

Some Map classes have a "companion" Set class, like TreeMap/TreeSet. This change adds a new method to java.util.Collections:

public static <E> Set<E> newSetFromMap(Map<E, Boolean> map)

This method returns a set backed by the specified map. The resulting set displays the same ordering, concurrency, and performance characteristics as the backing map. The specified Map must be empty at the time this method is invoked, and should not be accessed directly until after this method returns.

Note that there is no need to use this method on a Map implementation that already has a corresponding Set implementation (such as TreeMap).

The RFE associated with this change is 6301089.

Collections: Improvements to collection classes

Some new overriding methods have been added:

The types of some method parameters have been changed from the previous release:

Note: The two changes above are both binary-compatible and source-compatible.

A new method was added: java.util.concurrent.locks.ReentrantReadWriteLock.getReadHoldCount().

The bug report associated with this change is 6328220.

I/O

I/O: New API for improved interactive console I/O

Previously, applications that prompted for user input on the command line did not allow for "blanking" (not displaying) input when the user was prompted to enter a password. The new java.io.Console API provides this behavior.

An instance of Console is available from the new method java.lang.System.console().

This change also introduces a new subclass of Error called IOError, with a single public constructor, java.io.IOError(Throwable cause). IOError instances may be thrown from the readLine and readPassword methods of Console.

The RFE associated with this change is 4050435.

I/O: Added methods to return the size of the file system, the amount of free space, and the amount of space that is usuable by the VM

Previously, there was no way to determine free disk space in a platform-independant way.

This change adds the following methods to return the size of the file system, the amount of free space, and the amount of space which is usuable by the VM:

The java.lang.RuntimePermission class controls access to this information.

The RFE associated with this change is 4057701.

I/O: Improvement to documentation for InputStreamReader.getEncoding()

Previously, the API specification said that java.io.InputStreamReader.getEncoding() *may* return null if the stream is closed. This has been improved to say that it *will* return null after the stream has been closed.

The RFE associated with this change is 4149939.

I/O: New method to get class descriptor for a non-serializable class

This feature provides a variant of the existing java.io.ObjectStreamClass.lookup static method that works for non-serializable classes. This new static method returns the descriptor for any class, whether or not it implements Serializable.

The new method is java.io.ObjectStreamClass.lookupAny(Class cl).

The bug report associated with this change is 4413615.

I/O: Added a clearError() method to PrintWriter and PrintStream

The java.io.PrintWriter and PrintStream classes have checkError() method for retrieving the internal error flag of the output stream. However, previously, thay had no method for clearing (resetting) the error flag.

This change does the following:

The RFE associated with this change is 4491255.

I/O: Documented null and empty string cases for FilePermission

Previously, the documentation for the java.io.FilePermission constructor did not describe some cases of the null and empty strings being passed as parameters for path and actions arguments.

With this change the documentation is updated as follows:

The bug report associated with this change is 4955804.

I/O: Improved API documentation of Reader and Writer close() methods

This change adds detail to the API documentation of the Reader.close() and Writer.close() methods. The changes document existing behavior.

The bug report associated with this change is 5085148.

I/O: Manipulation of file access attributes made possible

Changes to the java.io.File class allows client code to set the read, write, and execute access permissions of a file. The attributes can be set for the owner only, or for all users of the file. A File can be queried to determine if it is executable.

The RFE associated with this change is 6216563.

I/O: Corrected documentation for SequenceInputStream.read(...)

The javadoc for SequenceInputStream.read(...) previously said that if the parameter buffer used to save bytes is null, up to "len" bytes are read and discarded. However, the implementation simply throws a NullPointerException and no bytes are read and discarded. In addition, if the "len" is 0, it does not block and returns 0 immediately, but this was not documented.

With this change, the documentation for the following method has been updated:

The bug report associated with this change is 6244191.

I/O: Documented that in FilePermission /dir/* does not include the directory itself

There was previously an inconsistancy in the Javadoc for java.io.FilePermission class in describing the permission when the specified pathname is "/*". The class description correctly said that a pathname ending in "/*" indicated all the files and directories contained in that directory, but not the directory itself, whereas the constructor incorrectly said that the indicated directory was also included in the permission.

This change corrects the documentation for the constructor and for the implies() method to not include the directory itself, as follows:

The bug report associated with this change is 6274572.

java.lang

java.lang: Added copySign, nextAfter, scalb, getExponent to Math and StrictMath

Methods have been added to the Math and StrictMath classes for low-level examination and manipulation of floating-point numbers, useful for writing math libraries and numerical tests.

This change affects the following classes:

The RFE associated with this change is 4826652.

java.lang: Added final finalizer to java.lang.Enum

A final finalizer method has been added to java.lang.Enum. The method is the following:

This change theoretically breaks both source and binary compatibility. However, it is extremely unlikely that any existing code relies upon the ability to declare a finalize method in an enumeration constant. Such methods are nearly useless since enumeration constants do not normally become unused and thence eligible for finalization.

The bug report associated with this change is 5087624.

java.lang: Changed signature for Object.getClass() and improved its description

Previously, the signature for the Object.getClass() method was confusing.

The specification of the method has been clarified by highlighting that it is a special case. In addition, Class<? extends Object> has been changed to Class<?>, which is better style and equivalent to the first.

Note: This change is both binary-compatible and source-compatible.

The RFE associated with this change is 6187181.

java.lang: Added convenience method isEmpty() to java.lang.String

The convenience method java.lang.String.isEmpty() has been added to the java.lang.String class.

The RFE associated with this change is 6189137.

java.lang: RuntimePermission exitVM target made more fine-grained

The previous exitVM RuntimePermission allowed users to grant code permission to exit the JVM. However, it did not allow users to control access based on the exit status value. The java.lang.SecurityManager.checkExit(int) method took an exit status value as a parameter. The default SecurityManager implementation ignored this status value. In this release, the exitVM RuntimePermission target name has been modified, to allow an exit status value to be specified.

This change affects the following class and method:

The RFE associated with this change is 6268673.

java.lang.instrument

java.lang.instrument: Ability to add .jar files to a classpath

When a tool, such as a profiler or management console, attaches to a running VM, the tool will typically need to load its tool agent into the VM. If the agent is written in the Java Language, then the .jar file that contains the agent classes must be added to the system classpath at runtime. Furthermore, if the agent does bytecode instrumentation (for example, if the tool does profiling or tracing), then it will need to add supporting instrumentation classes onto the boot classpath and maybe also the system classpath.

This change adds two new methods to add .jar files to classpaths:

This change also adds a new error class to java.lang.instrument:

The RFE associated with this change is 6173575.

java.lang.instrument: Allow an agent to be started during the "live phase"

A VM may support a mechanism that allows agents to be started in the VM during the live phase. The details for how this is supported are implementation-specific. For example, a tool may use a platform-specific mechanism or an implementation-specific API to attach to the running VM and request the VM to start a given agent.

If an agent is started during the live phase, then it must define one of the following methods. That method will be called to start the agent.

In addition to the above change, support for a new version of the premain method has been added for agents that are loaded during VM startup:

This feature requires the specification of a new attribute "Agent-Class," which can be specified in the manifest of an agent JAR file. For further information, see the java.lang.instrument package specification.

The RFE associated with this change is 6173612.

java.lang.instrument: Support for multiple agents

Three new methods have been added to support multiple agents in such a way that they do not overwrite each other's instrumentation:

The RFE associated with this change is 6274241.

java.lang.instrument: Use of redefineClasses made easier

Previously, the redefineClasses method was specified to have a single array argument. This is awkward when only a single class is being redefined. This change makes the java.lang.instrument.Instrumentation.redefineClasses(ClassDefinition[] definitions) method use varargs instead of an array as the argument.

The bug report associated with this change is 6274264.

java.lang.management

java.lang.management: Support for java.util.concurrent locks added in java.lang.management

There are two runtime facilities to retrieve the thread dump information to diagnose lock-related problem. Previously, these facilities only retrieved information about object monitors but not java.util.concurrent locks. This functionality has been added in this release.

This change adds the following classes and methods to java.lang.management:

This change also adds the following classes and methods to java.util.concurrent.locks:

The RFE associated with this change is 5086470.

java.text/java.util

java.text/java.util: Support for locale-sensitive services SPI

This feature enables the plug-in of locale-dependent data and services through the Service Provider Interfaces (SPIs). These SPIs make it much easier for developers to provide support of locales in addition to the locales that are currently available in the Java SE platform.

This change adds the following packages:

This change also affects the following methods:

The RFE associated with this change is 4052440.

java.text

java.text: Added get/set methods for the exponential symbol in DecimalFormatSymbols

Previously, there were public APIs in the DecimalFormatSymbols class to get and set the format symbol characters, such as "decimal separator." With this change there are now public APIs to get and set the format symbol character for "exponential".

The new methods are the following:

Changes to the DecimalFormatSymbols class are the following:

The RFE associated with this change is 4068067.

java.text: RoundingMode support in NumberFormat

Previously, the NumberFormat class supported only HALF_EVEN rounding. This change allows NumberFormat to support other rounding modes.

This change provides get/set methods for rounding modes. In the abstract class NumberFormat.java, for backward compatibility, the default get method always returns RoundingMode.HALF_EVEN, and the set method does nothing. The DecimalFormat class provides a concrete implementation for these methods.

The new methods are the following:

The new field is the following:

The RFE associated with this change is 4092330.

java.text: CollationKey allows subclassing

Previously, the CollationKey class did not provide an accessible constructor and the class was declared as a final class, so there was no way for Collator implementors to instantiate a CollationKey instance, or its subclass.

With this change, the CollationKey class is made non-final, and the constructor is protected type, so that a subclass can be implemented.

The RFE associated with this change is 4106263.

java.text: Added java.text.Normalizer as a public class for normalizing Unicode strings

A new class, java.text.Normalizer, has been added in order to normalize strings based on the Unicode Consortium's Unicode Normalization Forms (UAX #15). An enum, java.text.Normalizer.Form, has been added to specify a normalization form for Normalizer.

The RFE associated with this change is 4221795.

java.text: Added protected constructors for java.text.Format and NumberFormat

The java.text.Format and NumberFormat classes do not define a constructor in the source code and therefore receive a public default constructor

This change adds a protected constructor to each class:

The RFE associated with this change is 4456503.

java.text: Methods in BreakIterator that were mistakenly marked public are now marked protected

Three utility methods were accidentally made public in the previous Java SE release and have no API documentation. They are now marked protected.

These methods are the following:

The bug report associated with this change is 6242909.

java.util

java.util: Added methods for determining whether a resource for a key is available in a bundle

Previously, in order to find out whether a resource for a key is available in a resource bundle, you had to call the getObject method and catch a MissingResourceException, which was very costly.

This change adds the new method java.util.ResourceBundle.containsKey(String key).

The RFE associated with this change is 4286358.

java.util: Added the new java.util.Service class

The java.util.Service class has been added make it easier for developers to make use of the META-INF/services feature, which has become very widely used.

The RFE associated with this change is 4640520.

java.util: Updated locale ID / resource bundle suffix for Hebrew and other languages to correct language codes

The new ISO 639 language code for Hebrew is "he," for Yiddish "yi," and for Indonesian "id." The code for Norwegian is "no," with the two variants "nb" and "nn," for Bokmal and Nynorsk. Java was unable to load a resource bundle with suffix "he," because the correct language code was mapped to the old code "iw." The same problem existed for Yiddish, Indonesian, and Norwegian.

This fix has removed the mappings of these correct ISO language codes to their old definitions so that those new ISO 639 language codes can be used for loading resource bundles based on the new language codes. This fix also addresses new Norwegian language codes for Bokmal and Nynorsk variants.

The following methods have been changed:

The RFE associated with this change is 4778440.

java.util: Comments are escaped when Properties.store is called

Previously, there were some problems with the implementation of the Properties.store(out, comments) method:

The corresponding changes have been made:

The bug report associated with this change is 5087448.

java.util: ResourceBundle enhancements

This feature opens up the steps of the resource bundle-loading process and its cache control so that each step may be substituted with an application-provided step. For example, you can specify getBundle to look up only property-based resource bundles, thus avoiding the overhead of never-existing-class-based-bundle lookups.

The following enhancements have been made:

These enhancements are supported by the following changes in ResourceBundle:

The RFE associated with this change is 5102289.

java.util: New method to return String keys only

Previously there was no way to get the list of all String keys on a "compromised" properties object that contained a non-String key. Properties.propertyNames() threw a ClassCastException.

With this change a new method java.util.Properties.stringPropertyNames has been added. This method is similar to propertyNames() but it omits non-String keys. The methods propertyNames() and list() throw ClassCastException if the Properties object contains non-String keys. The spec is updated to include a @throw clause in these methods for clarification. For backward compatibility, existing behavior was not changed.

The RFE associated with this change is 6253413.

java.util: Reset method added to Scanner

This change adds a reset() method to java.util.Scanner.reset(), which sets the delimiter, radix, and locale to their default values (Character.isWhitespace, 10, and initial locale respectively).

The RFE associated with this change is 6288823.

java.util: TimeZone.getDisplayName no longer takes useDaylightTime() value into account

Previously, TimeZone.getDisplayName took into account the value of useDaylightTime() to determine if daylight savings time (DST) was to be used for the time zone. However, the method useDaylightTime() can return only the information of the last known DST rules. This caused a problem if older time stamps used different DST rules.

With this change, TimeZone.getDisplayName can now return the historical daylight savings name even if TimeZone.useDaylightTime() returns false for the present time zone, because TimeZone.getDisplayName does not take into account the value of useDaylightTime().

The following method has been changed:

The bug report associated with this change is 6300580.

java.util: Improved API documentation of java.util.Properties.storeToXML

The java.util.Properties.storeToXML methods on the java.util.Properties class can throw a ClassCastException. This was previously undocumented but with this change, the methods' API documentation describes the situation in which the exception may be thrown.

The bug report associated with this change is 6319672.

java.util: Added simple public Map.Entry implementations

This change provides an implementation of Map.Entry used by java.util.AbstractMap:

The bug reports associated with this change are 4904074 and 6330389.

java.util.concurrent

java.util.concurrent: Sorted Collection Classes with bidirectional navigation

See the corresponding entry in the Collections section of this document for details.

The RFE associated with this change is 4155650.

java.util.concurrent: TimeUnit now has enum constants for longer durations

This change enhances java.util.concurrent.TimeUnit to include support for minutes, hours, and days. Both enumeration constants for these units and methods converting to them are provided.

The RFE associated with this change is 5057341.

java.util.concurrent: Minor improvements to ConcurrentHashMap constructor specification

This change improves the API documentation of the java.util.concurrent.ConcurrentHashMap() constructors by explicitly stating the default values of load factor and concurrency level that are used by the implementation. It also changes the initial capacity of a ConcurrentHashMap that is constructed from another map to be the default instead of 11.

The bug report associated with this change is 5073546.

java.util.concurrent: Support for java.util.concurrent locks added in java.lang.management

See the corresponding entry in the java.lang.management section of this document for details.

The RFE associated with this change is 5086470.

java.util.concurrent: Double-ended queues (deques) added

See the corresponding entry in the Collections section of this document for details.

The RFEs associated with this change are 6192552 and 6324846.

java.util.concurrent: Added AbstractQueuedLongSynchronizer, providing support for 64 bits of synchronization state

Previously, users were limited to 32 bits of state for implementing blocking locks, and so on, via java.util.concurrent.locks.AbstractQueuedSynchronizer. This change provides a new class providing the same facilities, but with 64 bits of state:

As with AbstractQueuedSynchronizer, this class is for advanced users who need to build their own locking primitives.

The RFE associated with this change is 6237968.

java.util.concurrent: Improved extensibility of thread pools

This change allows client code to cause thread pools to use client-provided task types. Doing so requires creating subclasses of one of:

In both cases, client code overrides methods methods to return the client-provided task types. Thess classes are for advanced users who want to build a thread pool using existing classes as a starting point.

The RFE associated with this change is 6277663.

java.util.concurrent: Improvements to collection classes

See the corresponding entry in the Collections section of this document for details.

The bug report associated with this change is 6328220.

JMX

The specification changes in Java SE 6 Beta related to the JMX API will be covered in separate maintenance reviews of JSR 3 and JSR 160.

Naming

Naming: API added to statically look up an Object from the InitialContext class

This change provides two convenience methods on javax.naming.InitialContext for looking up an object. Previously, code might do:

InitialContext ic = new InitialContext();
Object obj = ic.lookup(name);

With this change code can instead do:

Object obj = InitialContext.doLookup(name);

The doLookup method is provided in two overloaded forms:

The RFE associated with this change is 5088444.

Networking

Networking: Correction to Javadoc about security checks in ServerSocket.accept()

Previously, the "@exception SecurityException" tag for java.net.ServerSocket.accept() stated that the security manager's checkListen method was called to check if the operation was allowed. However, this has been corrected to say that the checkAccept method is called, as is stated in the method description.

The RFE associated with this change is 4327912.

Networking: Enhancement to NetworkInterface class

This change provides a number of new methods for accessing state and configuration information relating to a system's network adapters. This includes information such as the broadcast address, subnet mask, MAC addresses, and MTU size. The new java.net.NetworkInterface methods are:

The new class InterfaceAddress encapsulates all information about a NetworkInterface's IP addresses, including the broadcast address, and subnet prefix length (subnet mask).

The RFE associated with this change is 4691932.

Networking: International Domain Names supported

RFCs 3490, 3491, 3492, 3454 define a mechanism where domain names comprised of characters in alphabets other than US ASCII can be stored in the DNS. An algorithm is defined which provides a conversion from arbitrary Unicode strings to and from a "mangled" ASCII form. This feature provides a new class, java.net.IDN, which allows applications to do this conversion so that IDNs can be looked up via the InetAddress class. The IDN class contains two principle methods:

These methods perform the conversion between IDNs contained in arbitrary Unicode Strings and the encoded ASCII form, and vice-versa.

The RFE associated with this change is 4737170.

Networking: Resource identifiers internationalized

RFC 3987 defines Internationalized Resource Identifiers (IRIs) as being analagous to URIs, but where the characters contained are not limited to US ASCII. Originally, the URI class did provide partial support for IRIs, but this change completes that support, including the addition of methods which can convert between IRIs and URIs. The following new methods are added to java.net.URI:

The RFE associated with this change is 5085902.

Networking: Default CookieManager implementation added

The CookieHandler class was added in J2SE 5.0, but no implementation was provided in java.net. This feature provides a simple extensible implementation which separates the storage of cookies from the policy surrounding their acceptance. The default manager provides a number of standard policies and a simple in-memory storage mechanism. User defined policies and storage mechanisms can be used with this implementation.

This change adds the following classes:

The RFE associated with this change is 6244040.

Networking: JSSE configuration mechanisms improved

Improvements to the JSSE configuration mechanisms now allow the default SSLContext to be obtained by applications, and also allow the SSL context to be configured. Methods have also been added to set and retrieve SSL connection parameters.

This change adds the following methods:

A new class, javax.net.ssl.SSLParameters, has also been added.

The RFE associated with this change is 6301090.

NIO

NIO: Fixed CharsetEncoder and CharsetDecoder

This change fixes a number of problems with the specification and implementation of java.nio.charset.CharsetEncoder and CharsetDecoder. Previously, the API specification was both self-contradictory and inaccurate in some respects. This change fixes the API documentation, and changes the implementation to match.

In particular, encode(CharBuffer) now actually does call flush on the user's behalf, and repeated calls to flush() are now allowed.

The bug reports associated with this change are 6221056, 6227608, 6196991, 6228679, 6231155.

NIO: Some methods promoted to java.nio.Buffer from subclasses

The java.nio classes are occasionally used by third-party libraries to interface to native code such as graphics libraries. As data is frequently extracted from buffers, performance is important. Therefore, in order simplify programming with NIO and increase performance, the following methods have been moved up to java.nio.Buffer from the subclasses:

The RFE associated with this change is 6274870.

RMI

RMI: Generified the java.rmi.MarshalledObject API

A java.rmi.MarshalledObject contains an arbitrary (serializable) object. Previously, the contained object was simply typed as an Object (for the constructor parameter and the return type of the "get" method). Therefore, when declaring a MarshalledObject in some other API, the type of the contained object could not be expressed programmatically, but only in words.

A type parameter T has been added to java.rmi.MarshalledObject to represent the type of the contained object, and the constructor parameter type and the return type of the get() method have been converted from Object to T.

In addition, uses of the java.rmi.MarshalledObject API have been generified throughout the java.rmi.* public API.

This change affects the following classes:

This change affects the following methods:

With such a generification, a program element could be declared to be not just a MarshalledObject, but a MarshalledObject that contains a marshalled object that is assignable to a particular reference type.

Note: This generification is both binary-compatible and source-compatible.

The RFE associated with this change is 5037386.

Security

Security: KerberosKey and KerberosTicket override hashcode and equals methods

In this release, KerberosKey and KerberosTicket now override hashcode and equals methods

This change affects the following methods:

The RFE associated with this change is 4641821.

Security: Enhancements to doPrivileged to retain DomainCombiner

A ProtectionDomain encapsulates the characteristics of executing code. It contains, for example, the URL from where the code was loaded as well as the certificates used to sign the code. Permissions can be granted to a ProtectionDomain based on these characteristics.

A DomainCombiner is used to update ProtectionDomains with dynamic security information (for example, the user executing the code). This enables access controls to be enforced against both the code and the dynamic (user) information.

Previously, if code called doPrivileged the DomainCombiner was not accessible. This meant that the code executed with its code-based permissions only, and without any permissions additionally granted (or removed) based on the dynamic information. This is consistent with past behavior: code can always exercise its own permissions by calling doPrivileged.

This change introduces a variant of doPrivileged that preserves the current AccessControlContext's DomainCombiner. This would allow code to exercise the permissions granted to itself, and retain any additional permissions granted (or removed) based on the dynamic information in the DomainCombiner.

This change updates the following methods:

The following new methods have been added:

The RFE associated with this change is 4819194.

Security: Enhanced java.security.Policy to be provider-based

Previously, java.security.Policy implementations were not available from providers. This meant that security-aware applications could not access Policy implementations in the same way that they did other security services.

In particular, if an application wanted to set a specific Policy implementation as the system-wide security policy to be used during security checks (via Policy.setPolicy), it would need direct access to that implementation so the implementation could be instantiated and passed to the setPolicy call.

Cryptography-aware applications do not have to "bundle" their own cryptographic implementations. They can simply rely on cryptographic services configured into the Java runtime via providers.

Similarly, policy-aware applications should not have to bundle their own Policy implementations. They, too, should be able to access Policy implementations configured into the Java runtime via providers.

This change therefore makes java.security.Policy provider-based like other security classes, such as java.security.Signature and java.security.KeyStore.

Provider-based security classes have public static getInstance methods that allow applications to request an instance of a security implementation from a provider. Thes getInstance methods have been added to Policy.

Provider implementations of security services implement a standard SPI interface (like SignatureSpi, or KeyStoreSpi). A new java.security.PolicySpi class has been added.

This change adds the following methods:

The change also adds a new interface, java.security.Policy.Parameters. For java.security.Policy.UNSUPPORTED_EMPTY_COLLECTION and java.security.SecurityPermission (new target name) the new target name, "createPolicy" has been added. This permission is checked when Policy.getInstance() is called.

JavaPolicy is a new standard type name that can be passed to Policy.getInstance.

The RFE associated with this change is 5100561.

Security: X500Principal allows users to specify additional keywords

Previously, the javax.security.auth.x500.X500Principal class recognized and emitted a fixed set of distinguished name attribute type keywords. All other attribute types had to be specified as object identifiers. The 500Principal class could not be used to parse domain names, such as those generated by other toolkits or protocols, that contain keywords outside of this fixed set.

An new constructor and a new method have been added to the X500Principal class to allow users to specify additional attribute type keyword/object identifier mappings.

This change adds the following method and constructor:

The RFE associated with this change is 6181936.

Security: Subject.doAs* methods now support Generics

This change updates Subject.doAs* methods to use generics.

This change affects the following javax.security.auth.Subject methods:

The RFE associated with this change is 6219304.

Security: Standard behavior for incorrect KeyStore passwords defined

Previously, it was not possible to clearly distinguish KeyStore errors that resulted from incorrect passwords from other errors, such as corrupted or unsupported files.

This change updates KeyStore methods to define the new exception java.security.UnrecoverableKeyException when KeyStore passwords are incorrect. It updates the java.security.KeyStore.load() and KeyStore.getEntry() specifications to explicitly define the new behavior and mention UnrecoverableKeyException. The exception java.security.KeyStore.load

  • java.security.KeyStore.getEntry
  • java.security.KeyStoreSpi.engineLoad
  • java.security.KeyStoreSpi.engineGetEntry
  • The bug report associated with this change is 6236533.

    Security: Configuration class is now provider-based

    Security providers make a wide range of security services available to applications. Such services include cryptographic services, secure random number generation, and key storage.

    Previously, LoginModule Configuration implementations were not available from providers. This meant that LoginModule-aware applications could not access Configuration implementations as they did other security services.

    In particular, if an application wanted to set a specific implementation as the system-wide Configuration (via Configuration.setConfiguration), it would need direct access to that implementation so the implementation could be instantiated and passed to the setConfiguration call.

    Today, cryptography-aware applications do not have to "bundle" their own cryptographic implementations. They can simply rely on cryptographic services configured into the Java runtime via providers.

    The class javax.security.auth.login.Configuration has been made provider-based, like other security classes, such as java.security.Signature and java.security.KeyStore.

    Provider-based security classes have public static getInstance methods that allow applications to request an instance of a security implementation from a provider. Such getInstance methods have been added to Configuration.

    Provider implementations of security services implement a standard SPI interface (like SignatureSpi, or KeyStoreSpi). A new javax.security.auth.login.ConfigurationSpi class has also been added.

    This change adds the following methods:

    This change also adds an new interface, javax.security.auth.login.Configuration.Parameters, as well as JavaLoginConfig, new standard type name that can be passed to Configuration.getInstance, and javax.security.auth.AuthPermission, a new createConfiguration.{type} target name.

    The RFE associated with this change is 6268315.

    Security: New shared URIParameter class

    The Policy class defines a URLParameter that implements Policy.Parameters (a marker interface). The Configuration class defines an essentially identical URIParameter, that implements Configuration.Parameters (also a marker interface).

    A single common java.security.URIParameter class has been created that implements both Policy.Parameters and Configuration.Parameters.

    The bug report associated with this change is 6273835.

    VM/Classloader

    VM: JNI function to validate a jobject pointer

    Previously, there was no way for a native program to determine the type of a JNI Handle in native code.

    The function GetObjectRefType has been added for this purpose.

    The RFE associated with this change is 4725563.

    XML

    The specification changes in Java SE 6 Beta related to the JAXP API are covered in a separate maintenance review of JSR 206.


    User Interface

    2D

    2D: Font class accepts all text attributes, including underline

    Previously, in order to render text with most text attributes such as underline, strikethrough, and background colors, it was necessary to use the more complex TextLayout or AttributedCharacterIterator APIs, rather than the more familiar Graphics.drawString APIs.

    This change updates java.awt.Font.hasLayoutAttributes to accept all text attributes, and drawString will now automatically handle these.

    The bug report associated with this change is 4296952.

    2D: Provided a writer plug-in for the GIF file format

    Previously, Java SE provided GIF image reading support, but no GIF image writer was provided. This change adds a GIF image writer as an ImageIO plugin in the javax.imageio package.

    The RFE associated with this change is 4339415.

    2D: Added kerning to the text layout process

    Previously, font kerning was not supported. This change adds new text attributes to the java.awt.font.TextAttribute class to optionally control kerning, (Latin) ligature, and tracking for the text layout. Clients who desire this additional functionality can request it by applying these attributes when rendering.

    The new text attributes are the following:

    The RFE associated with this change is 4339577.

    2D: Added API to calculate PageFormat from PrintRequestAttributeSet

    Developers may need to create a PageFormat from a PrintRequestAttributeSet which holds attributes describing the page format as Media, printable area, and orientation attributes.

    This change adds a method to the PrinterJob class that uses the information in a client-supplied PrintRequestAttributeSet to calculate a PageFormat instance which is consistent with the PrintRequestAttributeSet and the printer settings.

    The new method is java.awt.print.PrinterJob.getPageFormat.

    The RFE associated with this change is 4500750.

    2D: IndexColorModel methods no longer throw ArrayIndexOutOfBoundsException

    Previously, IndexColorModel was not well specified and getRGB() and similar methods would throw ArrayIndexOutOfBoundsException if a client supplied an out of range pixel value. This change updates the specification to use only the valid bits in the pixel value.

    Changes have been made to 6 methods in the java.awt.image.IndexColorModel class.

    The bug report associated with this change is 4526227.

    2D: Added support for LCD optimized anti-aliased text (sub-pixel resolution)

    Previously, there was no way for a client to specify LCD text subpixel anti-aliasing modes that are in common use in modern desktop evironments. This change added new java.awt.RenderingHints values for these modes and updated the java.awt.font.FontRenderContext class to accept them.

    The RFE associated with this change is 4726365.

    2D: Added API for obtaining outlines of GraphicAttribute

    Previously, TextLayout's getOutline API did not provide a way to obtain the outlines of the GraphicAttributes that might be applied to its text. This change added an API which can return the actual shape used.

    The new methods are the following:

    The RFE associated with this change is 4924708.

    2D: Added a method to FontMetrics to get the FontRendererContext

    Previously it was not possible to discover the FontRenderContext that a FontMetrics object was using to measure text. This change added the java.awt.FontMetrics.getFontRenderContext method to return the FontRenderContext to clients.

    The RFE associated with this change is 4947324.

    2D: IllegalArgumentException if a program specifies a print output file that cannot be written to

    Previously, if a client specified to PrintJob a destination file for print output that was a directory, the behaviour was not well specified. This change updates the specification to throw IllegalArgumentException.

    The change is made to the method java.awt.Toolkit.getPrintJob(Frame frame, String jobtitle, JobAttributes jobAttributes, PageAttributes pageAttributes).

    The bug report associated with this change is 4973278.

    2D: Added methods to AffineTransform for rotation by a vector or by a number of quadrants

    Previously, AffineTransform provided only methods to rotate in radians, so clients had to perform expensive computations, and could not precisely specify some rotations. This change adds new methods which allow clients to specify rotation by a vector or a number of quadrants.

    New vector rotation methods and quadrant rotation methods have been added to the java.awt.geom.AffineTransform class.

    The RFE associated with this change is 4980035.

    2D: Added the method AffineTransform.invert() to perform matrix inversion in place

    Previously, the only method that AffineTransform provided for creating an inverted version of the transform was createTransform(). This method required the creation of a second AffineTransform object, which was not always needed.

    This change adds the new method java.awt.geom.AffineTransform.invert() to perform the operation in place.

    The RFE associated with this change is 4987374.

    2D: Added constants (final static fields) for logical font names

    This change added new String constants to the class java.awt.Font for each of the 5 logical fonts. This is a convenience to developers to reduce the risk of misspellings.

    The RFE associated with this change is 5029074.

    2D: Added a new value for specifying a preferred anti-aliasing mode

    Previously, there was no way for a client to specify a text anti-aliasing (smoothing) mode that corresponded to a font's preferred anti-aliasing mode for a point size. This change added a new value for the existing text anti-aliasing hint. This value is java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_GASP.

    The RFE associated with this change is 5057760.

    2D: Added methods in AlphaComposite to derive new instances by rule or extra alpha

    AlphaComposite objects are immutable. Therefore, previously, if a client wanted a new AlphaComposite object derived from an existing one, it was necessary to construct a new one and copy over all attributes. This change adds new methods to AlphaComposite to directly derive new instances with a diffrent alpha value or composite rule.

    The new methods are the following:

    The RFE associated with this change is 5095630.

    2D: Documented behavior of methods in Graphics and Graphics2D classes for invalid arguments

    Previously it was not specified how the drawString, drawChars, and drawBytes methods of the Graphics classes behaved for invalid arguments and out of bounds. This change updates the specification to document this behavior in the classes java.awt.Graphics and java.awt.Graphics2D.

    The bug report associated with this change is 6178753.

    2D: Corrected RoundRectangle2D, Ellipse2D, Arc2D to override equals and hashCode

    Previously, the RoundRectangle2D, Ellipse2D, and Arc2D classes did not override the default equals and hashcode methods, as do most other simple geometric shapes. With this change, the classes override those methods.

    The following methods have changed:

    The bug report associated with this change is 6210287.

    2D: New method to allow recreation of a created font by all Font construction APIs

    Previously, new instances of the Font class that were created by the Font.createFont API were available only by calling deriveFont. This change adds the new method java.awt.GraphicsEnvironment.registerFont(java.awt.Font) that allows such Fonts to be made available for construction by all Font construction APIs.

    In addition, notes have been added to the methods java.awt.Font.createFont(int,File) and java.awt.Font.createFont(int,InputStream) to direct the developer to the new method.

    The RFE associated with this change is 6245665.

    2D: New methods in FontRenderContext for determining the type of transform without creating a copy

    Previously, it was possible to determine the type of transform associated with a FontRenderContext object only by obtaining a copy of the transform. This change adds new methods to FontRenderContext for more directly determining the type of transform.

    The new methods are the following:

    The RFE associated with this change is 6267637.

    2D: Added a method to TextLayout to get the pixel bounds

    Previously there was no way for a client to determine in all cases the exact pixels which would be touched by text rendering. This change adds the method java.awt.font.TextLayout.getPixelBounds to obtain the precise pixel bounds.

    The RFE associated with this change is 6271221.

    2D: New method in TextLayout to allow interconverting between baseline and standard measurement for rotation

    Clients can render rotated text either by applying a rotation transform to a Graphics instance or to a Font instance. In the latter case text metrics (measurements of the height, length of the text) behavior was underspecified and generating inconsistent and useless results.

    This change clarifies measurement relative to the baseline as distinct from measurement in standard x,y coordinates. It also adds the new method java.awt.font.TextLayout.getLayoutPath() to TextLayout to return information about the baseline so that the user can interconvert between these if necessary.

    Clarification has been added to the following:

    The RFE associated with this change is 6271315.

    2D: New DesktopProperty key to get desktop font smoothing (text anti-aliasing) settings

    This change adds a new DesktopProperty key, awt.font.desktophints, which may be read by applications to inform them of the font smoothing settings of the end user desktop environment.

    The RFE associated with this change is 6288260.

    2D: New constructor in the Font class to create a new subclass instance derived from an existing Font

    Previously there was no way for a subclass of Font to create a new subclass instance derived from an existing Font. This change adds a new constructor java.awt.Font.Font(java.awt.Font) to the Font class which provides this capability.

    The RFE associated with this change is 6313541.

    AWT

    AWT: Improved modality for AWT

    Initially AWT provided only one type of modality, which was application-wide. System-wide and document-wide modality types have been added in this release. In addition, the notion of modal exclusion has been added, to resolve some problems with some special windows, such as the JavaHelp window.

    This change affects the following classes:

    A new permission type, toolkitModality, has also been added to the AWTPermission class.

    The RFE associated with this change is 4080029.

    AWT: Speed improvements for splash screens for Java applications created using AWT

    Splash screens are a standard part of a modern GUI application. Their primary purpose is to provide feedback to the user that the application is starting up. We have added the ability to show a splash-screen even before the JVM is loaded. Users can specify the image which will be used for the splash-screen either by using a command-line option (the "-splash:" option) or by specifying it in the manifest of the JAR file. An API has also been added which allows users to manipulate this splash-screen after the JVM has started.

    This change adds the following class:

    The RFE associated with this change is 4247839.

    AWT: System-tray support added

    Modern desktops have a system tray or equivalent in which native applications can add icons to notify users of current actions, or to provide access to extra functionality for applications that do not have to be constantly visible in a main window on the desktop. A new API was added in this release to provide access to this functionality.

    This change adds the following classes:

    The RFEs associated with this change are 4310333 and 6271569.

    AWT: Minimum size for java.awt.Frame respected

    Previously, Component.setMinimumSize() did not actually prevent users from setting the size of a frame to a value less than that specified. In this release, Component.setMinimumSize() restricts setting the size of top-level windows to a value less than specified.

    This change adds the following methods:

    The java.awt.Window.reshape(int, int, int, int) method has been deprecated.

    The RFE associated with this change is 4320050.

    AWT: Location of MouseEvent added to screen coordinates

    During investigation of bug 4962534 it was found that it is necessary to know the location of a java.awt.event.MouseEvent not only in the parent coordinates, but also in the screen coordinates. By the time the mouse event is obtained and the position re-calculated via the component location and the mouse event location, the frame might already have moved. The data is required inside the mouse event, so frame coordinates have been modfied accordingly.

    The RFE associated with this change is 4992908.

    AWT: AWT can now detect whether always-on-top is supported

    Previously, Window.setAlwaysOnTop API was implemented in such a way that users were unable to tell whether their Window was set to always-on-top or not.

    The following new methods have been added to solve this problem:

    The RFE associated with this change is 5007707.

    AWT: Specification restored for java.awt.Window and java.awt.Dialog setVisible() methods

    The API documentation for Window/Dialog.setVisible() has been updated, to restore the initially specified behavior for these methods.

    This change affects the following classes:

    The bug report associated with this change is 5047523.

    AWT: Clarified documentation on use of default toolkits

    Previously, the documentation on the use of default toolkits was overly specific and referred to a specific Sun toolkit implementation. The documentation has been changed to be more general.

    This change affects the following method:

    The RFE associated with this change is 5049146.

    AWT: API documentation for Component.requestFocus* methods updated

    The documentation for Component.requestFocus* methods required the Component on which the focus is requested to be displayable (assumes isDisplayable() returns true), visible (assumes isVisible() returns true), and focusable (assumes isFocusable() returns true). However, this requirement was not sufficient for the component to actually receive focus. To guarantee that the component can receive focus, all the component's ancestors (with the exception of the top-level Window) must be visible.

    This requirement has now been added to the API documentation for the following methods:

    The bug report associated with this change is 5091908.

    AWT: Windows placed in correct position onscreen

    Previously, there was a problem with specified behavior of java.awt.Window.setLocationRelativeTo() on multi-monitor configurations. The API documentation which describes behavior of this method has been clarified, for cases when the component parameter of this method is null or for invisible components.

    The bug report associated with this change is 6177452.

    AWT: API Documentation clarified for Window class

    Previously, it was stated in the API documentation for the java.awt.Window class that the window management system can modify or ignore requests for changing window geometry. In this release, the API documentation has been updated to state additionally that the window management system may subsequently change an invisible window's geometry when the window is made visible.

    The bug report associated with this change is 6234386.

    AWT: Correct behavior of fullScreenExclusive AWTPermission property in GraphicsDevice

    Previously the behavior of isFullScreenSupported() could return the wrong answer, since it did not account for necessary security permissions. This change corrects the behavior of isFullScreenSupported().

    This change affects the following methods:

    The bug report associated with this change is 6240507.

    AWT: New API to launch desktop helper applications

    Modern desktops provide some common services, such as a browser, mailer and editor. Native applications can make use of these facilities. For example, invoking the system's default browser to show a given URL, invoking the system's default mailer with or without specifying a mailto URL; invoking native applications associated with a particular file type to open, edit or print a given file, and so on. Java SE 6 now provides support to use these desktop services.

    This change affects the following classes and methods:

    The RFE associated with this change is 6255196.

    AWT: Support for changing cursor shape is not a requirement

    The specification of all setCursor() methods has been improved to clarify that these methods may have no visual effect if the Java platform implementation and/or the native system do not support changing the mouse cursor shape.

    This change affects the following methods:

    The bug report associated with this change is 6255992.

    AWT: TextField.setEchoChar now supports a limited set of echo characters

    Previously, the TextField API allowed users to set an arbitrary echo character. However, most native systems (such as GTK, QT and Windows) do not support custom echo characters. In this release, we have explicitly specified that Java platform implementations can only support a limited, non-empty set of echo characters. Attempts to set an unsupported echo character will cause the default echo character to be used instead. Subsequent calls to getEchoChar() will return the echo character originally requested. This might or might not be identical to the echo character actually used by the TextField implementation.

    The API documentation for the following method has been undated:

    The bug report associated with this change is 6268517.

    Swing

    Swing: Added a method to clear the selection of the ButtonGroup

    The ButtonGroup class is used to create a multiple-exclusion scope for a set of buttons. Initially, all buttons in the group are unselected. Once any button is selected, one button is always selected in the group. Previously, there was no way to turn a button programmatically to "off" in order to clear the button group.

    This change adds a new method which clears the selection of the ButtonGroup.

    New method javax.swing.ButtonGroup.clearSelection()

    The RFE associated with this change is 4066394.

    Swing: Extension of Action interface

    This change adds the following features to the javax.swing.Action interface:

    These enhancements are implemented in the following:

    The RFE and bug report associated with this change are 4133141 and 4626632.

    Swing: Corrected problem where setCursor did not work on JInternalFrame

    Previously, setCursor on JInternalFrame did not always work, for example, when the cursor was moved within the JInternalFrame but not near the border. With this change, the problem is corrected by overriding setCursor() in JInternalFrame.java to save the application cursor, adding a getLastCursor() method to JInternalFrame.java to get the last application cursor which was set, and overriding mouseEntered in BasicInternalFrameUI.java to update the cursor.

    The changes are the following:

    The bug report associated with this change is 4200535.

    Swing: Stretching JTable to fill the height of JScrollPane/JViewport

    Previously, unlike JTree and JList, JTable was not automatically stretched vertically to fill the entire viewport of a JScrollPane. This was because the getScrollableTracksViewportHeight() method was unconditionally returning false. This is important to developers when they want the table's background color to fill the viewport, or if they want to drag and drop data onto the table, because if there are no existing rows and the table is not stretched, there is nowhere to drop.

    This has been corrected by adding a new property, set/getFillsViewportHeight(), and changing getScrollableTracksViewportHeight() to check this property. If false, it will continue to return false (for backward compatibility). If true, JTable is stretched, the same as JTree and JList.

    The changed methods are the following:

    The bug report associated with this change is 4310721.

    Swing: Enhanced drop experience for Swing DnD

    This change enhances the support for accepting drops of data into components during Drag-and-Drop (DnD). Previously, a drop location was indicated by moving the selection around within the component under which DnD was occurring. This fired unnecessary selection events and was not customizable. There was no support for customizing what data could be inserted at what locations in the component. In addition, exceptions were being thrown for inappropriate reasons.

    With this change, the developer can specify one of a handful of new drop modes on components supporting drops. JList, JTable, JTree, and JTextComponent now have a setDropMode() method that takes a new DropMode type. This provides more flexibility on how data can be inserted, and the drop locations are indicated without affecting selection. Drop locations are calculated based on the drop mode, to be returned to the developer during DnD.

    Two methods in TransferHandler, canImport() and importData(), have been overloaded with new versions that take a new TransferInfo object containing the needed details of the transfer. By default, these new methods call the old versions.

    In addition, a new method, shouldIndicate(), has been added to TransferHandler to allow for further customization of when to show the drop location.

    Finally, the internal implementation has been redesigned to eliminate the unnecessary exceptions.

    The following changes have been made to support the new Swing Drag-and-Drop API:

    The method TransferHandler.TransferInfo.getDropAction() is not used and has been removed.

    The method TransferHandler.shouldIndicateAnyway() was previously called only to allow the developer to have the component indicate the drop location when canImport() returned false. However, the method should also allow the developer to NOT show the drop location when canImport() is true. Therefore, the method has been renamed to shouldIndicate() and should be called for every import.

    The new signature for the renamed method is boolean shouldIndicate(TransferInfo info, canImport boolean). The canImport boolean represents the return value from the previous call to canImport(). By default this method simply returns that boolean so that the drop location is indicated only if canImport() is true.

    The renamed method is javax.swing.TransferHandler.shouldIndicate(TransferInfo, boolean).

    The following classes have been affected:

    The following methods have been affected:

    The RFEs and bug reports associated with this change are 4468566, 4942851, 6277499, 6315298, 6331837, and 6344471.

    In addition, the following RFEs have been addressed by this feature (some with multiple duplicates):

    Swing: Use arbitrary (J)Components as JTabbedPane tab labels

    Previously, tabs in JTabbedPane could contain only an icon, text, or html. Many applications, such as Mozilla, support a richer user experience with components (such as close buttons) in tabbed panes. This ability was not previously available in Swing.

    With this release you can add arbitrary Components to a tabbed pane, enabling you, for instance, to have a text label and close button on each tab.

    Three new methods have been added to the javax.swing.JTabbedPane class:

    In addition, JTabbedPane places the tab components correctly.

    The RFE and bug report associated with this change are 4499556 and 6252222.

    Swing: TransferHandler: Data may be dragged and dropped anywhere within the frame

    Many applications allow for the import of data by dragging the data and dropping it anywhere within the frame. Previously, with Swing you had to create your own drop support. The Swing TransferHandler has been modified to add this support.

    With this change, the set/getTransferHandler methods have been added to JFrame, JDialog, JWindow, and JApplet.

    The new methods are the following:

    The RFE associated with this change is 4519484.

    Swing: Drag gesture is now a single click to both select and start drag

    In the previous Swing implementation of Drag and Drop, users were required to first click on an item to select it and then press again on the same item before they could begin a drag operation. With this change, users need only a single press to both change selection and start a drag.

    The following methods have been changed:

    The bug report associated with this change is 4521075.

    Swing: Segment implements CharSequence

    Previously, in many places where java.lang.CharSequence could be used, users had to create String out of Segment. Creating new objects is a performance hit. With this change, javax.swing.text.Segment implements java.lang.CharSequence.

    The changes are the following:

    The RFE associated with this change is 4628641.

    Swing: Ctrl-Shift-Click correctly extends the selection interval in a list

    With Swing, the Shift-Click gesture extends the selection from the previously selected item, and the Ctrl-Click gesture extends extends the selection by clearing other disjoint selections. The Ctrl-Shift-Click gesture was expected to extend the selection without clearing other disjoint selections, but in fact Ctrl-Shift-Click was identical to Ctrl-Click.

    For example, in a list with five items, if you clicked "one" in the list, then Ctrl-Click on "three" and Ctrl-Shift-Click on "five," the expected selection would be one, three, four, and five. However, one, three, and five were selected, but four was not.

    With this change, the Ctrl-Shift-Click gesture behaves as expected, that is, it extends the selection from the previously selected item without clearing the disjoint selections.

    The following method has been changed:

    The RFE associated with this change is 4656461.

    Swing: SwingWorker included with the JDK

    To effectively create some Swing applications the developer needs to use multiple threads. SwingWorker eases using multi-threaded programming with Swing. A new class javax.swing.SwingWorker has been added to JDK.

    The RFE associated with this change is 4681682.

    Swing: SpringLayout constraint resolution improved

    SpringLayout allows developers to specify three Springs along each axis that dictate the size and position of a component. Only two Springs are needed along each axis, the third is derived. Previously, when developers specified three springs the layout was considered overly constrained and one of the springs was dropped. In this release, SpringLayout now maintains the order in which springs have been set. As a result, specifying springs is no longer order-dependent. In addition, support for centering, and aligning along the baseline has been added.

    This change affects the following classes:

    The RFE associated with this change is 4726194.

    Swing: Printing support added for text components

    This change adds printing support for Swing's text components.

    The following new methods have been added:

    The RFE associated with this change is 4791649.

    Swing: Full double buffering per window

    Previously, there was a noticable delay between the time a window was unobscured and the time the window painted.

    Swing now provides true double buffering so that when a window is exposed the contents of the back buffer can be directly copied to the screen. This enables more responsive applications, a better user experience, and better performance on some platforms.

    Each window maintains an offscreen buffer that remains synchronized with that of the onscreen window. Any time the window is unobscured, Swing copies from the back buffer directly to the screen.

    In addition, two new methods in RepaintManager allow Swing to manage painting for any heavyweight components in the Swing package (JWindow, JDialog, JApplet, JFrame).

    The following methods have been changed or added:

    The RFE associated with this change is 4967886.

    Swing: Ability to set icons for file view icons and navigation buttons

    Developers can now set icons for file view icons (for example, floppy, harddrive, computers, folders, and files) and navigation buttons (for example, up, home, new folder, list view, and details view).

    Several new properties have been added in the Synth file format to the declaration of JFileChooser specific properties in the Component Specific Properties specification. The file format is supported by javax.swing.plaf.synth.SynthLookAndFeel.

    The new properties are the following:

    The RFE associated with this change is 4972060.

    Swing: Included screen coordinates in MouseEvent

    Under some circumstances, it is very valuable to know the position of a MouseEvent in screen co-ordinates rather than the co-ordinates of the component receiving the event. Therefore, the screen coordinates have been included in MouseEvent in order to modify the frame coordinates accurately.

    The following new methods have been added:

    A new constructor creates MouseEvent with absolute coordinates:

    Two new constructors have been added to both MouseWheelEvent and MenuDragMouseEvent to allow these classes to correctly create events that handle screen coordinates:

    The RFE associated with this change is 4992908.

    Swing: JFileChooser now displays wait cursor when getting directory listing

    Sometimes getting a directory listing for a particular directory takes long time, especially when it is on a network. Previously, no indication was displayed to the user that a long operation was running.

    A listener interface has been added to javax.swing.plaf.basic.BasicDirectoryModel class in order for JFileChooser to display a wait cursor while the model runs a thread reading the contents of a directory. Standard Java Beans style methods have been added to javax.swing.plaf.basic.BasicDirectoryModel for registering java.beans.PropertyChangeListener instances, which are notified when the model's busy state changes.

    The following methods have been added:

    The bug report associated with this change is 5010850.

    Swing: AccessibleJTableCell methods changed from private to protected

    Two methods in javax.swing.JTable.AccessibleJTable.AccessibleJTableCell (javax/swing/JTable.html) have been changed from private to protected so that the user can extend the class correctly. With this change, the user can provide accessibility for cell-specific editors and renderers for JTable.

    This change was necessary so that JTable subclasses that need to extend AccessibleJTableCell are compliant with Section 508 requirements.

    The two methods that are now protected are:

    The RFE associated with this change is 5031758.

    Swing: Added set and get methods to Timer to support changing the action command string

    The javax.swing.Timer class provides notification of each timer tick by way of an ActionEvent sent to its ActionListeners. ActionEvent provides the ability to tag the event with an action command string. This allows for an ActionListener to distinguish between different types of commands that it might be listening to. In order to support this, some sources of ActionEvents have an API to support setting this command String, for example, AbstractButton.setActionCommand().

    However, previously, Swing's Timer class provided no means for a user to set the action command String for events that it fires. The command String was always null.

    The following set and get methods have been added to Timer to support changing the action command string:

    The RFE associated with this change is 5032517.

    Swing: Added orientation support in SynthPainter for all orientation-capable Swing components

    Several Swing components can have different orientations (mostly vertical and horizontal, like for JScrollBar). Some skins may want to provide different styles for each orientation, but previously Synth did not provide a way to skin components according to their orientation.

    SynthPainter has been modified to add versions of all orientation-capable Swing components, with an extra orientation parameter. The Synth file format was also changed to allow the direction attribute of the elements <painter /> and <imagePainter /> to support top, left, bottom, and right.

    Lastly, as part of the implementation, javax.swing.plaf.basic.BasicToolBarUI.DragWindow has a new getOrientation() method.

    The RFE associated with this change is 5033822.

    Swing: Loading SynthStyle and its resources from any URL

    Previously, loading a Synth look and feel could be done only from an input stream, using a Class to resolve resources paths.

    This new feature allows loading from a local file, a JAR file, or a remote location (HTTP server, for instance).

    The SynthLookAndFeel class now has a new method to load a look and feel from an arbitrary URL. This new method is:

    The RFE associated with this change is 5056424.

    Swing: Improved documentation for JDialog.setDefaultCloseOperation()

    The documentation for JDialog.setDefaultCloseOperation() has been improved. In addition, to be more in line with its JFrame counterpart, the method now fires a property change and throws an IllegalArgumentException for bad arguments.

    The following method has been changed:

    The bug report associated with this change is 5109681.

    Swing: Synth enhancements: case insensitive; minimum size; centering an image

    The following enhancements have been added to the Synth package:

    The changes have been made to the Synth file format and DTD synth.dtd.

    The RFE associated with this change is 6184909.

    Swing: Added JComponent method to detect when painting is part of print operation

    Previously, developers had no easy way to customize certain aspects of their printouts. For example, a developer might have a table with alternating row colors but would not want these colors in printed output. There needed to be a way for the renderers to know that printing was going on.

    The JTable class does its printing through the JComponent.print(Graphics) method. A public final getter, isPaintingForPrint() has been added to JComponent to make this information available. This is a bound property, and notification is sent out when it is changed. The property is useful for any component when it needs to detect if a particular paint operation resulted from a call to JComponent.print(Graphics).

    The documentation for other methods has been changed to explain the new flag and how it can be used to customize printing.

    The new and changed methods are the following:

    The bug reports associated with this change are 6194767 and 6260638.

    Swing: Ability to get baseline for components

    To create a professional layout components need to be aligned on their baseline. Therefore, the ability to get the baseline has been added for the components that render text.

    The methods getBaseline() and getBaselineResizeBehavior() have been added to java.awt.Component. JComponent overrides these and forwards to the appropriate UI classes, which override these methods to return the baseline. GridBagLayout and FlowLayout have been given new a API to align the components along their baseline.

    The following classes have changed:

    The following methods have been added or changed:

    The RFE associated with this change is 6237146.

    Swing: Ability to get preferred padding between components

    Each look and feel provides guidelines as to how far apart components should be placed. In order to create a cross-platform look and feel, an API has been added for determining preferred spacing between components.

    A new class, javax.swing.LayoutStyle, has been added. LayoutManagers can use this class to determine the ideal amount of space to place between components. Look-and-feel authors can provide a custom LayoutStyle by overriding the LookAndFeel method getLayoutStyle().

    The changes are the following:

    The RFE associated with this change is 6237199.

    Swing: Added API to SwingPropertyChangeSupport to notify listeners on EDT

    One of the most frequent ways to update the UI is through bound properties (PropertyChange notifications and listeners). When PropertyChangeListener needs to update the Swing UI, this update should happen on the Event Dispatch Thread (EDT). Previously, developers used SwingUtilities.invokeLater(Runnable), or similar mechanism, to invoke the listerner, but this unnecessarily complicated the source code and created a new Runnable object each time.

    With this change, a new functionality has been added to the javax.swing.event.SwingPropertyChangeSupport utility class to ensure that listeners are notified on the Event Dispatch Thread.

    The RFE associated with this change is 6254165.

    Swing: Added the ability to set a line style property in Synth file format

    With this change the user has the ability to set a line style property, for example, dashed lines, in Synth file format for drawing the connector lines for JTree. The API and Synth file format have been updated to support a Tree.lineStyle property.

    The changes are the following:

    The RFE associated with this change is 6258272.

    Swing: Multiple painters for the same arguments

    Previously, Synth's file format allowed only one painter with the same arguments. For some look-and-feels you need to overlay multiple painters. This change to the Synth file format provides the ability to specify multiple painters per argument. When several identical painters are declared, they are now aggregated into a single one. Two painters are identical if their direction and method attributes values are equal.

    Painter aggregation, or multi-layering, is very useful to reuse elements. For example, to use a highlight effect on buttons and on selected menu items, you only need to create a separate highlighting painter instead of having buttons and menu items painters handle it.

    The file format is supported by javax.swing.plaf.synth.SynthLookAndFeel.

    The RFE associated with this change is 6278565.

    Swing: JDialog supports true parent-less mode

    Previously, Swing used a hidden shared frame as an owner for all parentless JDialogs. Now that AWT allows true parent-less Dialogs, Swing needed to allow the creation of true parentless JDialogs.,

    With this change you can now pass null to the JDialog(Window) or JDialog(Dialog) constructor to create a parent-less JDialog. In addition, a createDialog(String) method was added to JOptionPane to allow creating parentless JOptionPanes.

    Changes have been made in the following classes:

    The bug reports associated with this change are 6300062 and 6338269.

    Swing: Sorting ability added to JTable

    Sorting and filtering API was added to JTable. Sorting can now be enabled by specifying a RowSorter on JTable. For example, the following line turns on sorting:

    table.setRowSorter(new TableRowSorter(model)); 

    Filtering can be added using a RowFilter. Implementations exist for filtering on numbers, dates and strings.

    This change affects the following classes:

    The RFEs associated with this change are 4747079 and 6316493


    Native Interfaces for Tools

    JDWP

    Note: Detailed information for JDWP is located in the Java Debug Wire Protocol (JDWP) specifications.

    JDWP: Added return value to Method Exit events

    Debuggers would like to be able to display the value that will be returned from a method when a MethodExitEvent is received. This change adds a new event: JDWP.EventKind: METHOD_EXIT_WITH_RETURN_VALUE

    The RFE associated with this change is 4195445.

    JDWP: Added events for contended monitor enter/exit

    Debuggers would like to track when Monitors are entered. This allows them to detect deadlocks. This change adds four new events:

    The RFE associated with this change is 4401399.

    JDWP: ClassPrepareEvents can be filtered by source filename

    Debuggers can now filter ClassPrepareEvents by source filename so that they can just get these events for classes originating from particular files, for example a particular .jsp file in which a user wants to set a breakpoint. This change adds new commands to allow this filtering:

    The RFE associated with this change is 4836939.

    JDWP: Access to the Constant Pool permitted

    Debuggers need to be able to access the Constant Pool for various reasons. This change adds the following commands to allow this:

    The RFE associated with this change is 5024104.

    JDWP: Instances and counts of instances can be obtained

    This change allows a debugger to display information about objects in the heap. It adds the following new commands:

    The RFE associated with this change is 5024119.

    JDWP: Objects that reference objects can be obtained

    This is a companion change to 5024119. It allows a debugger to find objects that reference specific objects. This change adds one command:

    The RFE associated with this change is 5089849.

    JDWP: Added ability to force a method to return prematurely

    It is sometimes useful for a debugger user to be able to skip the remainder of a method and force the method to return from the current BCI, with a specific return value. This change adds a command to do this:

    The RFE associated with this change is 6175634.

    JDWP: Access to the frame in which a monitor was locked now permitted

    Debuggers are now able to find the stack where a monitor was acquired. This allows deadlock detection and visualisation. This change adds a new command:

    The RFE associated with this change is 6230699.

    JVMTI

    Note: Detailed information for JVMTI is located in the Java Virtual Machine Tool Interface (JVM TI) specifications.

    JVMTI: Access to constant pool added

    JVMTI clients need to be able to access the constant pool for various reasons. This change adds the following new function:

    jvmtiError GetConstantPool (jvmtiEnv* env,
                                      jclass klass,
                                      jint* minor_version_ptr,
                                      jint* major_version_ptr,
                                      jint* constant_pool_count_ptr,
                                      jint* constant_pool_byte_count_ptr,
                                      unsigned char** constant_pool_bytes_ptr)
    				  

    The RFE associated with this change is 4146774.

    JVMTI: Multiple independent instrumenting agents now permitted

    More than one tool can now instrument classes at the same time, and it is also possible to remove instrumentation safely. This change adds a new function (and the related capability):

    Also, the transform facilities (JVM TI ClassFileLoadHook) have added documentation describing the order of transformations. References to retransformation have been added in several places and some of the documentation has been refactored.

    The RFE associated with this change is 4772582.

    JVMTI: GetCurrentThread added

    Clients need to be able to determine the current thead. This change adds a new function:

    The RFE associated with this change is 4960412.

    JVMTI: Ability to add .jar files to a classpath

    Agents need to be able to add .jar files containing their Java Language code to the classpaths dynamically.

    This change includes the following enhancements:

    The RFE associated with this change is 6173575.

    JVMTI: Allow an agent to be started during the "live phase"

    A VM may support a mechanism that allows agents to be started in the VM during the live phase. The details for how this is supported are implementation-specific. For example, a tool may use a platform-specific mechanism or an implementation-specific API to attach to the running VM and request the VM start a given agent.

    If an agent is started during the live phase, then it must export a start-up function with the following prototype:

    The RFE associated with this change is 6173612.

    JVMTI: Enhancements to heap iteration

    Profilers can now display the value of important or representitive primitive values which are on the heap:

    In addition, profilers can get information about objects that reference a particular object without tagging the entire heap, which can be expensive. This change adds two functions:

    jvmtiError FollowReferences(jvmtiEnv* env,
                                       jint heap_filter,
                                       jclass klass,
                                       jobject initial_object,
                                       const jvmtiHeapCallbacks* callbacks,
                                       const void* user_data)
    jvmtiError IterateThroughHeap(jvmtiEnv* env,
                                         jint heap_filter,
                                         jclass klass,
                                         const jvmtiHeapCallbacks* callbacks,
                                         const void* user_data)

    Corresponding callbacks, information structures, and constants have also been added.

    The RFE associated with this change is 6195957.

    JVMTI: Early return from methods supported

    It is sometimes useful for a debugger user to be able to skip the remainder of a method and force the method to return from the current BCI, with a specific return value. This change adds a function to do this for each return type:

    The RFE associated with this change is 6216027.

    JVMTI: Access to the frame in which a monitor was locked

    This release allows users to determine where on the stack monitors were acquired. This allows deadlock detection and visualisation This change adds a new function:

    jvmtiError GetOwnedMonitorStackDepthInfo(jvmtiEnv* env,
                                                     jthread thread,
                                                     jint* monitor_info_count_ptr,
                                                     jvmtiMonitorStackDepthInfo** monitor_info_ptr)
    
    

    The RFE associated with this change is 6230707.

    JVMTI: Support for instrumenting native methods

    Bytecode instrumentation cannot be used to find out information about native methods. This change allows a native method to be wrapped in a Java language wrapper which can then be instrumented. This change adds two functions:

    jvmtiError SetNativeMethodPrefix(jvmtiEnv* env,
                                             const char* prefix)
    jvmtiError SetNativeMethodPrefixes(jvmtiEnv* env,
                                               jint prefix_count,
                                               char** prefixes)
    
    

    The RFE associated with this change is 6263317.

    JVMTI: Updated the JVMTI spec to version 1.1

    In this release, minorversion="0" has been changed to minorversion="1".

    The RFE associated with this change is 6263703.


    Deployment

    Deployment: Update of JNLP Specification for Java SE 6

    A JNLP (Java Network Launching Protocol) Client is an application or service that can launch applications on a client system from resources hosted across the network.

    JNLP is an optional component that may be delivered with Java SE. The JNLP specification is described in JSR 56.

    The RFEs associated with this change are 6250176 and 6298124.


    Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.

    Sun