# HG changeset patch # User lana # Date 1348083714 25200 # Node ID 9a7055463e0677308e6439bfc144ce682a466bf1 # Parent 539a1187467ac91d2d422eb6fa8132ac91d5ff0f# Parent 0b0453f12ab25ca24ee5281e7cb11127a368d42f Merge diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java --- a/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Wed Sep 19 12:41:54 2012 -0700 @@ -883,7 +883,7 @@ avHiBits &= (1L< defMap = allLayouts.get(i); - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) Map.Entry[] layoutsAndCounts = new Map.Entry[defMap.size()]; defMap.entrySet().toArray(layoutsAndCounts); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java Wed Sep 19 12:41:54 2012 -0700 @@ -32,14 +32,15 @@ import com.sun.jmx.remote.util.EnvHelp; -import java.beans.ConstructorProperties; import java.io.InvalidObjectException; +import java.lang.annotation.Annotation; import java.lang.annotation.ElementType; import java.lang.ref.WeakReference; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.GenericArrayType; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.ParameterizedType; @@ -1129,14 +1130,56 @@ to getters. */ private static final class CompositeBuilderViaConstructor extends CompositeBuilder { + static class AnnotationHelper { + private static Class constructorPropertiesClass; + private static Method valueMethod; + static { + findConstructorPropertiesClass(); + } + + @SuppressWarnings("unchecked") + private static void findConstructorPropertiesClass() { + try { + constructorPropertiesClass = (Class) + Class.forName("java.beans.ConstructorProperties", false, + DefaultMXBeanMappingFactory.class.getClassLoader()); + valueMethod = constructorPropertiesClass.getMethod("value"); + } catch (ClassNotFoundException cnf) { + // java.beans not present + } catch (NoSuchMethodException e) { + // should not reach here + throw new InternalError(e); + } + } + + static boolean isAvailable() { + return constructorPropertiesClass != null; + } + + static String[] getPropertyNames(Constructor constr) { + if (!isAvailable()) + return null; + + Annotation a = constr.getAnnotation(constructorPropertiesClass); + if (a == null) return null; + + try { + return (String[]) valueMethod.invoke(a); + } catch (InvocationTargetException e) { + throw new InternalError(e); + } catch (IllegalAccessException e) { + throw new InternalError(e); + } + } + } CompositeBuilderViaConstructor(Class targetClass, String[] itemNames) { super(targetClass, itemNames); } String applicable(Method[] getters) throws InvalidObjectException { - - final Class propertyNamesClass = ConstructorProperties.class; + if (!AnnotationHelper.isAvailable()) + return "@ConstructorProperties annotation not available"; Class targetClass = getTargetClass(); Constructor[] constrs = targetClass.getConstructors(); @@ -1145,7 +1188,7 @@ List> annotatedConstrList = newList(); for (Constructor constr : constrs) { if (Modifier.isPublic(constr.getModifiers()) - && constr.getAnnotation(propertyNamesClass) != null) + && AnnotationHelper.getPropertyNames(constr) != null) annotatedConstrList.add(constr); } @@ -1174,8 +1217,7 @@ // so we can test unambiguity. Set getterIndexSets = newSet(); for (Constructor constr : annotatedConstrList) { - String[] propertyNames = - constr.getAnnotation(propertyNamesClass).value(); + String[] propertyNames = AnnotationHelper.getPropertyNames(constr); Type[] paramTypes = constr.getGenericParameterTypes(); if (paramTypes.length != propertyNames.length) { diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/management/VMOption.java --- a/jdk/src/share/classes/com/sun/management/VMOption.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/management/VMOption.java Wed Sep 19 12:41:54 2012 -0700 @@ -178,7 +178,7 @@ return "VM option: " + getName() + " value: " + value + " " + " origin: " + origin + " " + - (writeable ? "(read-only)" : "(read-write)"); + (writeable ? "(read-write)" : "(read-only)"); } /** diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/Init.java Wed Sep 19 12:41:54 2012 -0700 @@ -153,8 +153,8 @@ break; } } - for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) { - if (!(el instanceof Element)) { + for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) { + if (el.getNodeType() != Node.ELEMENT_NODE) { continue; } String tag=el.getLocalName(); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/c14n/implementations/CanonicalizerBase.java Wed Sep 19 12:41:54 2012 -0700 @@ -205,7 +205,7 @@ try { NameSpaceSymbTable ns=new NameSpaceSymbTable(); int nodeLevel=NODE_BEFORE_DOCUMENT_ELEMENT; - if (rootNode instanceof Element) { + if (rootNode != null && rootNode.getNodeType() == Node.ELEMENT_NODE) { //Fills the nssymbtable with the definitions of the parent of the root subnode getParentNameSpaces((Element)rootNode,ns); nodeLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT; @@ -335,7 +335,7 @@ return; sibling=parentNode.getNextSibling(); parentNode=parentNode.getParentNode(); - if (!(parentNode instanceof Element)) { + if (parentNode !=null && parentNode.getNodeType() != Node.ELEMENT_NODE) { documentLevel=NODE_AFTER_DOCUMENT_ELEMENT; parentNode=null; } @@ -391,7 +391,7 @@ return; boolean currentNodeIsVisible = false; NameSpaceSymbTable ns=new NameSpaceSymbTable(); - if (currentNode instanceof Element) + if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) getParentNameSpaces((Element)currentNode,ns); Node sibling=null; Node parentNode=null; @@ -512,7 +512,7 @@ return; sibling=parentNode.getNextSibling(); parentNode=parentNode.getParentNode(); - if (!(parentNode instanceof Element)) { + if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) { parentNode=null; documentLevel=NODE_AFTER_DOCUMENT_ELEMENT; } @@ -594,18 +594,14 @@ final void getParentNameSpaces(Element el,NameSpaceSymbTable ns) { List parents=new ArrayList(10); Node n1=el.getParentNode(); - if (!(n1 instanceof Element)) { + if (n1 == null || n1.getNodeType() != Node.ELEMENT_NODE) { return; } //Obtain all the parents of the elemnt - Element parent=(Element) n1; - while (parent!=null) { - parents.add(parent); - Node n=parent.getParentNode(); - if (!(n instanceof Element )) { - break; - } - parent=(Element)n; + Node parent = n1; + while (parent!=null && parent.getNodeType() == Node.ELEMENT_NODE) { + parents.add((Element)parent); + parent = parent.getParentNode(); } //Visit them in reverse order. ListIterator it=parents.listIterator(parents.size()); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java Wed Sep 19 12:41:54 2012 -0700 @@ -1445,7 +1445,7 @@ // The de-serialiser returns a fragment whose children we need to // take on. - if (sourceParent instanceof Document) { + if (sourceParent != null && sourceParent.getNodeType() == Node.DOCUMENT_NODE) { // If this is a content decryption, this may have problems diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations/RetrievalMethodResolver.java Wed Sep 19 12:41:54 2012 -0700 @@ -283,7 +283,7 @@ Element e=null; while (it.hasNext()) { Node currentNode=it.next(); - if (currentNode instanceof Element) { + if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) { e=(Element)currentNode; break; } @@ -292,14 +292,14 @@ List parents=new ArrayList(10); //Obtain all the parents of the elemnt - do { + while (e != null) { parents.add(e); Node n=e.getParentNode(); - if (!(n instanceof Element )) { + if (n == null || n.getNodeType() != Node.ELEMENT_NODE) { break; } e=(Element)n; - } while (e!=null); + } //Visit them in reverse order. ListIterator it2=parents.listIterator(parents.size()-1); Element ele=null; diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java Wed Sep 19 12:41:54 2012 -0700 @@ -225,7 +225,7 @@ } while (sibling==null && parentNode!=null) { sibling=parentNode.getNextSibling(); parentNode=parentNode.getParentNode(); - if (!(parentNode instanceof Element)) { + if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) { parentNode=null; } } diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java --- a/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/rowset/JdbcRowSetImpl.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,6 @@ import java.io.*; import java.math.*; import java.util.*; -import java.beans.*; import javax.sql.rowset.*; @@ -83,12 +82,6 @@ */ private ResultSetMetaData resMD; - /** - * The property that helps to fire the property changed event when certain - * properties are changed in the JdbcRowSet object. This property - * is being added to satisfy Rave requirements. - */ - private PropertyChangeSupport propertyChangeSupport; /** * The Vector holding the Match Columns @@ -145,7 +138,6 @@ throw new RuntimeException(ioe); } - propertyChangeSupport = new PropertyChangeSupport(this); initParams(); @@ -268,7 +260,6 @@ throw new RuntimeException(ioe); } - propertyChangeSupport = new PropertyChangeSupport(this); initParams(); // set the defaults @@ -343,7 +334,6 @@ throw new RuntimeException(ioe); } - propertyChangeSupport = new PropertyChangeSupport(this); initParams(); @@ -360,10 +350,6 @@ setMaxRows(0); setMaxFieldSize(0); - // to ensure connection to a db call connect now - // and associate a conn with "this" object - // in this case. - conn = connect(); setParams(); setReadOnly(true); @@ -435,7 +421,6 @@ throw new RuntimeException(ioe); } - propertyChangeSupport = new PropertyChangeSupport(this); initParams(); @@ -620,12 +605,7 @@ } - // An alternate solution is required instead of having the - // connect method as protected. - // This is a work around to assist Rave Team - // :ah - - protected Connection connect() throws SQLException { + private Connection connect() throws SQLException { // Get a JDBC connection. @@ -4056,9 +4036,7 @@ // Added as per Rave requirements if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) { - ResultSet oldVal = rs; rs = null; - // propertyChangeSupport.firePropertyChange("ResultSet",oldVal,rs); } } @@ -4119,9 +4097,7 @@ // Makes the result ste handle null after rollback // Added as per Rave requirements - ResultSet oldVal = rs; rs = null; - // propertyChangeSupport.firePropertyChange("ResultSet", oldVal,rs); } @@ -4247,12 +4223,6 @@ rs = resultSet; } - - // Over riding the setCommand from BaseRowSet for - // firing the propertyChangeSupport Event for - // Rave requirements when this property's value - // changes. - /** * Sets this JdbcRowSet object's command property to * the given String object and clears the parameters, if any, @@ -4277,28 +4247,19 @@ * @see #getCommand */ public void setCommand(String command) throws SQLException { - String oldVal; if (getCommand() != null) { if(!getCommand().equals(command)) { - oldVal = getCommand(); super.setCommand(command); ps = null; rs = null; - propertyChangeSupport.firePropertyChange("command", oldVal,command); } } else { super.setCommand(command); - propertyChangeSupport.firePropertyChange("command", null,command); } } - // Over riding the setDataSourceName from BaseRowSet for - // firing the propertyChangeSupport Event for - // Rave requirements when this property's values - // changes. - /** * Sets the dataSourceName property for this JdbcRowSet * object to the given logical name and sets this JdbcRowSet object's @@ -4329,28 +4290,20 @@ * @see #getDataSourceName */ public void setDataSourceName(String dsName) throws SQLException{ - String oldVal; if(getDataSourceName() != null) { if(!getDataSourceName().equals(dsName)) { - oldVal = getDataSourceName(); super.setDataSourceName(dsName); conn = null; ps = null; rs = null; - propertyChangeSupport.firePropertyChange("dataSourceName",oldVal,dsName); } } else { super.setDataSourceName(dsName); - propertyChangeSupport.firePropertyChange("dataSourceName",null,dsName); } } - // Over riding the setUrl from BaseRowSet for - // firing the propertyChangeSupport Event for - // Rave requirements when this property's values - // changes. /** * Sets the Url property for this JdbcRowSet object @@ -4394,29 +4347,20 @@ */ public void setUrl(String url) throws SQLException { - String oldVal; if(getUrl() != null) { if(!getUrl().equals(url)) { - oldVal = getUrl(); super.setUrl(url); conn = null; ps = null; rs = null; - propertyChangeSupport.firePropertyChange("url", oldVal, url); } } else { super.setUrl(url); - propertyChangeSupport.firePropertyChange("url", null, url); } } - // Over riding the setUsername from BaseRowSet for - // firing the propertyChangeSupport Event for - // Rave requirements when this property's values - // changes. - /** * Sets the username property for this JdbcRowSet object * to the given user name. Because it @@ -4438,29 +4382,20 @@ * @see #getUsername */ public void setUsername(String uname) { - String oldVal; if( getUsername() != null) { if(!getUsername().equals(uname)) { - oldVal = getUsername(); super.setUsername(uname); conn = null; ps = null; rs = null; - propertyChangeSupport.firePropertyChange("username",oldVal,uname); } } else{ super.setUsername(uname); - propertyChangeSupport.firePropertyChange("username",null,uname); } } - // Over riding the setPassword from BaseRowSet for - // firing the propertyChangeSupport Event for - // Rave requirements when this property's values - // changes. - /** * Sets the password property for this JdbcRowSet object * to the given String object. Because it @@ -4481,21 +4416,17 @@ * that must be supplied to the database to create a connection */ public void setPassword(String password) { - String oldVal; if ( getPassword() != null) { if(!getPassword().equals(password)) { - oldVal = getPassword(); super.setPassword(password); conn = null; ps = null; rs = null; - propertyChangeSupport.firePropertyChange("password",oldVal,password); } } else{ super.setPassword(password); - propertyChangeSupport.firePropertyChange("password",null,password); } } @@ -4528,7 +4459,6 @@ if(oldVal != type) { super.setType(type); - propertyChangeSupport.firePropertyChange("type",oldVal,type); } } @@ -4561,78 +4491,6 @@ if(oldVal != concur) { super.setConcurrency(concur); - propertyChangeSupport.firePropertyChange("concurrency",oldVal,concur); - } - - } - - /** - * Sets the transaction isolation property for this JDBC RowSet object to the given - * constant. The DBMS will use this transaction isolation level for - * transactions if it can. - *

- * For RowSet implementations such as - * the CachedRowSet that operate in a disconnected environment, - * the SyncProvider object being used - * offers complementary locking and data integrity options. The - * options described below are pertinent only to connected RowSet - * objects (JdbcRowSet objects). - * - * @param transIso one of the following constants, listed in ascending order: - * Connection.TRANSACTION_NONE, - * Connection.TRANSACTION_READ_UNCOMMITTED, - * Connection.TRANSACTION_READ_COMMITTED, - * Connection.TRANSACTION_REPEATABLE_READ, or - * Connection.TRANSACTION_SERIALIZABLE - * @throws SQLException if the given parameter is not one of the Connection - * constants - * @see javax.sql.rowset.spi.SyncFactory - * @see javax.sql.rowset.spi.SyncProvider - * @see #getTransactionIsolation - */ - public void setTransactionIsolation(int transIso) throws SQLException { - - int oldVal; - - try { - oldVal = getTransactionIsolation(); - }catch(NullPointerException ex) { - oldVal = 0; - } - - if(oldVal != transIso) { - super.setTransactionIsolation(transIso); - propertyChangeSupport.firePropertyChange("transactionIsolation",oldVal,transIso); - } - - } - - /** - * Sets the maximum number of rows that this RowSet object may contain to - * the given number. If this limit is exceeded, the excess rows are - * silently dropped. - * - * @param mRows an int indicating the current maximum number - * of rows; zero means that there is no limit - * @throws SQLException if an error occurs internally setting the - * maximum limit on the number of rows that a JDBC RowSet object - * can contain; or if max is less than 0; or - * if max is less than the fetchSize of the - * RowSet - */ - public void setMaxRows(int mRows) throws SQLException { - - int oldVal; - - try { - oldVal = getMaxRows(); - }catch(NullPointerException ex) { - oldVal = 0; - } - - if(oldVal != mRows) { - super.setMaxRows(mRows); - propertyChangeSupport.firePropertyChange("maxRows",oldVal,mRows); } } diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java --- a/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/com/sun/security/auth/callback/DialogCallbackHandler.java Wed Sep 19 12:41:54 2012 -0700 @@ -52,7 +52,9 @@ * This can be used by a JAAS application to instantiate a * CallbackHandler * @see javax.security.auth.callback + * @deprecated This class will be removed in a future release. */ +@Deprecated public class DialogCallbackHandler implements CallbackHandler { /* -- Fields -- */ diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/io/FilePermission.java --- a/jdk/src/share/classes/java/io/FilePermission.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/io/FilePermission.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,10 +31,6 @@ import java.util.ArrayList; import java.util.Vector; import java.util.Collections; -import java.io.ObjectStreamField; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; -import java.io.IOException; import sun.security.util.SecurityConstants; /** @@ -424,7 +420,7 @@ /** * Converts an actions String to an actions mask. * - * @param action the action string. + * @param actions the action string. * @return the actions mask. */ private static int getMask(String actions) { @@ -435,7 +431,9 @@ if (actions == null) { return mask; } - // Check against use of constants (used heavily within the JDK) + + // Use object identity comparison against known-interned strings for + // performance benefit (these values are used heavily within the JDK). if (actions == SecurityConstants.FILE_READ_ACTION) { return READ; } else if (actions == SecurityConstants.FILE_WRITE_ACTION) { @@ -531,7 +529,7 @@ switch(a[i-matchlen]) { case ',': seencomma = true; - /*FALLTHROUGH*/ + break; case ' ': case '\r': case '\n': case '\f': case '\t': break; @@ -798,7 +796,7 @@ * @return an enumeration of all the FilePermission objects. */ - public Enumeration elements() { + public Enumeration elements() { // Convert Iterator into Enumeration synchronized (this) { return Collections.enumeration(perms); @@ -843,7 +841,6 @@ /* * Reads in a Vector of FilePermissions and saves them in the perms field. */ - @SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // Don't call defaultReadObject() @@ -852,6 +849,7 @@ ObjectInputStream.GetField gfields = in.readFields(); // Get the one we want + @SuppressWarnings("unchecked") Vector permissions = (Vector)gfields.get("permissions", null); perms = new ArrayList<>(permissions.size()); perms.addAll(permissions); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/lang/AbstractStringBuilder.java --- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java Wed Sep 19 12:41:54 2012 -0700 @@ -96,6 +96,8 @@ * * If the {@code minimumCapacity} argument is nonpositive, this * method takes no action and simply returns. + * Note that subsequent operations on this object can reduce the + * actual capacity below that requested here. * * @param minimumCapacity the minimum desired capacity. */ diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/lang/management/LockInfo.java --- a/jdk/src/share/classes/java/lang/management/LockInfo.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/lang/management/LockInfo.java Wed Sep 19 12:41:54 2012 -0700 @@ -27,7 +27,7 @@ import javax.management.openmbean.CompositeData; import java.util.concurrent.locks.*; -import java.beans.ConstructorProperties; +import sun.management.LockInfoCompositeData; /** * Information about a lock. A lock can be a built-in object monitor, @@ -44,8 +44,7 @@ * *

MXBean Mapping

* LockInfo is mapped to a {@link CompositeData CompositeData} - * as specified in the - * type mapping rules of {@linkplain javax.management.MXBean MXBeans}. + * as specified in the {@link #from from} method. * * @see java.util.concurrent.locks.AbstractOwnableSynchronizer * @see java.util.concurrent.locks.Condition @@ -66,7 +65,6 @@ * @param identityHashCode the {@link System#identityHashCode * identity hash code} of the lock object. */ - @ConstructorProperties({"className", "identityHashCode"}) public LockInfo(String className, int identityHashCode) { if (className == null) { throw new NullPointerException("Parameter className cannot be null"); @@ -103,6 +101,50 @@ } /** + * Returns a {@code LockInfo} object represented by the + * given {@code CompositeData}. + * The given {@code CompositeData} must contain the following attributes: + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + *
Attribute NameType
classNamejava.lang.String
identityHashCodejava.lang.Integer
+ *
+ * + * @param cd {@code CompositeData} representing a {@code LockInfo} + * + * @throws IllegalArgumentException if {@code cd} does not + * represent a {@code LockInfo} with the attributes described + * above. + * @return a {@code LockInfo} object represented + * by {@code cd} if {@code cd} is not {@code null}; + * {@code null} otherwise. + * + * @since 1.8 + */ + public static LockInfo from(CompositeData cd) { + if (cd == null) { + return null; + } + + if (cd instanceof LockInfoCompositeData) { + return ((LockInfoCompositeData) cd).getLockInfo(); + } else { + return LockInfoCompositeData.toLockInfo(cd); + } + } + + /** * Returns a string representation of a lock. The returned * string representation consists of the name of the class of the * lock object, the at-sign character `@', and the unsigned diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/lang/management/ThreadInfo.java --- a/jdk/src/share/classes/java/lang/management/ThreadInfo.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/lang/management/ThreadInfo.java Wed Sep 19 12:41:54 2012 -0700 @@ -696,9 +696,7 @@ * lockInfo * javax.management.openmbean.CompositeData * - the mapped type for {@link LockInfo} as specified in the - * - * type mapping rules of - * {@linkplain javax.management.MXBean MXBeans}. + * {@link LockInfo#from} method. *

* If cd does not contain this attribute, * the LockInfo object will be constructed from @@ -766,10 +764,7 @@ * lockedSynchronizers * javax.management.openmbean.CompositeData[] * whose element type is the mapped type for - * {@link LockInfo} as specified in the - * - * type mapping rules of - * {@linkplain javax.management.MXBean MXBeans}. + * {@link LockInfo} as specified in the {@link LockInfo#from} method. *

* If cd does not contain this attribute, * this attribute will be set to an empty array. @@ -830,7 +825,6 @@ * @since 1.6 */ public LockInfo[] getLockedSynchronizers() { - // represents an return lockedSynchronizers; } diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/lang/reflect/Constructor.java --- a/jdk/src/share/classes/java/lang/reflect/Constructor.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Constructor.java Wed Sep 19 12:41:54 2012 -0700 @@ -182,7 +182,7 @@ * @since 1.5 */ @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public TypeVariable>[] getTypeParameters() { if (getSignature() != null) { return (TypeVariable>[])getGenericInfo().getTypeParameters(); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/lang/reflect/Method.java --- a/jdk/src/share/classes/java/lang/reflect/Method.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Method.java Wed Sep 19 12:41:54 2012 -0700 @@ -194,7 +194,7 @@ * @since 1.5 */ @Override - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public TypeVariable[] getTypeParameters() { if (getGenericSignature() != null) return (TypeVariable[])getGenericInfo().getTypeParameters(); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/net/SocketPermission.java --- a/jdk/src/share/classes/java/net/SocketPermission.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/net/SocketPermission.java Wed Sep 19 12:41:54 2012 -0700 @@ -467,7 +467,6 @@ * @param action the action string * @return the action mask */ - @SuppressWarnings("fallthrough") private static int getMask(String action) { if (action == null) { @@ -480,7 +479,8 @@ int mask = NONE; - // Check against use of constants (used heavily within the JDK) + // Use object identity comparison against known-interned strings for + // performance benefit (these values are used heavily within the JDK). if (action == SecurityConstants.SOCKET_RESOLVE_ACTION) { return RESOLVE; } else if (action == SecurityConstants.SOCKET_CONNECT_ACTION) { @@ -568,7 +568,7 @@ switch(a[i-matchlen]) { case ',': seencomma = true; - /*FALLTHROUGH*/ + break; case ' ': case '\r': case '\n': case '\f': case '\t': break; diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Wed Sep 19 12:41:54 2012 -0700 @@ -248,7 +248,7 @@ return provider.newAsynchronousFileChannel(file, options, executor, attrs); } - @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction + @SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction private static final FileAttribute[] NO_ATTRIBUTES = new FileAttribute[0]; /** diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/nio/channels/FileChannel.java --- a/jdk/src/share/classes/java/nio/channels/FileChannel.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/nio/channels/FileChannel.java Wed Sep 19 12:41:54 2012 -0700 @@ -287,7 +287,7 @@ return provider.newFileChannel(path, options, attrs); } - @SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction + @SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction private static final FileAttribute[] NO_ATTRIBUTES = new FileAttribute[0]; /** diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/ArrayDeque.java --- a/jdk/src/share/classes/java/util/ArrayDeque.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/ArrayDeque.java Wed Sep 19 12:41:54 2012 -0700 @@ -121,6 +121,7 @@ * * @param numElements the number of elements to hold */ + @SuppressWarnings("unchecked") private void allocateElements(int numElements) { int initialCapacity = MIN_INITIAL_CAPACITY; // Find the best power of two to hold elements. @@ -152,10 +153,11 @@ int newCapacity = n << 1; if (newCapacity < 0) throw new IllegalStateException("Sorry, deque too big"); - Object[] a = new Object[newCapacity]; + @SuppressWarnings("unchecked") + E[] a = (E[]) new Object[newCapacity]; System.arraycopy(elements, p, a, 0, r); System.arraycopy(elements, 0, a, r, p); - elements = (E[])a; + elements = a; head = 0; tail = n; } @@ -182,6 +184,7 @@ * Constructs an empty array deque with an initial capacity * sufficient to hold 16 elements. */ + @SuppressWarnings("unchecked") public ArrayDeque() { elements = (E[]) new Object[16]; } @@ -793,6 +796,7 @@ * this deque * @throws NullPointerException if the specified array is null */ + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { int size = size(); if (a.length < size) diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/Arrays.java --- a/jdk/src/share/classes/java/util/Arrays.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/Arrays.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -560,7 +560,7 @@ * off is the offset to generate corresponding low, high in src * To be removed in a future release. */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) private static void mergeSort(Object[] src, Object[] dest, int low, @@ -747,7 +747,7 @@ * off is the offset into src corresponding to low in dest * To be removed in a future release. */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) private static void mergeSort(Object[] src, Object[] dest, int low, int high, int off, @@ -2832,6 +2832,7 @@ * @return a list view of the specified array */ @SafeVarargs + @SuppressWarnings("varargs") public static List asList(T... a) { return new ArrayList<>(a); } diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/Collections.java --- a/jdk/src/share/classes/java/util/Collections.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/Collections.java Wed Sep 19 12:41:54 2012 -0700 @@ -213,7 +213,7 @@ * @throws IllegalArgumentException (optional) if the comparator is * found to violate the {@link Comparator} contract */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) public static void sort(List list, Comparator c) { Object[] a = list.toArray(); Arrays.sort(a, (Comparator)c); @@ -418,7 +418,7 @@ * @throws UnsupportedOperationException if the specified list or * its list-iterator does not support the set operation. */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void reverse(List list) { int size = list.size(); if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) { @@ -497,7 +497,7 @@ * @throws UnsupportedOperationException if the specified list or its * list-iterator does not support the set operation. */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void shuffle(List list, Random rnd) { int size = list.size(); if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) { @@ -535,7 +535,7 @@ * || j < 0 || j >= list.size()). * @since 1.4 */ - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) public static void swap(List list, int i, int j) { // instead of using a raw type here, it's possible to capture // the wildcard but it will require a call to a supplementary @@ -669,7 +669,7 @@ * @throws NoSuchElementException if the collection is empty. * @see Comparable */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) public static T min(Collection coll, Comparator comp) { if (comp==null) return (T)min((Collection) coll); @@ -740,7 +740,7 @@ * @throws NoSuchElementException if the collection is empty. * @see Comparable */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) public static T max(Collection coll, Comparator comp) { if (comp==null) return (T)max((Collection) coll); @@ -1403,7 +1403,7 @@ extends UnmodifiableSet> { private static final long serialVersionUID = 7854390611657943733L; - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) UnmodifiableEntrySet(Set> s) { // Need to cast to raw in order to work around a limitation in the type system super((Set)s); @@ -3172,7 +3172,7 @@ * * @see #emptySet() */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public static final Set EMPTY_SET = new EmptySet<>(); /** @@ -3271,10 +3271,13 @@ return new EmptySortedSet<>(); } - public Comparator comparator() { + @Override + public Comparator comparator() { return null; } + @Override + @SuppressWarnings("unchecked") public SortedSet subSet(Object fromElement, Object toElement) { Objects.requireNonNull(fromElement); Objects.requireNonNull(toElement); @@ -3294,6 +3297,7 @@ return emptySortedSet(); } + @Override public SortedSet headSet(Object toElement) { Objects.requireNonNull(toElement); @@ -3304,6 +3308,7 @@ return emptySortedSet(); } + @Override public SortedSet tailSet(Object fromElement) { Objects.requireNonNull(fromElement); @@ -3314,10 +3319,12 @@ return emptySortedSet(); } + @Override public E first() { throw new NoSuchElementException(); } + @Override public E last() { throw new NoSuchElementException(); } @@ -3328,7 +3335,7 @@ * * @see #emptyList() */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public static final List EMPTY_LIST = new EmptyList<>(); /** @@ -3402,7 +3409,7 @@ * @see #emptyMap() * @since 1.3 */ - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public static final Map EMPTY_MAP = new EmptyMap<>(); /** @@ -3685,6 +3692,7 @@ return a; } + @SuppressWarnings("unchecked") public T[] toArray(T[] a) { final int n = this.n; if (a.length < n) { @@ -3731,6 +3739,7 @@ * the Comparable interface. * @see Comparable */ + @SuppressWarnings("unchecked") public static Comparator reverseOrder() { return (Comparator) ReverseComparator.REVERSE_ORDER; } diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/ComparableTimSort.java --- a/jdk/src/share/classes/java/util/ComparableTimSort.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/ComparableTimSort.java Wed Sep 19 12:41:54 2012 -0700 @@ -208,7 +208,7 @@ * @param start the index of the first element in the range that is * not already known to be sorted ({@code lo <= start <= hi}) */ - @SuppressWarnings({ "fallthrough", "rawtypes", "unchecked" }) + @SuppressWarnings({"fallthrough", "rawtypes", "unchecked"}) private static void binarySort(Object[] a, int lo, int hi, int start) { assert lo <= start && start <= hi; if (start == lo) @@ -277,7 +277,7 @@ * @return the length of the run beginning at the specified position in * the specified array */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) private static int countRunAndMakeAscending(Object[] a, int lo, int hi) { assert lo < hi; int runHi = lo + 1; @@ -612,7 +612,7 @@ * (must be aBase + aLen) * @param len2 length of second run to be merged (must be > 0) */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) private void mergeLo(int base1, int len1, int base2, int len2) { assert len1 > 0 && len2 > 0 && base1 + len1 == base2; @@ -729,7 +729,7 @@ * (must be aBase + aLen) * @param len2 length of second run to be merged (must be > 0) */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) private void mergeHi(int base1, int len1, int base2, int len2) { assert len1 > 0 && len2 > 0 && base1 + len1 == base2; diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/Currency.java --- a/jdk/src/share/classes/java/util/Currency.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/Currency.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,8 @@ import java.io.Serializable; import java.security.AccessController; import java.security.PrivilegedAction; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.regex.Pattern; @@ -60,7 +62,14 @@ * and the ISO 4217 currency data respectively. The value part consists of * three ISO 4217 values of a currency, i.e., an alphabetic code, a numeric * code, and a minor unit. Those three ISO 4217 values are separated by commas. - * The lines which start with '#'s are considered comment lines. For example, + * The lines which start with '#'s are considered comment lines. An optional UTC + * timestamp may be specified per currency entry if users need to specify a + * cutover date indicating when the new data comes into effect. The timestamp is + * appended to the end of the currency properties and uses a comma as a separator. + * If a UTC datestamp is present and valid, the JRE will only use the new currency + * properties if the current UTC date is later than the date specified at class + * loading time. The format of the timestamp must be of ISO 8601 format : + * {@code 'yyyy-MM-dd'T'HH:mm:ss'}. For example, *

* * #Sample currency properties
@@ -69,6 +78,20 @@ *

* will supersede the currency data for Japan. * + *

+ * + * #Sample currency properties with cutover date
+ * JP=JPZ,999,0,2014-01-01T00:00:00 + *
+ *

+ * will supersede the currency data for Japan if {@code Currency} class is loaded after + * 1st January 2014 00:00:00 GMT. + *

+ * Where syntactically malformed entries are encountered, the entry is ignored + * and the remainder of entries in file are processed. For instances where duplicate + * country code entries exist, the behavior of the Currency information for that + * {@code Currency} is undefined and the remainder of entries in file are processed. + * * @since 1.4 */ public final class Currency implements Serializable { @@ -100,7 +123,6 @@ private static ConcurrentMap instances = new ConcurrentHashMap<>(7); private static HashSet available; - // Class data: currency data obtained from currency.data file. // Purpose: // - determine valid country codes @@ -235,7 +257,9 @@ } Set keys = props.stringPropertyNames(); Pattern propertiesPattern = - Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])"); + Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*" + + "([0-3])\\s*,?\\s*(\\d{4}-\\d{2}-\\d{2}T\\d{2}:" + + "\\d{2}:\\d{2})?"); for (String key : keys) { replaceCurrencyData(propertiesPattern, key.toUpperCase(Locale.ROOT), @@ -645,29 +669,38 @@ * consists of "three-letter alphabet code", "three-digit numeric code", * and "one-digit (0,1,2, or 3) default fraction digit". * For example, "JPZ,392,0". - * @throws + * An optional UTC date can be appended to the string (comma separated) + * to allow a currency change take effect after date specified. + * For example, "JP=JPZ,999,0,2014-01-01T00:00:00" has no effect unless + * UTC time is past 1st January 2014 00:00:00 GMT. */ private static void replaceCurrencyData(Pattern pattern, String ctry, String curdata) { if (ctry.length() != 2) { // ignore invalid country code - String message = new StringBuilder() - .append("The entry in currency.properties for ") - .append(ctry).append(" is ignored because of the invalid country code.") - .toString(); - info(message, null); + info("currency.properties entry for " + ctry + + " is ignored because of the invalid country code.", null); return; } Matcher m = pattern.matcher(curdata); - if (!m.find()) { + if (!m.find() || (m.group(4) == null && countOccurrences(curdata, ',') >= 3)) { // format is not recognized. ignore the data - String message = new StringBuilder() - .append("The entry in currency.properties for ") - .append(ctry) - .append(" is ignored because the value format is not recognized.") - .toString(); - info(message, null); + // if group(4) date string is null and we've 4 values, bad date value + info("currency.properties entry for " + ctry + + " ignored because the value format is not recognized.", null); + return; + } + + try { + if (m.group(4) != null && !isPastCutoverDate(m.group(4))) { + info("currency.properties entry for " + ctry + + " ignored since cutover date has not passed :" + curdata, null); + return; + } + } catch (IndexOutOfBoundsException | NullPointerException | ParseException ex) { + info("currency.properties entry for " + ctry + + " ignored since exception encountered :" + ex.getMessage(), null); return; } @@ -695,6 +728,26 @@ setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry); } + private static boolean isPastCutoverDate(String s) + throws IndexOutOfBoundsException, NullPointerException, ParseException { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT); + format.setTimeZone(TimeZone.getTimeZone("UTC")); + format.setLenient(false); + long time = format.parse(s.trim()).getTime(); + return System.currentTimeMillis() > time; + + } + + private static int countOccurrences(String value, char match) { + int count = 0; + for (char c : value.toCharArray()) { + if (c == match) { + ++count; + } + } + return count; + } + private static void info(String message, Throwable t) { PlatformLogger logger = PlatformLogger.getLogger("java.util.Currency"); if (logger.isLoggable(PlatformLogger.INFO)) { diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/HashMap.java --- a/jdk/src/share/classes/java/util/HashMap.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/HashMap.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -230,7 +230,7 @@ this.loadFactor = loadFactor; threshold = (int)Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1); - table = new Entry[capacity]; + table = new Entry[capacity]; init(); } @@ -1078,7 +1078,7 @@ capacity <<= 1; } - table = new Entry[capacity]; + table = new Entry[capacity]; threshold = (int) Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1); init(); // Give subclass a chance to do its thing. diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/JumboEnumSet.java --- a/jdk/src/share/classes/java/util/JumboEnumSet.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/JumboEnumSet.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -121,6 +121,7 @@ unseen = elements[0]; } + @Override public boolean hasNext() { while (unseen == 0 && unseenIndex < elements.length - 1) unseen = elements[++unseenIndex]; @@ -128,6 +129,7 @@ } @Override + @SuppressWarnings("unchecked") public E next() { if (!hasNext()) throw new NoSuchElementException(); @@ -138,6 +140,7 @@ + Long.numberOfTrailingZeros(lastReturned)]; } + @Override public void remove() { if (lastReturned == 0) throw new IllegalStateException(); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/PriorityQueue.java --- a/jdk/src/share/classes/java/util/PriorityQueue.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/PriorityQueue.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -330,6 +330,7 @@ return true; } + @SuppressWarnings("unchecked") public E peek() { if (size == 0) return null; diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/PropertyPermission.java --- a/jdk/src/share/classes/java/util/PropertyPermission.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/PropertyPermission.java Wed Sep 19 12:41:54 2012 -0700 @@ -246,7 +246,8 @@ return mask; } - // Check against use of constants (used heavily within the JDK) + // Use object identity comparison against known-interned strings for + // performance benefit (these values are used heavily within the JDK). if (actions == SecurityConstants.PROPERTY_READ_ACTION) { return READ; } if (actions == SecurityConstants.PROPERTY_WRITE_ACTION) { diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/PropertyResourceBundle.java --- a/jdk/src/share/classes/java/util/PropertyResourceBundle.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/PropertyResourceBundle.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,6 +125,7 @@ * @throws IOException if an I/O error occurs * @throws NullPointerException if stream is null */ + @SuppressWarnings({"unchecked", "rawtypes"}) public PropertyResourceBundle (InputStream stream) throws IOException { Properties properties = new Properties(); properties.load(stream); @@ -143,6 +144,7 @@ * @throws NullPointerException if reader is null * @since 1.6 */ + @SuppressWarnings({"unchecked", "rawtypes"}) public PropertyResourceBundle (Reader reader) throws IOException { Properties properties = new Properties(); properties.load(reader); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/jar/JarVerifier.java --- a/jdk/src/share/classes/java/util/jar/JarVerifier.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/jar/JarVerifier.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -325,6 +325,7 @@ * the given file in the jar. * @deprecated */ + @Deprecated public java.security.cert.Certificate[] getCerts(String name) { return mapSignersToCertArray(getCodeSigners(name)); diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/jar/Pack200.java --- a/jdk/src/share/classes/java/util/jar/Pack200.java Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/jar/Pack200.java Wed Sep 19 12:41:54 2012 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003,2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003,2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -726,13 +726,13 @@ private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer"; private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker"; - private static Class packerImpl; - private static Class unpackerImpl; + private static Class packerImpl; + private static Class unpackerImpl; private synchronized static Object newInstance(String prop) { String implName = "(unknown)"; try { - Class impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl; + Class impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl; if (impl == null) { // The first time, we must decide which class to use. implName = java.security.AccessController.doPrivileged( diff -r 539a1187467a -r 9a7055463e06 jdk/src/share/classes/java/util/zip/package.html --- a/jdk/src/share/classes/java/util/zip/package.html Wed Sep 19 12:38:53 2012 -0700 +++ b/jdk/src/share/classes/java/util/zip/package.html Wed Sep 19 12:41:54 2012 -0700 @@ -2,7 +2,7 @@