# HG changeset patch
# User lana
# Date 1376434177 25200
# Node ID 9dc631273af7ab1253511779eac583948c3f6d1d
# Parent 424d84a2276f3faa50180cbabbdafbfe49770bfe# Parent 30a1d677a20c6a95f98043d8f20ce570304e3818
Merge
diff -r 424d84a2276f -r 9dc631273af7 .hgtags
--- a/.hgtags Tue Aug 13 15:41:55 2013 +0400
+++ b/.hgtags Tue Aug 13 15:49:37 2013 -0700
@@ -223,3 +223,4 @@
2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99
3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100
edb01c460d4cab21ff0ff13512df7b746efaa0e7 jdk8-b101
+bbe43d712fe08e650808d774861b256ccb34e500 jdk8-b102
diff -r 424d84a2276f -r 9dc631273af7 .hgtags-top-repo
--- a/.hgtags-top-repo Tue Aug 13 15:41:55 2013 +0400
+++ b/.hgtags-top-repo Tue Aug 13 15:49:37 2013 -0700
@@ -223,3 +223,4 @@
59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99
d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100
9f74a220677dc265a724515d8e2617548cef62f1 jdk8-b101
+5eb3c1dc348f72a7f84f7d9d07834e8bbe09a799 jdk8-b102
diff -r 424d84a2276f -r 9dc631273af7 corba/.hgtags
--- a/corba/.hgtags Tue Aug 13 15:41:55 2013 +0400
+++ b/corba/.hgtags Tue Aug 13 15:49:37 2013 -0700
@@ -223,3 +223,4 @@
3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101
+528c7e76eaeee022817ee085668459bc97cf5665 jdk8-b102
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaInputStream.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaInputStream.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2004, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-
-/**
- * This is delegates to the real implementation.
- *
- * NOTE:
- *
- * Before using the stream for valuetype unmarshaling, one must call
- * performORBVersionSpecificInit().
- */
-public abstract class CDRInputStream
- extends org.omg.CORBA_2_3.portable.InputStream
- implements com.sun.corba.se.impl.encoding.MarshalInputStream,
- org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream
-{
- protected CorbaMessageMediator messageMediator;
- private CDRInputStreamBase impl;
-
- // We can move this out somewhere later. For now, it serves its purpose
- // to create a concrete CDR delegate based on the GIOP version.
- private static class InputStreamFactory {
-
- public static CDRInputStreamBase newInputStream(ORB orb, GIOPVersion version)
- {
- switch(version.intValue()) {
- case GIOPVersion.VERSION_1_0:
- return new CDRInputStream_1_0();
- case GIOPVersion.VERSION_1_1:
- return new CDRInputStream_1_1();
- case GIOPVersion.VERSION_1_2:
- return new CDRInputStream_1_2();
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- throw wrapper.unsupportedGiopVersion( version ) ;
- }
- }
- }
-
- // Required for the case when a ClientResponseImpl is
- // created with a SystemException due to a dead server/closed
- // connection with no warning. Note that the stream will
- // not be initialized in this case.
- //
- // Probably also required by ServerRequestImpl.
- //
- // REVISIT.
- public CDRInputStream() {
- }
-
- public CDRInputStream(CDRInputStream is) {
- impl = is.impl.dup();
- impl.setParent(this);
- }
-
- public CDRInputStream(org.omg.CORBA.ORB orb,
- ByteBuffer byteBuffer,
- int size,
- boolean littleEndian,
- GIOPVersion version,
- BufferManagerRead bufMgr)
- {
- impl = InputStreamFactory.newInputStream( (ORB)orb, version);
-
- impl.init(orb, byteBuffer, size, littleEndian, bufMgr);
-
- impl.setParent(this);
- }
-
- // org.omg.CORBA.portable.InputStream
- public final boolean read_boolean() {
- return impl.read_boolean();
- }
-
- public final char read_char() {
- return impl.read_char();
- }
-
- public final char read_wchar() {
- return impl.read_wchar();
- }
-
- public final byte read_octet() {
- return impl.read_octet();
- }
-
- public final short read_short() {
- return impl.read_short();
- }
-
- public final short read_ushort() {
- return impl.read_ushort();
- }
-
- public final int read_long() {
- return impl.read_long();
- }
-
- public final int read_ulong() {
- return impl.read_ulong();
- }
-
- public final long read_longlong() {
- return impl.read_longlong();
- }
-
- public final long read_ulonglong() {
- return impl.read_ulonglong();
- }
-
- public final float read_float() {
- return impl.read_float();
- }
-
- public final double read_double() {
- return impl.read_double();
- }
-
- public final String read_string() {
- return impl.read_string();
- }
-
- public final String read_wstring() {
- return impl.read_wstring();
- }
-
- public final void read_boolean_array(boolean[] value, int offset, int length) {
- impl.read_boolean_array(value, offset, length);
- }
-
- public final void read_char_array(char[] value, int offset, int length) {
- impl.read_char_array(value, offset, length);
- }
-
- public final void read_wchar_array(char[] value, int offset, int length) {
- impl.read_wchar_array(value, offset, length);
- }
-
- public final void read_octet_array(byte[] value, int offset, int length) {
- impl.read_octet_array(value, offset, length);
- }
-
- public final void read_short_array(short[] value, int offset, int length) {
- impl.read_short_array(value, offset, length);
- }
-
- public final void read_ushort_array(short[] value, int offset, int length) {
- impl.read_ushort_array(value, offset, length);
- }
-
- public final void read_long_array(int[] value, int offset, int length) {
- impl.read_long_array(value, offset, length);
- }
-
- public final void read_ulong_array(int[] value, int offset, int length) {
- impl.read_ulong_array(value, offset, length);
- }
-
- public final void read_longlong_array(long[] value, int offset, int length) {
- impl.read_longlong_array(value, offset, length);
- }
-
- public final void read_ulonglong_array(long[] value, int offset, int length) {
- impl.read_ulonglong_array(value, offset, length);
- }
-
- public final void read_float_array(float[] value, int offset, int length) {
- impl.read_float_array(value, offset, length);
- }
-
- public final void read_double_array(double[] value, int offset, int length) {
- impl.read_double_array(value, offset, length);
- }
-
- public final org.omg.CORBA.Object read_Object() {
- return impl.read_Object();
- }
-
- public final TypeCode read_TypeCode() {
- return impl.read_TypeCode();
- }
- public final Any read_any() {
- return impl.read_any();
- }
-
- public final Principal read_Principal() {
- return impl.read_Principal();
- }
-
- public final int read() throws java.io.IOException {
- return impl.read();
- }
-
- public final java.math.BigDecimal read_fixed() {
- return impl.read_fixed();
- }
-
- public final org.omg.CORBA.Context read_Context() {
- return impl.read_Context();
- }
-
- public final org.omg.CORBA.Object read_Object(java.lang.Class clz) {
- return impl.read_Object(clz);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return impl.orb();
- }
-
- // org.omg.CORBA_2_3.portable.InputStream
- public final java.io.Serializable read_value() {
- return impl.read_value();
- }
-
- public final java.io.Serializable read_value(java.lang.Class clz) {
- return impl.read_value(clz);
- }
-
- public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
- return impl.read_value(factory);
- }
-
- public final java.io.Serializable read_value(java.lang.String rep_id) {
- return impl.read_value(rep_id);
- }
-
- public final java.io.Serializable read_value(java.io.Serializable value) {
- return impl.read_value(value);
- }
-
- public final java.lang.Object read_abstract_interface() {
- return impl.read_abstract_interface();
- }
-
- public final java.lang.Object read_abstract_interface(java.lang.Class clz) {
- return impl.read_abstract_interface(clz);
- }
- // com.sun.corba.se.impl.encoding.MarshalInputStream
-
- public final void consumeEndian() {
- impl.consumeEndian();
- }
-
- public final int getPosition() {
- return impl.getPosition();
- }
-
- // org.omg.CORBA.DataInputStream
-
- public final java.lang.Object read_Abstract () {
- return impl.read_Abstract();
- }
-
- public final java.io.Serializable read_Value () {
- return impl.read_Value();
- }
-
- public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
- impl.read_any_array(seq, offset, length);
- }
-
- public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
- impl.read_boolean_array(seq, offset, length);
- }
-
- public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
- impl.read_char_array(seq, offset, length);
- }
-
- public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
- impl.read_wchar_array(seq, offset, length);
- }
-
- public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
- impl.read_octet_array(seq, offset, length);
- }
-
- public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
- impl.read_short_array(seq, offset, length);
- }
-
- public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
- impl.read_ushort_array(seq, offset, length);
- }
-
- public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
- impl.read_long_array(seq, offset, length);
- }
-
- public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
- impl.read_ulong_array(seq, offset, length);
- }
-
- public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
- impl.read_ulonglong_array(seq, offset, length);
- }
-
- public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
- impl.read_longlong_array(seq, offset, length);
- }
-
- public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
- impl.read_float_array(seq, offset, length);
- }
-
- public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
- impl.read_double_array(seq, offset, length);
- }
-
- // org.omg.CORBA.portable.ValueBase
- public final String[] _truncatable_ids() {
- return impl._truncatable_ids();
- }
-
- // java.io.InputStream
- public final int read(byte b[]) throws IOException {
- return impl.read(b);
- }
-
- public final int read(byte b[], int off, int len) throws IOException {
- return impl.read(b, off, len);
- }
-
- public final long skip(long n) throws IOException {
- return impl.skip(n);
- }
-
- public final int available() throws IOException {
- return impl.available();
- }
-
- public final void close() throws IOException {
- impl.close();
- }
-
- public final void mark(int readlimit) {
- impl.mark(readlimit);
- }
-
- public final void reset() {
- impl.reset();
- }
-
- public final boolean markSupported() {
- return impl.markSupported();
- }
-
- public abstract CDRInputStream dup();
-
- // Needed by TCUtility
- public final java.math.BigDecimal read_fixed(short digits, short scale) {
- return impl.read_fixed(digits, scale);
- }
-
- public final boolean isLittleEndian() {
- return impl.isLittleEndian();
- }
-
- protected final ByteBuffer getByteBuffer() {
- return impl.getByteBuffer();
- }
-
- protected final void setByteBuffer(ByteBuffer byteBuffer) {
- impl.setByteBuffer(byteBuffer);
- }
-
- protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- impl.setByteBufferWithInfo(bbwi);
- }
-
- public final int getBufferLength() {
- return impl.getBufferLength();
- }
-
- protected final void setBufferLength(int value) {
- impl.setBufferLength(value);
- }
-
- protected final int getIndex() {
- return impl.getIndex();
- }
-
- protected final void setIndex(int value) {
- impl.setIndex(value);
- }
-
- public final void orb(org.omg.CORBA.ORB orb) {
- impl.orb(orb);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return impl.getGIOPVersion();
- }
-
- public final BufferManagerRead getBufferManager() {
- return impl.getBufferManager();
- }
-
- // This should be overridden by any stream (ex: IIOPInputStream)
- // which wants to read values. Thus, TypeCodeInputStream doesn't
- // have to do this.
- public CodeBase getCodeBase() {
- return null;
- }
-
- // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
- // performed.
- protected CodeSetConversion.BTCConverter createCharBTCConverter() {
- return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1,
- impl.isLittleEndian());
- }
-
- // Subclasses must decide what to do here. It's inconvenient to
- // make the class and this method abstract because of dup().
- protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter();
-
- // Prints the current buffer in a human readable form
- void printBuffer() {
- impl.printBuffer();
- }
-
- /**
- * Aligns the current position on the given octet boundary
- * if there are enough bytes available to do so. Otherwise,
- * it just returns. This is used for some (but not all)
- * GIOP 1.2 message headers.
- */
- public void alignOnBoundary(int octetBoundary) {
- impl.alignOnBoundary(octetBoundary);
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- impl.setHeaderPadding(headerPadding);
- }
-
- /**
- * This must be called after determining the proper ORB version,
- * and setting it on the stream's ORB instance. It can be called
- * after reading the service contexts, since that is the only place
- * we can get the ORB version info.
- *
- * Trying to unmarshal things requiring repository IDs before calling
- * this will result in NullPtrExceptions.
- */
- public void performORBVersionSpecificInit() {
- // In the case of SystemExceptions, a stream is created
- // with its default constructor (and thus no impl is set).
- if (impl != null)
- impl.performORBVersionSpecificInit();
- }
-
- /**
- * Resets any internal references to code set converters.
- * This is useful for forcing the CDR stream to reacquire
- * converters (probably from its subclasses) when state
- * has changed.
- */
- public void resetCodeSetConverters() {
- impl.resetCodeSetConverters();
- }
-
- public void setMessageMediator(MessageMediator messageMediator)
- {
- this.messageMediator = (CorbaMessageMediator) messageMediator;
- }
-
- public MessageMediator getMessageMediator()
- {
- return messageMediator;
- }
-
- // ValueInputStream -----------------------------
-
- public void start_value() {
- impl.start_value();
- }
-
- public void end_value() {
- impl.end_value();
- }
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/copyobject/JavaOutputStream.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,435 +0,0 @@
-/*
- * Copyright (c) 2004, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.corba.se.impl.encoding;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.nio.ByteBuffer;
-
-import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.Principal;
-import org.omg.CORBA.Any;
-
-import com.sun.corba.se.pept.protocol.MessageMediator;
-
-import com.sun.corba.se.spi.orb.ORB;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-
-import com.sun.corba.se.impl.encoding.CodeSetConversion;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-
-/**
- * This is delegates to the real implementation.
- */
-public abstract class CDROutputStream
- extends org.omg.CORBA_2_3.portable.OutputStream
- implements com.sun.corba.se.impl.encoding.MarshalOutputStream,
- org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream
-{
-/*
- private CDROutputStreamBase impl;
- protected ORB orb ;
- protected ORBUtilSystemException wrapper ;
- protected CorbaMessageMediator corbaMessageMediator;
-
-
- // We can move this out somewhere later. For now, it serves its purpose
- // to create a concrete CDR delegate based on the GIOP version.
- private static class OutputStreamFactory {
-
- public static CDROutputStreamBase newOutputStream(ORB orb, GIOPVersion version)
- {
- switch(version.intValue()) {
- case GIOPVersion.VERSION_1_0:
- return new CDROutputStream_1_0();
- case GIOPVersion.VERSION_1_1:
- return new CDROutputStream_1_1();
- case GIOPVersion.VERSION_1_2:
- return new CDROutputStream_1_2();
- default:
- ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- // REVISIT - what is appropriate? INTERNAL exceptions
- // are really hard to track later.
- throw wrapper.unsupportedGiopVersion( version ) ;
- }
- }
- }
-
- // REVISIT - These two constructors should be re-factored to better hide
- // the fact that someone extending this class 'can' construct a CDROutputStream
- // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream
- // does _not_ use pooled ByteBuffers, see EncapsOutputStream.
-
- // NOTE: When a stream is constructed for non-channel-backed sockets
- // it notifies the constructor not to use pooled (i.e, direct)
- // ByteBuffers.
-
- public CDROutputStream(ORB orb,
- GIOPVersion version,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion,
- boolean usePooledByteBuffers)
- {
- impl = OutputStreamFactory.newOutputStream(orb, version);
- impl.init(orb, littleEndian, bufferManager, streamFormatVersion, usePooledByteBuffers);
-
- impl.setParent(this);
- this.orb = orb ;
- this.wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_ENCODING ) ;
- }
-
- public CDROutputStream(ORB orb,
- GIOPVersion version,
- boolean littleEndian,
- BufferManagerWrite bufferManager,
- byte streamFormatVersion)
- {
- this(orb, version, littleEndian, bufferManager, streamFormatVersion, true);
- }
-*/
-
- private ByteArrayOutputStream bos ;
- private ObjectOutputStream oos ;
-
- public JavaOutputStream()
- {
- bos = new ByteArrayOutputStream() ;
- oos = new ObjectOutputStream( bos ) ;
- }
-
- // Provided by IIOPOutputStream and EncapsOutputStream
- public org.omg.CORBA.portable.InputStream create_input_stream()
- {
- ObjectInputStream ois = new ByteArrayInputStream( bos.toByteArray() ) ;
-
- return new JavaInputStream( ois ) ;
- }
-
- public final void write_boolean(boolean value) {
- impl.write_boolean(value);
- }
- public final void write_char(char value) {
- impl.write_char(value);
- }
- public final void write_wchar(char value) {
- impl.write_wchar(value);
- }
- public final void write_octet(byte value) {
- impl.write_octet(value);
- }
- public final void write_short(short value) {
- impl.write_short(value);
- }
- public final void write_ushort(short value) {
- impl.write_ushort(value);
- }
- public final void write_long(int value) {
- impl.write_long(value);
- }
- public final void write_ulong(int value) {
- impl.write_ulong(value);
- }
- public final void write_longlong(long value) {
- impl.write_longlong(value);
- }
- public final void write_ulonglong(long value) {
- impl.write_ulonglong(value);
- }
- public final void write_float(float value) {
- impl.write_float(value);
- }
- public final void write_double(double value) {
- impl.write_double(value);
- }
- public final void write_string(String value) {
- impl.write_string(value);
- }
- public final void write_wstring(String value) {
- impl.write_wstring(value);
- }
-
- public final void write_boolean_array(boolean[] value, int offset, int length) {
- impl.write_boolean_array(value, offset, length);
- }
- public final void write_char_array(char[] value, int offset, int length) {
- impl.write_char_array(value, offset, length);
- }
- public final void write_wchar_array(char[] value, int offset, int length) {
- impl.write_wchar_array(value, offset, length);
- }
- public final void write_octet_array(byte[] value, int offset, int length) {
- impl.write_octet_array(value, offset, length);
- }
- public final void write_short_array(short[] value, int offset, int length) {
- impl.write_short_array(value, offset, length);
- }
- public final void write_ushort_array(short[] value, int offset, int length){
- impl.write_ushort_array(value, offset, length);
- }
- public final void write_long_array(int[] value, int offset, int length) {
- impl.write_long_array(value, offset, length);
- }
- public final void write_ulong_array(int[] value, int offset, int length) {
- impl.write_ulong_array(value, offset, length);
- }
- public final void write_longlong_array(long[] value, int offset, int length) {
- impl.write_longlong_array(value, offset, length);
- }
- public final void write_ulonglong_array(long[] value, int offset,int length) {
- impl.write_ulonglong_array(value, offset, length);
- }
- public final void write_float_array(float[] value, int offset, int length) {
- impl.write_float_array(value, offset, length);
- }
- public final void write_double_array(double[] value, int offset, int length) {
- impl.write_double_array(value, offset, length);
- }
- public final void write_Object(org.omg.CORBA.Object value) {
- impl.write_Object(value);
- }
- public final void write_TypeCode(TypeCode value) {
- impl.write_TypeCode(value);
- }
- public final void write_any(Any value) {
- impl.write_any(value);
- }
-
- public final void write_Principal(Principal value) {
- impl.write_Principal(value);
- }
-
- public final void write(int b) throws java.io.IOException {
- impl.write(b);
- }
-
- public final void write_fixed(java.math.BigDecimal value) {
- impl.write_fixed(value);
- }
-
- public final void write_Context(org.omg.CORBA.Context ctx,
- org.omg.CORBA.ContextList contexts) {
- impl.write_Context(ctx, contexts);
- }
-
- public final org.omg.CORBA.ORB orb() {
- return impl.orb();
- }
-
- // org.omg.CORBA_2_3.portable.OutputStream
- public final void write_value(java.io.Serializable value) {
- impl.write_value(value);
- }
-
- public final void write_value(java.io.Serializable value, java.lang.Class clz) {
- impl.write_value(value, clz);
- }
-
- public final void write_value(java.io.Serializable value, String repository_id) {
- impl.write_value(value, repository_id);
- }
-
- public final void write_value(java.io.Serializable value,
- org.omg.CORBA.portable.BoxedValueHelper factory) {
- impl.write_value(value, factory);
- }
-
- public final void write_abstract_interface(java.lang.Object obj) {
- impl.write_abstract_interface(obj);
- }
-
- // java.io.OutputStream
- public final void write(byte b[]) throws IOException {
- impl.write(b);
- }
-
- public final void write(byte b[], int off, int len) throws IOException {
- impl.write(b, off, len);
- }
-
- public final void flush() throws IOException {
- impl.flush();
- }
-
- public final void close() throws IOException {
- impl.close();
- }
-
- // com.sun.corba.se.impl.encoding.MarshalOutputStream
- public final void start_block() {
- impl.start_block();
- }
-
- public final void end_block() {
- impl.end_block();
- }
-
- public final void putEndian() {
- impl.putEndian();
- }
-
- public void writeTo(java.io.OutputStream s)
- throws IOException
- {
- impl.writeTo(s);
- }
-
- public final byte[] toByteArray() {
- return impl.toByteArray();
- }
-
- // org.omg.CORBA.DataOutputStream
- public final void write_Abstract (java.lang.Object value) {
- impl.write_Abstract(value);
- }
-
- public final void write_Value (java.io.Serializable value) {
- impl.write_Value(value);
- }
-
- public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
- impl.write_any_array(seq, offset, length);
- }
-
- public void setMessageMediator(MessageMediator messageMediator)
- {
- this.corbaMessageMediator = (CorbaMessageMediator) messageMediator;
- }
-
- public MessageMediator getMessageMediator()
- {
- return corbaMessageMediator;
- }
-
- // org.omg.CORBA.portable.ValueBase
- public final String[] _truncatable_ids() {
- return impl._truncatable_ids();
- }
-
- // Other
- protected final int getSize() {
- return impl.getSize();
- }
-
- protected final int getIndex() {
- return impl.getIndex();
- }
-
- protected int getRealIndex(int index) {
- // Used in indirections. Overridden by TypeCodeOutputStream.
- return index;
- }
-
- protected final void setIndex(int value) {
- impl.setIndex(value);
- }
-
- protected final ByteBuffer getByteBuffer() {
- return impl.getByteBuffer();
- }
-
- protected final void setByteBuffer(ByteBuffer byteBuffer) {
- impl.setByteBuffer(byteBuffer);
- }
-
- public final boolean isLittleEndian() {
- return impl.isLittleEndian();
- }
-
- // XREVISIT - return to final if possible
- // REVISIT - was protected - need access from msgtypes test.
- public ByteBufferWithInfo getByteBufferWithInfo() {
- return impl.getByteBufferWithInfo();
- }
-
- protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
- impl.setByteBufferWithInfo(bbwi);
- }
-
- // REVISIT: was protected - but need to access from xgiop.
- public final BufferManagerWrite getBufferManager() {
- return impl.getBufferManager();
- }
-
- public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
- impl.write_fixed(bigDecimal, digits, scale);
- }
-
- public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
- impl.writeOctetSequenceTo(s);
- }
-
- public final GIOPVersion getGIOPVersion() {
- return impl.getGIOPVersion();
- }
-
- public final void writeIndirection(int tag, int posIndirectedTo) {
- impl.writeIndirection(tag, posIndirectedTo);
- }
-
- // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
- // performed.
- protected CodeSetConversion.CTBConverter createCharCTBConverter() {
- return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
- }
-
- // Subclasses must decide what to do here. It's inconvenient to
- // make the class and this method abstract because of dup().
- protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter();
-
- protected final void freeInternalCaches() {
- impl.freeInternalCaches();
- }
-
- void printBuffer() {
- impl.printBuffer();
- }
-
- public void alignOnBoundary(int octetBoundary) {
- impl.alignOnBoundary(octetBoundary);
- }
-
- // Needed by request and reply messages for GIOP versions >= 1.2 only.
- public void setHeaderPadding(boolean headerPadding) {
- impl.setHeaderPadding(headerPadding);
- }
-
- // ValueOutputStream -----------------------------
-
- public void start_value(String rep_id) {
- impl.start_value(rep_id);
- }
-
- public void end_value() {
- impl.end_value();
- }
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/interceptors/ThreadCurrentStack.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2000, 2002, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.interceptors;
-
-import com.sun.corba.se.impl.corba.AnyImpl;
-import org.omg.PortableInterceptor.Current;
-import org.omg.PortableInterceptor.InvalidSlot;
-
-import com.sun.corba.se.impl.util.MinorCodes;
-import com.sun.corba.se.impl.core.ORB;
-
-/**
- * ThreadCurrentStack is the container of PICurrent instances for each thread
- */
-public class ThreadCurrentStack
-{
- // PICurrentPool is the container for reusable PICurrents
- private class PICurrentPool {
-
- // Contains a list of reusable PICurrents
- private java.util.ArrayList pool;
-
- // High water mark for the pool
- // If the pool size reaches this limit then putPICurrent will
- // not put PICurrent to the pool.
- private static final int HIGH_WATER_MARK = 5;
-
- // currentIndex points to the last PICurrent in the list
- private int currentIndex;
-
- PICurrentPool( ) {
- pool = new java.util.ArrayList( HIGH_WATER_MARK );
- currentIndex = 0;
- }
-
- /**
- * Puts PICurrent to the re-usable pool.
- */
- void putPICurrent( PICurrent current ) {
- // If there are enough PICurrents in the pool, then don't add
- // this current to the pool.
- if( currentIndex >= HIGH_WATER_MARK ) {
- return;
- }
- pool.add(currentIndex , current);
- currentIndex++;
- }
-
- /**
- * Gets PICurrent from the re-usable pool.
- */
- PICurrent getPICurrent( ) {
- // If there are no entries in the pool then return null
- if( currentIndex == 0 ) {
- return null;
- }
- // Works like a stack, Gets the last one added first
- currentIndex--;
- return (PICurrent) pool.get(currentIndex);
- }
- }
-
- // Contains all the active PICurrents for each thread.
- // The ArrayList is made to behave like a stack.
- private java.util.ArrayList currentContainer;
-
- // Keeps track of number of PICurrents in the stack.
- private int currentIndex;
-
- // For Every Thread there will be a pool of re-usable ThreadCurrent's
- // stored in PICurrentPool
- private PICurrentPool currentPool;
-
- // The orb associated with this ThreadCurrentStack
- private ORB piOrb;
-
- /**
- * Constructs the stack and and PICurrentPool
- */
- ThreadCurrentStack( ORB piOrb, PICurrent current ) {
- this.piOrb = piOrb;
- currentIndex = 0;
- currentContainer = new java.util.ArrayList( );
- currentPool = new PICurrentPool( );
- currentContainer.add( currentIndex, current );
- currentIndex++;
- }
-
-
- /**
- * pushPICurrent goes through the following steps
- * 1: Checks to see if there is any PICurrent in PICurrentPool
- * If present then use that instance to push into the ThreadCurrentStack
- *
- * 2:If there is no PICurrent in the pool, then creates a new one and pushes
- * that into the ThreadCurrentStack
- */
- void pushPICurrent( ) {
- PICurrent current = currentPool.getPICurrent( );
- if( current == null ) {
- // get an existing PICurrent to get the slotSize
- PICurrent currentTemp = peekPICurrent();
- current = new PICurrent( piOrb, currentTemp.getSlotSize( ));
- }
- currentContainer.add( currentIndex, current );
- currentIndex++;
- }
-
- /**
- * popPICurrent does the following
- * 1: pops the top PICurrent in the ThreadCurrentStack
- *
- * 2: resets the slots in the PICurrent which resets the slotvalues to
- * null if there are any previous sets.
- *
- * 3: pushes the reset PICurrent into the PICurrentPool to reuse
- */
- void popPICurrent( ) {
- // Do not pop the PICurrent, If there is only one.
- // This should not happen, But an extra check for safety.
- if( currentIndex <= 1 ) {
- throw new org.omg.CORBA.INTERNAL(
- "Cannot pop the only PICurrent in the stack",
- MinorCodes.CANT_POP_ONLY_CURRENT_2,
- CompletionStatus.COMPLETED_NO );
- }
- currentIndex--;
- PICurrent current = (PICurrent)currentContainer.get( currentIndex );
- current.resetSlots( );
- currentPool.putPICurrent( current );
- }
-
- /**
- * peekPICurrent gets the top PICurrent in the ThreadCurrentStack without
- * popping.
- */
- PICurrent peekPICurrent( ) {
- return (PICurrent) currentContainer.get( currentIndex - 1);
- }
-
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/orbutil/DefineWrapper.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/orbutil/DefineWrapper.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2001, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.orbutil ;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-/** This class provides just a main method. Its purpose is to allow -D arguments to
-* set up the system properties when starting programs with tools like OptimizeIt that
-* make this difficult or impossible.
-*
-* Invocation: {java launcher of some kind} DefineClass -Dxxx=yyy -Dxxx=yyy ... {class name} arg0, arg1, ...
-* Result: updates system properties with -D args, then uses reflection to invoke {class name}.main with the args
-*/
-
-class DefineWrapper {
- public static void main( String[] args )
- {
- int numberDefines = args.length ;
- String className = null ;
-
- for (int ctr=0; ctr and get methods.
-
-
- //
- // Perform case sensitivity test first. This applies to all
- // method names AND attributes. Compare each method name and
- // attribute to all other method names and attributes. If names
- // differ only in case, apply mangling as defined in section 1.3.2.7
- // of Java2IDL spec. Note that we compare using the original names.
- //
- for(Iterator outerIter=allMethodInfo.values().iterator();
- outerIter.hasNext();) {
- IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
- for(Iterator innerIter = allMethodInfo.values().iterator();
- innerIter.hasNext();) {
- IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
-
- if( (outer != inner) &&
- (!outer.originalName.equals(inner.originalName)) &&
- outer.originalName.equalsIgnoreCase(inner.originalName) ) {
- outer.mangledName =
- mangleCaseSensitiveCollision(outer.originalName);
- break;
- }
-
- }
- }
-
- for(Iterator iter = allMethodInfo.values().iterator();
- iter.hasNext();) {
- IDLMethodInfo next = (IDLMethodcurrentInfo) iter.next();
- next.mangledName =
- mangleIdentifier(next.mangledName,
- next.propertyType != null);
- }
-
- //
- // Now check for overloaded method names and apply 1.3.2.6.
- //
- for(Iterator outerIter=allMethodInfo.values().iterator();
- outerIter.hasNext();) {
- IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
- if (outer.propertyType != null) {
- continue;
- }
- for(Iterator innerIter = allMethodInfo.values().iterator();
- innerIter.hasNext();) {
- IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
-
- if( (outer != inner) &&
- (inner.propertyType == null) &&
- outer.originalName.equals(inner.originalName) ) {
- outer.mangledName = mangleOverloadedMethod
- (outer.mangledName, outer.method);
- break;
- }
- }
- }
-
- //
- // Now mangle any properties that clash with method names.
- //
- for(Iterator outerIter=allMethodInfo.values().iterator();
- outerIter.hasNext();) {
- IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
- if(outer.propertyType == null) {
- continue;
- }
- for(Iterator innerIter = allMethodInfo.values().iterator();
- innerIter.hasNext();) {
- IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
- if( (outer != inner) &&
- (inner.propertyType == null) &&
- outer.mangledName.equals(inner.mangledName) ) {
- outer.mangledName = outer.mangledName +
- ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS;
- break;
- }
- }
- }
-
- //
- // Ensure that no mapped method names clash with mapped name
- // of container(1.3.2.9). This is a case insensitive comparison.
- //
- for (int ctr=0; ctr and get,
- // map only is to an attribute, and leave the
- // get method alone.
- if( IDLNameToMethodMap_.containsKey(idlName) ) {
- // @@@ I18N
- Method clash = (Method) IDLNameToMethodMap_.get(idlName);
- MethodInfo clashMethodInfo =
- (MethodInfo)allMethodInfo.get( clash ) ;
- if (clashMethodInfo.isBooleanProperty() &&
- next.isReadProperty()) {
- // fix idlName
- } else if (clashMethodInfo.isReadProperty() &&
- next.isBooleanProperty()) {
- // Remove entry under idlName
- // put entry into table under correct name
- } else {
- throw new IllegalStateException("Error : methods " +
- clash + " and " + next.method +
- " both result in IDL name '" + idlName + "'");
- }
- }
-
- IDLNameToMethodMap_.put(idlName, next.method);
- }
-
- return;
-
- }
-
-
- /**
- * Perform all necessary stand-alone identifier mangling operations
- * on a java identifier that is being transformed into an IDL name.
- * That is, mangling operations that don't require looking at anything
- * else but the identifier itself. This covers sections 1.3.2.2, 1.3.2.3,
- * and 1.3.2.4 of the Java2IDL spec. Method overloading and
- * case-sensitivity checks are handled elsewhere.
- */
-
- private static String mangleIdentifier(String identifier) {
- return mangleIdentifier(identifier, false);
- }
-
- private static String mangleIdentifier(String identifier, boolean attribute) {
-
- String mangledName = identifier;
-
- //
- // Apply leading underscore test (1.3.2.3)
- // This should be done before IDL Keyword clash test, since clashing
- // IDL keywords are mangled by adding a leading underscore.
- //
- if( hasLeadingUnderscore(mangledName) ) {
- mangledName = mangleLeadingUnderscore(mangledName);
- }
-
- //
- // Apply IDL keyword clash test (1.3.2.2).
- // This is not needed for attributes since when the full property
- // name is composed it cannot clash with an IDL keyword.
- // (Also, rmic doesn't do it.)
- //
-
- if( !attribute && isIDLKeyword(mangledName) ) {
- mangledName = mangleIDLKeywordClash(mangledName);
- }
-
- //
- // Replace illegal IDL identifier characters (1.3.2.4)
- // for all method names and attributes.
- //
- if( !isIDLIdentifier(mangledName) ) {
- mangledName = mangleUnicodeChars(mangledName);
- }
-
- return mangledName;
- }
-
- /**
- * Checks whether a java identifier clashes with an
- * IDL keyword. Note that this is a case-insensitive
- * comparison.
- *
- * Used to implement section 1.3.2.2 of Java2IDL spec.
- */
- private static boolean isIDLKeyword(String identifier) {
-
- String identifierAllCaps = identifier.toUpperCase();
-
- return idlKeywords_.contains(identifierAllCaps);
- }
-
- private static String mangleIDLKeywordClash(String identifier) {
- return UNDERSCORE + identifier;
- }
-
- private static String mangleLeadingUnderscore(String identifier) {
- return LEADING_UNDERSCORE_CHAR + identifier;
- }
-
- /**
- * Checks whether a java identifier starts with an underscore.
- * Used to implement section 1.3.2.3 of Java2IDL spec.
- */
- private static boolean hasLeadingUnderscore(String identifier) {
- return identifier.startsWith(UNDERSCORE);
- }
-
- /**
- * Implements Section 1.3.2.4 of Java2IDL Mapping.
- * All non-IDL identifier characters must be replaced
- * with their Unicode representation.
- */
- static String mangleUnicodeChars(String identifier) {
- StringBuffer mangledIdentifier = new StringBuffer();
-
- for(int i = 0; i < identifier.length(); i++) {
- char nextChar = identifier.charAt(i);
- if( isIDLIdentifierChar(nextChar) ) {
- mangledIdentifier.append(nextChar);
- } else {
- String unicode = charToUnicodeRepresentation(nextChar);
- mangledIdentifier.append(unicode);
- }
- }
-
- return mangledIdentifier.toString();
- }
-
- /**
- * Implements mangling portion of Section 1.3.2.7 of Java2IDL spec.
- * This method only deals with the actual mangling. Decision about
- * whether case-sensitive collision mangling is required is made
- * elsewhere.
- *
- *
- * "...a mangled name is generated consisting of the original name
- * followed by an underscore separated list of decimal indices
- * into the string, where the indices identify all the upper case
- * characters in the original string. Indices are zero based."
- *
- */
- String mangleCaseSensitiveCollision(String identifier) {
-
- StringBuffer mangledIdentifier = new StringBuffer(identifier);
-
- // There is always at least one trailing underscore, whether or
- // not the identifier has uppercase letters.
- mangledIdentifier.append(UNDERSCORE);
-
- boolean needUnderscore = false;
- for(int i = 0; i < identifier.length(); i++) {
- char next = identifier.charAt(i);
- if( Character.isUpperCase(next) ) {
- // This bit of logic is needed to ensure that we have
- // an underscore separated list of indices but no
- // trailing underscores. Basically, after we have at least
- // one uppercase letter, we always put an undercore before
- // printing the next one.
- if( needUnderscore ) {
- mangledIdentifier.append(UNDERSCORE);
- }
- mangledIdentifier.append(i);
- needUnderscore = true;
- }
- }
-
- return mangledIdentifier.toString();
- }
-
- private static String mangleContainerClash(String identifier) {
- return identifier + ID_CONTAINER_CLASH_CHAR;
- }
-
- /**
- * Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this
- * context means the name of the java Class(excluding package) in which
- * the identifier is defined. Comparison is case-insensitive.
- */
- private static boolean identifierClashesWithContainer
- (String mappedContainerName, String identifier) {
-
- return identifier.equalsIgnoreCase(mappedContainerName);
- }
-
- /**
- * Returns Unicode mangling as defined in Section 1.3.2.4 of
- * Java2IDL spec.
- *
- * "For Java identifiers that contain illegal OMG IDL identifier
- * characters such as '$' or Unicode characters outside of ISO Latin 1,
- * any such illegal characters are replaced by "U" followed by the
- * 4 hexadecimal characters(in upper case) representing the Unicode
- * value. So, the Java name a$b is mapped to aU0024b and
- * x\u03bCy is mapped to xU03BCy."
- */
- public static String charToUnicodeRepresentation(char c) {
-
- int orig = (int) c;
- StringBuffer hexString = new StringBuffer();
-
- int value = orig;
-
- while( value > 0 ) {
- int div = value / 16;
- int mod = value % 16;
- hexString.insert(0, HEX_DIGITS[mod]);
- value = div;
- }
-
- int numZerosToAdd = 4 - hexString.length();
- for(int i = 0; i < numZerosToAdd; i++) {
- hexString.insert(0, "0");
- }
-
- hexString.insert(0, "U");
- return hexString.toString();
- }
-
- private static boolean isIDLIdentifier(String identifier) {
-
- boolean isIdentifier = true;
-
- for(int i = 0; i < identifier.length(); i++) {
- char nextChar = identifier.charAt(i);
- // 1st char must be alphbetic.
- isIdentifier = (i == 0) ?
- isIDLAlphabeticChar(nextChar) :
- isIDLIdentifierChar(nextChar);
- if( !isIdentifier ) {
- break;
- }
- }
-
- return isIdentifier;
-
- }
-
- private static boolean isIDLIdentifierChar(char c) {
- return (isIDLAlphabeticChar(c) ||
- isIDLDecimalDigit(c) ||
- isUnderscore(c));
- }
-
- /**
- * True if character is one of 114 Alphabetic characters as
- * specified in Table 2 of Chapter 3 in CORBA spec.
- */
- private static boolean isIDLAlphabeticChar(char c) {
-
- // NOTE that we can't use the java.lang.Character
- // isUpperCase, isLowerCase, etc. methods since they
- // include many characters other than the Alphabetic list in
- // the CORBA spec. Instead, we test for inclusion in the
- // Unicode value ranges for the corresponding legal characters.
-
- boolean alphaChar =
- (
- // A - Z
- ((c >= 0x0041) && (c <= 0x005A))
-
- ||
-
- // a - z
- ((c >= 0x0061) && (c <= 0x007A))
-
- ||
-
- // other letter uppercase, other letter lowercase, which is
- // the entire upper half of C1 Controls except X and /
- ((c >= 0x00C0) && (c <= 0x00FF)
- && (c != 0x00D7) && (c != 0x00F7)));
-
- return alphaChar;
- }
-
- /**
- * True if character is one of 10 Decimal Digits
- * specified in Table 3 of Chapter 3 in CORBA spec.
- */
- private static boolean isIDLDecimalDigit(char c) {
- return ( (c >= 0x0030) && (c <= 0x0039) );
- }
-
- private static boolean isUnderscore(char c) {
- return ( c == 0x005F );
- }
-
- /**
- * Mangle an overloaded method name as defined in Section 1.3.2.6 of
- * Java2IDL spec. Current value of method name is passed in as argument.
- * We can't start from original method name since the name might have
- * been partially mangled as a result of the other rules.
- */
- private static String mangleOverloadedMethod(String mangledName, Method m) {
-
- IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
-
- // Start by appending the separator string
- String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR;
-
- Class[] parameterTypes = m.getParameterTypes();
-
- for(int i = 0; i < parameterTypes.length; i++) {
- Class nextParamType = parameterTypes[i];
-
- if( i > 0 ) {
- newMangledName = newMangledName + OVERLOADED_TYPE_SEPARATOR;
- }
- IDLType idlType = classToIDLType(nextParamType);
-
- String moduleName = idlType.getModuleName();
- String memberName = idlType.getMemberName();
-
- String typeName = (moduleName.length() > 0) ?
- moduleName + UNDERSCORE + memberName : memberName;
-
- if( !idlTypesUtil.isPrimitive(nextParamType) &&
- (idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType)
- == null) &&
- isIDLKeyword(typeName) ) {
- typeName = mangleIDLKeywordClash(typeName);
- }
-
- typeName = mangleUnicodeChars(typeName);
-
- newMangledName = newMangledName + typeName;
- }
-
- return newMangledName;
- }
-
-
- private static IDLType classToIDLType(Class c) {
-
- IDLType idlType = null;
- IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
-
- if( idlTypesUtil.isPrimitive(c) ) {
-
- idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c);
-
- } else if( c.isArray() ) {
-
- // Calculate array depth, as well as base element type.
- Class componentType = c.getComponentType();
- int numArrayDimensions = 1;
- while(componentType.isArray()) {
- componentType = componentType.getComponentType();
- numArrayDimensions++;
- }
- IDLType componentIdlType = classToIDLType(componentType);
-
- String[] modules = BASE_IDL_ARRAY_MODULE_TYPE;
- if( componentIdlType.hasModule() ) {
- modules = (String[])ObjectUtility.concatenateArrays( modules,
- componentIdlType.getModules() ) ;
- }
-
- String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE +
- numArrayDimensions + UNDERSCORE +
- componentIdlType.getMemberName();
-
- idlType = new IDLType(c, modules, memberName);
-
- } else {
- idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c);
-
- if (idlType == null) {
- // Section 1.3.2.5 of Java2IDL spec defines mangling rules for
- // inner classes.
- String memberName = getUnmappedContainerName(c);
-
- // replace inner class separator with double underscore
- memberName = memberName.replaceAll("\\$",
- INNER_CLASS_SEPARATOR);
-
- if( hasLeadingUnderscore(memberName) ) {
- memberName = mangleLeadingUnderscore(memberName);
- }
-
- // Get raw package name. If there is a package, it
- // will still have the "." separators and none of the
- // mangling rules will have been applied.
- String packageName = getPackageName(c);
-
- if (packageName == null) {
- idlType = new IDLType( c, memberName ) ;
- } else {
- // If this is a generated IDL Entity Type we need to
- // prepend org_omg_boxedIDL per sections 1.3.5 and 1.3.9
- if (idlTypesUtil.isEntity(c)) {
- packageName = "org.omg.boxedIDL." + packageName ;
- }
-
- // Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines
- // rules for mapping java packages to IDL modules and for
- // mangling module name portion of type name. NOTE that
- // of the individual identifier mangling rules,
- // only the leading underscore test is done here.
- // The other two(IDL Keyword, Illegal Unicode chars) are
- // done in mangleOverloadedMethodName.
- StringTokenizer tokenizer =
- new StringTokenizer(packageName, ".");
-
- String[] modules = new String[ tokenizer.countTokens() ] ;
- int index = 0 ;
- while (tokenizer.hasMoreElements()) {
- String next = tokenizer.nextToken();
- String nextMangled = hasLeadingUnderscore(next) ?
- mangleLeadingUnderscore(next) : next;
-
- modules[index++] = nextMangled ;
- }
-
- idlType = new IDLType(c, modules, memberName);
- }
- }
- }
-
- return idlType;
- }
-
- /**
- * Return Class' package name or null if there is no package.
- */
- private static String getPackageName(Class c) {
- Package thePackage = c.getPackage();
- String packageName = null;
-
- // Try to get package name by introspection. Some classloaders might
- // not provide this information, so check for null.
- if( thePackage != null ) {
- packageName = thePackage.getName();
- } else {
- // brute force method
- String fullyQualifiedClassName = c.getName();
- int lastDot = fullyQualifiedClassName.indexOf('.');
- packageName = (lastDot == -1) ? null :
- fullyQualifiedClassName.substring(0, lastDot);
- }
- return packageName;
- }
-
- private static String getMappedContainerName(Class c) {
- String unmappedName = getUnmappedContainerName(c);
-
- return mangleIdentifier(unmappedName);
- }
-
- /**
- * Return portion of class name excluding package name.
- */
- private static String getUnmappedContainerName(Class c) {
-
- String memberName = null;
- String packageName = getPackageName(c);
-
- String fullyQualifiedClassName = c.getName();
-
- if( packageName != null ) {
- int packageLength = packageName.length();
- memberName = fullyQualifiedClassName.substring(packageLength + 1);
- } else {
- memberName = fullyQualifiedClassName;
-
- }
-
- return memberName;
- }
-
- /**
- * Internal helper class for tracking information related to each
- * interface method while we're building the name translation table.
- */
- private static class IDLMethodInfo
- {
- public Method method;
- public String propertyType;
-
- // If this is a property, originalName holds the original
- // attribute name. Otherwise, it holds the original method name.
- public String originalName;
-
- // If this is a property, mangledName holds the mangled attribute
- // name. Otherwise, it holds the mangled method name.
- public String mangledName;
-
- }
-
- public String toString() {
-
- StringBuffer contents = new StringBuffer();
- contents.append("IDLNameTranslator[" );
- for( int ctr=0; ctr 0 ) {
- String className = args[0];
- try {
- remoteInterface = Class.forName(className);
- } catch(Exception e) {
- e.printStackTrace();
- System.exit(-1);
- }
- }
-
- System.out.println("Building name translation for " + remoteInterface);
- try {
- IDLNameTranslator nameTranslator =
- IDLNameTranslatorImpl.get(remoteInterface);
- System.out.println(nameTranslator);
- } catch(IllegalStateException ise) {
- ise.printStackTrace();
- }
- }
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil_save.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,544 +0,0 @@
-/*
- * Copyright (c) 2004, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.presentation.rmi ;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Field;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Iterator;
-
-/**
- * Utility class for testing RMI/IDL Types as defined in
- * Section 1.2 of The Java Language to IDL Mapping. Note that
- * these are static checks only. Runtime checks, such as those
- * described in Section 1.2.3, #3, are not covered.
- */
-public class IDLTypesUtil {
-
- public static final String JAVA_GET_PROPERTY_PREFIX = "get";
- public static final String JAVA_SET_PROPERTY_PREFIX = "set";
- public static final String JAVA_IS_PROPERTY_PREFIX = "is";
-
- public static final int VALID_TYPE = 0;
- public static final int INVALID_TYPE = 1;
-
- /**
- * Validate a class to ensure it conforms to the rules for a
- * Java RMI/IIOP interface.
- *
- * @throws IDLTypeException if not a valid RMI/IIOP interface.
- */
- public void validateRemoteInterface(Class c) throws IDLTypeException
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- if( !c.isInterface() ) {
- String msg = "Class " + c + " must be a java interface.";
- throw new IDLTypeException(msg);
- }
-
- if( !java.rmi.Remote.class.isAssignableFrom(c) ) {
- String msg = "Class " + c + " must extend java.rmi.Remote, " +
- "either directly or indirectly.";
- throw new IDLTypeException(msg);
- }
-
- // Get all methods, including super-interface methods.
- Method[] methods = c.getMethods();
-
- for(int i = 0; i < methods.length; i++) {
- Method next = methods[i];
- validateExceptions(next);
- }
-
- // Removed because of bug 4989053
- // validateDirectInterfaces(c);
- validateConstants(c);
-
- return;
- }
-
- public boolean isRemoteInterface(Class c)
- {
- boolean remoteInterface = true;
- try {
- validateRemoteInterface(c);
- } catch(IDLTypeException ite) {
- remoteInterface = false;
- }
-
- return remoteInterface;
- }
-
- /**
- * Section 1.2.2 Primitive Types
- */
- public boolean isPrimitive(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- return c.isPrimitive();
- }
-
- /**
- * Section 1.2.4
- */
- public boolean isValue(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- return
- (!c.isInterface() &&
- java.io.Serializable.class.isAssignableFrom(c) &&
- !java.rmi.Remote.class.isAssignableFrom(c));
- }
-
- /**
- * Section 1.2.5
- */
- public boolean isArray(Class c)
- {
- boolean arrayType = false;
-
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- if( c.isArray() ) {
- Class componentType = c.getComponentType();
- arrayType =
- (isPrimitive(componentType) || isRemoteInterface(componentType) ||
- isEntity(componentType) || isException(componentType) ||
- isValue(componentType) || isObjectReference(componentType) );
- }
-
- return arrayType;
- }
-
- /**
- * Section 1.2.6
- */
- public boolean isException(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- // Must be a checked exception, not including RemoteException or
- // its subclasses.
- return isCheckedException(c) && !isRemoteException(c) && isValue(c);
- }
-
- public boolean isRemoteException(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- return java.rmi.RemoteException.class.isAssignableFrom(c) ;
- }
-
- public boolean isCheckedException(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- return Throwable.class.isAssignableFrom(c) &&
- !RuntimeException.class.isAssignableFrom(c) &&
- !Error.class.isAssignableFrom(c) ;
- }
-
- /**
- * Section 1.2.7
- */
- public boolean isObjectReference(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- return (c.isInterface() &&
- org.omg.CORBA.Object.class.isAssignableFrom(c));
- }
-
- /**
- * Section 1.2.8
- */
- public boolean isEntity(Class c)
- {
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- Class superClass = c.getSuperclass();
- return (!c.isInterface() &&
- (superClass != null) &&
- (org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c)));
- }
-
- public String javaPropertyPrefixToIDL( String javaPrefix )
- {
- return "_" + javaPrefix + "_" ;
- }
-
- /**
- * Return the property type if given method is legal property accessor as defined in
- * Section 1.3.4.3 of Java2IDL spec. Result is one of: JAVA_GET_PROPERTY_PREFIX,
- * JAVA_SET_PROPERTY_PREFIX, JAVA_IS_PROPERTY_PREFIX.
- */
- public String propertyAccessorMethodType(Method m, Class c) {
-
- String methodName = m.getName();
- Class returnType = m.getReturnType();
- Class[] parameters = m.getParameterTypes();
- Class[] exceptionTypes = m.getExceptionTypes();
- String propertyType = null;
-
- if( methodName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) {
-
- if((parameters.length == 0) && (returnType != Void.TYPE) &&
- !hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX) {
- propertyType = JAVA_GET_PROPERTY_PREFIX;
- }
-
- } else if( methodName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) {
-
- if((returnType == Void.TYPE) && (parameters.length == 1)) {
- if (hasCorrespondingReadProperty(m, c, JAVA_GET_PROPERTY_PREFIX) ||
- hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX)) {
- propertyType = JAVA_SET_PROPERTY_PREFIX;
- }
- }
-
- } else if( methodName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) {
- if((parameters.length == 0) && (returnType == Boolean.TYPE)) {
- propertyType = JAVA_IS_PROPERTY_PREFIX;
- }
- }
-
- // Some final checks that apply to all properties.
- if( propertyType != null ) {
- if(!validPropertyExceptions(m) ||
- (methodName.length() <= propertyType.length())) {
- propertyType = null;
- }
- }
-
- return propertyType ;
- }
-
- private boolean hasCorrespondingReadProperty
- (Method writeProperty, Class c, String readPropertyPrefix) {
-
- String writePropertyMethodName = writeProperty.getName();
- Class[] writePropertyParameters = writeProperty.getParameterTypes();
- boolean foundReadProperty = false;
-
- try {
- // Look for a valid corresponding Read property
- String readPropertyMethodName =
- writePropertyMethodName.replaceFirst
- (JAVA_SET_PROPERTY_PREFIX, readPropertyPrefix);
- Method readPropertyMethod = c.getMethod(readPropertyMethodName,
- new Class[] {});
- foundReadProperty =
- ((propertyAccessorMethodType(readPropertyMethod, c) != null) &&
- (readPropertyMethod.getReturnType() ==
- writePropertyParameters[0]));
- } catch(Exception e) {
- // ignore. this means we didn't find a corresponding get property.
- }
-
- return foundReadProperty;
- }
-
- public String getAttributeNameForProperty(String propertyName) {
- String attributeName = null;
- String prefix = null;
-
- if( propertyName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) {
- prefix = JAVA_GET_PROPERTY_PREFIX;
- } else if( propertyName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) {
- prefix = JAVA_SET_PROPERTY_PREFIX;
- } else if( propertyName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) {
- prefix = JAVA_IS_PROPERTY_PREFIX;
- }
-
- if( (prefix != null) && (prefix.length() < propertyName.length()) ) {
- String remainder = propertyName.substring(prefix.length());
- if( (remainder.length() >= 2) &&
- Character.isUpperCase(remainder.charAt(0)) &&
- Character.isUpperCase(remainder.charAt(1)) ) {
- // don't set the first letter to lower-case if the
- // first two are upper-case
- attributeName = remainder;
- } else {
- attributeName = Character.toLowerCase(remainder.charAt(0)) +
- remainder.substring(1);
- }
- }
-
- return attributeName;
- }
-
- /**
- * Return IDL Type name for primitive types as defined in
- * Section 1.3.3 of Java2IDL spec or null if not a primitive type.
- */
- public IDLType getPrimitiveIDLTypeMapping(Class c) {
-
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- if( c.isPrimitive() ) {
- if( c == Void.TYPE ) {
- return new IDLType( c, "void" ) ;
- } else if( c == Boolean.TYPE ) {
- return new IDLType( c, "boolean" ) ;
- } else if( c == Character.TYPE ) {
- return new IDLType( c, "wchar" ) ;
- } else if( c == Byte.TYPE ) {
- return new IDLType( c, "octet" ) ;
- } else if( c == Short.TYPE ) {
- return new IDLType( c, "short" ) ;
- } else if( c == Integer.TYPE ) {
- return new IDLType( c, "long" ) ;
- } else if( c == Long.TYPE ) {
- return new IDLType( c, "long_long" ) ;
- } else if( c == Float.TYPE ) {
- return new IDLType( c, "float" ) ;
- } else if( c == Double.TYPE ) {
- return new IDLType( c, "double" ) ;
- }
- }
-
- return null;
- }
-
- /**
- * Return IDL Type name for special case type mappings as defined in
- * Table 1-1 of Java2IDL spec or null if given class is not a special
- * type.
- */
- public IDLType getSpecialCaseIDLTypeMapping(Class c) {
-
- if( c == null ) {
- throw new IllegalArgumentException();
- }
-
- if( c == java.lang.Object.class ) {
- return new IDLType( c, new String[] { "java", "lang" },
- "Object" ) ;
- } else if( c == java.lang.String.class ) {
- return new IDLType( c, new String[] { "CORBA" },
- "WStringValue" ) ;
- } else if( c == java.lang.Class.class ) {
- return new IDLType( c, new String[] { "javax", "rmi", "CORBA" },
- "ClassDesc" ) ;
- } else if( c == java.io.Serializable.class ) {
- return new IDLType( c, new String[] { "java", "io" },
- "Serializable" ) ;
- } else if( c == java.io.Externalizable.class ) {
- return new IDLType( c, new String[] { "java", "io" },
- "Externalizable" ) ;
- } else if( c == java.rmi.Remote.class ) {
- return new IDLType( c, new String[] { "java", "rmi" },
- "Remote" ) ;
- } else if( c == org.omg.CORBA.Object.class ) {
- return new IDLType( c, "Object" ) ;
- } else {
- return null;
- }
- }
-
- /**
- * Implements 1.2.3 #2 and #4
- */
- private void validateExceptions(Method method) throws IDLTypeException {
-
- Class[] exceptions = method.getExceptionTypes();
-
- boolean declaresRemoteExceptionOrSuperClass = false;
-
- // Section 1.2.3, #2
- for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
- Class exception = exceptions[eIndex];
- if( isRemoteExceptionOrSuperClass(exception) ) {
- declaresRemoteExceptionOrSuperClass = true;
- break;
- }
- }
-
- if( !declaresRemoteExceptionOrSuperClass ) {
- String msg = "Method '" + method + "' must throw at least one " +
- "exception of type java.rmi.RemoteException or one of its " +
- "super-classes";
- throw new IDLTypeException(msg);
- }
-
- // Section 1.2.3, #4
- // See also bug 4972402
- // For all exceptions E in exceptions,
- // (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) )
- for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
- Class exception = exceptions[eIndex];
-
- if (isCheckedException(exception) && !isValue(exception) &&
- !isRemoteException(exception))
- {
- String msg = "Exception '" + exception + "' on method '" +
- method + "' is not a allowed RMI/IIOP exception type";
- throw new IDLTypeException(msg);
- }
- }
-
- return;
- }
-
- /**
- * Returns true if the method's throw clause conforms to the exception
- * restrictions for properties as defined in Section 1.3.4.3 of
- * Java2IDL spec. This means that for all exceptions E declared on the
- * method, E isChecked => RemoteException.isAssignableFrom( E ).
- */
- private boolean validPropertyExceptions(Method method)
- {
- Class[] exceptions = method.getExceptionTypes();
-
- for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
- Class exception = exceptions[eIndex];
-
- if (isCheckedException(exception) && !isRemoteException(exception))
- return false ;
- }
-
- return true;
- }
-
- /**
- * Implements Section 1.2.3, #2.
- */
- private boolean isRemoteExceptionOrSuperClass(Class c) {
- return
- ((c == java.rmi.RemoteException.class) ||
- (c == java.io.IOException.class) ||
- (c == java.lang.Exception.class) ||
- (c == java.lang.Throwable.class));
- }
-
- /**
- * Implements Section 1.2.3, #5.
- */
- private void validateDirectInterfaces(Class c) throws IDLTypeException {
-
- Class[] directInterfaces = c.getInterfaces();
-
- if( directInterfaces.length < 2 ) {
- return;
- }
-
- Set allMethodNames = new HashSet();
- Set currentMethodNames = new HashSet();
-
- for(int i = 0; i < directInterfaces.length; i++) {
- Class next = directInterfaces[i];
- Method[] methods = next.getMethods();
-
- // Comparison is based on method names only. First collect
- // all methods from current interface, eliminating duplicate
- // names.
- currentMethodNames.clear();
- for(int m = 0; m < methods.length; m++) {
- currentMethodNames.add(methods[m].getName());
- }
-
- // Now check each method against list of all unique method
- // names processed so far.
- for(Iterator iter=currentMethodNames.iterator(); iter.hasNext();) {
- String methodName = (String) iter.next();
- if( allMethodNames.contains(methodName) ) {
- String msg = "Class " + c + " inherits method " +
- methodName + " from multiple direct interfaces.";
- throw new IDLTypeException(msg);
- } else {
- allMethodNames.add(methodName);
- }
- }
- }
-
- return;
- }
-
- /**
- * Implements 1.2.3 #6
- */
- private void validateConstants(final Class c)
- throws IDLTypeException {
-
- Field[] fields = null;
-
- try {
- fields = (Field[])
- java.security.AccessController.doPrivileged
- (new java.security.PrivilegedExceptionAction() {
- public java.lang.Object run() throws Exception {
- return c.getFields();
- }
- });
- } catch(java.security.PrivilegedActionException pae) {
- IDLTypeException ite = new IDLTypeException();
- ite.initCause(pae);
- throw ite;
- }
-
- for(int i = 0; i < fields.length; i++) {
- Field next = fields[i];
- Class fieldType = next.getType();
- if( (fieldType != java.lang.String.class) &&
- !isPrimitive(fieldType) ) {
- String msg = "Constant field '" + next.getName() +
- "' in class '" + next.getDeclaringClass().getName() +
- "' has invalid type' " + next.getType() + "'. Constants" +
- " in RMI/IIOP interfaces can only have primitive" +
- " types and java.lang.String types.";
- throw new IDLTypeException(msg);
- }
- }
-
-
- return;
- }
-
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientRequestImpl.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.iiop;
-
-import com.sun.corba.se.impl.protocol.Request;
-import com.sun.corba.se.impl.core.ClientRequest;
-import com.sun.corba.se.impl.core.ServiceContext;
-import com.sun.corba.se.impl.core.ServiceContexts;
-import com.sun.corba.se.impl.core.ClientResponse;
-import com.sun.corba.se.impl.core.ServerRequest;
-import com.sun.corba.se.impl.core.ServerResponse;
-import com.sun.corba.se.impl.corba.IOR;
-import com.sun.corba.se.impl.corba.GIOPVersion;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.core.ORBVersion;
-import com.sun.corba.se.impl.core.ORB;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.ior.ObjectKeyFactory ;
-import com.sun.corba.se.impl.ior.ObjectKey ;
-import com.sun.corba.se.impl.ior.ObjectKeyTemplate ;
-import com.sun.corba.se.impl.ior.IIOPProfile;
-
-public class LocalClientRequestImpl extends IIOPOutputStream
- implements ClientRequest
-{
- public LocalClientRequestImpl( GIOPVersion gv,
- ORB orb, IOR ior, short addrDisposition,
- String operationName, boolean oneway, ServiceContexts svc,
- int requestId, byte streamFormatVersion)
- {
- super(gv,
- orb,
- null,
- BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW),
- streamFormatVersion);
-
- this.isOneway = oneway;
- boolean responseExpected = !isOneway;
-
- IIOPProfile iop = ior.getProfile();
- ObjectKey okey = iop.getObjectKey();
- ObjectKeyTemplate oktemp = okey.getTemplate() ;
- ORBVersion version = oktemp.getORBVersion() ;
- orb.setORBVersion( version ) ;
-
- this.request = MessageBase.createRequest(orb, gv, requestId,
- responseExpected, ior, addrDisposition, operationName, svc, null);
- setMessage(request);
- request.write(this);
-
- // mark beginning of msg body for possible later use
- bodyBegin = getSize();
- }
-
- public int getRequestId() {
- return request.getRequestId();
- }
-
- public boolean isOneWay() {
- return isOneway;
- }
-
- public ServiceContexts getServiceContexts() {
- return request.getServiceContexts();
- }
-
- public String getOperationName() {
- return request.getOperation();
- }
-
- public ObjectKey getObjectKey() {
- return request.getObjectKey();
- }
-
- public ServerRequest getServerRequest()
- {
- // Set the size of the marshalled data in the message header.
- getMessage().setSize( getByteBuffer(), getSize() ) ;
-
- // Construct a new ServerRequest out of the buffer in this ClientRequest
- LocalServerRequestImpl serverRequest = new LocalServerRequestImpl(
- (ORB)orb(), toByteArray(), request ) ;
-
- // Skip over all of the GIOP header information. This positions
- // the offset in the buffer so that the skeleton can correctly read
- // the marshalled arguments.
- serverRequest.setIndex( bodyBegin ) ;
-
- return serverRequest ;
- }
-
- public ClientResponse invoke()
- {
- ORB myORB = (ORB)orb() ;
-
- ServerResponse serverResponse = myORB.process( getServerRequest() ) ;
-
- LocalServerResponseImpl lsr = (LocalServerResponseImpl)serverResponse ;
-
- return lsr.getClientResponse() ;
- }
-
- /**
- * Check to see if the request is local.
- */
- public boolean isLocal(){
- return true;
- }
-
- private RequestMessage request;
- private int bodyBegin;
- private boolean isOneway;
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalClientResponseImpl.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.iiop;
-
-import java.io.IOException;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.CompletionStatus;
-
-import com.sun.corba.se.impl.core.Response;
-import com.sun.corba.se.impl.core.ClientResponse;
-import com.sun.corba.se.impl.corba.IOR;
-import com.sun.corba.se.impl.core.ORB;
-import com.sun.corba.se.impl.core.ServiceContext;
-import com.sun.corba.se.impl.core.ServiceContexts;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-import com.sun.corba.se.impl.orbutil.MinorCodes;
-
-class LocalClientResponseImpl extends IIOPInputStream implements ClientResponse
-{
- LocalClientResponseImpl(ORB orb, byte[] buf, ReplyMessage header)
- {
- super(orb, buf, header.getSize(), header.isLittleEndian(), header, null);
-
- this.reply = header;
-
- // NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin)
- // in LocalServerResponse.getClientResponse(), then we do not need
- // to read the headers (done below) anymore.
- // This will be an optimisation which is can be done to speed up the
- // local invocation by avoiding reading the headers in the local cases.
-
- // BUGFIX(Ram Jeyaraman) This has been moved from
- // LocalServerResponse.getClientResponse()
- // Skip over all of the GIOP header information. This positions
- // the offset in the buffer so that the skeleton can correctly read
- // the marshalled arguments.
- this.setIndex(Message.GIOPMessageHeaderLength);
-
- // BUGFIX(Ram Jeyaraman) For local invocations, the reply mesg fields
- // needs to be set, by reading the response buffer contents
- // to correctly set the exception type and other info.
- this.reply.read(this);
- }
-
- LocalClientResponseImpl(SystemException ex)
- {
- this.systemException = ex;
- }
-
- public boolean isSystemException() {
- if ( reply != null )
- return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION;
- else
- return (systemException != null);
- }
-
- public boolean isUserException() {
- if ( reply != null )
- return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION;
- else
- return false;
- }
-
- public boolean isLocationForward() {
- if ( reply != null ) {
- return ( (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) ||
- (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM) );
- //return reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD;
- } else {
- return false;
- }
- }
-
- public boolean isDifferentAddrDispositionRequested() {
- if (reply != null) {
- return reply.getReplyStatus() == ReplyMessage.NEEDS_ADDRESSING_MODE;
- }
-
- return false;
- }
-
- public short getAddrDisposition() {
- if (reply != null) {
- return reply.getAddrDisposition();
- }
-
- throw new org.omg.CORBA.INTERNAL(
- "Null reply in getAddrDisposition",
- MinorCodes.NULL_REPLY_IN_GET_ADDR_DISPOSITION,
- CompletionStatus.COMPLETED_MAYBE);
- }
-
- public IOR getForwardedIOR() {
- if ( reply != null )
- return reply.getIOR();
- else
- return null;
- }
-
- public int getRequestId() {
- if ( reply != null )
- return reply.getRequestId();
- else
- throw new org.omg.CORBA.INTERNAL("Error in getRequestId");
- }
-
- public ServiceContexts getServiceContexts() {
- if ( reply != null )
- return reply.getServiceContexts();
- else
- return null;
- }
-
- public SystemException getSystemException() {
- if ( reply != null )
- return reply.getSystemException();
- else
- return systemException;
- }
-
- public java.lang.String peekUserExceptionId() {
- mark(Integer.MAX_VALUE);
- String result = read_string();
- reset();
- return result;
- }
-
- /**
- * Check to see if the response is local.
- */
- public boolean isLocal(){
- return true;
- }
-
- private ReplyMessage reply;
- private SystemException systemException;
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerRequestImpl.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.iiop;
-
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.impl.core.ServerRequest;
-import com.sun.corba.se.impl.core.ServiceContext;
-import com.sun.corba.se.impl.core.DuplicateServiceContext;
-import com.sun.corba.se.impl.core.UEInfoServiceContext;
-import com.sun.corba.se.impl.core.ServiceContexts;
-import com.sun.corba.se.impl.core.ServerResponse;
-import com.sun.corba.se.impl.corba.IOR;
-import com.sun.corba.se.impl.core.ORB;
-import com.sun.corba.se.impl.orbutil.ORBUtility; //d11638
-import org.omg.CORBA.portable.UnknownException;
-import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.CompletionStatus;
-import com.sun.corba.se.impl.ior.ObjectKey;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
-
-class LocalServerRequestImpl extends IIOPInputStream implements ServerRequest {
- org.omg.CORBA.portable.OutputStream replyStream;
- org.omg.CORBA.portable.OutputStream exceptionReplyStream;
-
- LocalServerRequestImpl(ORB orb, byte[] buf, RequestMessage header)
- {
- super(orb, buf, header.getSize(), header.isLittleEndian(), header, null );
-
- this.request = header;
- }
-
- public int getRequestId() {
- return request.getRequestId();
- }
-
- public boolean isOneWay() {
- return !request.isResponseExpected();
- }
-
- public ServiceContexts getServiceContexts() {
- return request.getServiceContexts();
- }
-
- public String getOperationName() {
- return request.getOperation();
- }
-
- public ObjectKey getObjectKey() {
- return request.getObjectKey();
- }
-
- public ServerResponse createResponse(ServiceContexts svc)
- {
- return new LocalServerResponseImpl(this, svc);
- }
-
- public org.omg.CORBA.portable.OutputStream createReply() {
- if (replyStream == null) {
- replyStream = (org.omg.CORBA.portable.OutputStream)
- createResponse(null);
- }
- return replyStream;
- }
-
- public org.omg.CORBA.portable.OutputStream createExceptionReply() {
- if (exceptionReplyStream == null) {
- exceptionReplyStream = (org.omg.CORBA.portable.OutputStream)
- createUserExceptionResponse(null);
- }
- return exceptionReplyStream;
- }
-
- public ServerResponse createUserExceptionResponse(
- ServiceContexts svc)
- {
- return new LocalServerResponseImpl(this, svc, true);
- }
-
- public ServerResponse createUnknownExceptionResponse(
- UnknownException ex) {
- ServiceContexts contexts = null;
- SystemException sys = new UNKNOWN( 0,
- CompletionStatus.COMPLETED_MAYBE);
-
- try {
- contexts = new ServiceContexts( (ORB)orb() );
- UEInfoServiceContext uei = new UEInfoServiceContext(sys);
- contexts.put(uei) ;
- } catch (DuplicateServiceContext d) {
- // can't happen
- }
-
- return createSystemExceptionResponse(sys,contexts);
- }
-
- public ServerResponse createSystemExceptionResponse(
- SystemException ex, ServiceContexts svc) {
-
- // Only do this if interceptors have been initialized on this request
- // and have not completed their lifecycle (otherwise the info stack
- // may be empty or have a different request's entry on top).
- if (executePIInResponseConstructor()) {
- // Inform Portable Interceptors of the SystemException. This is
- // required to be done here because the ending interception point
- // is called in the ServerResponseImpl constructor called below
- // but we do not currently write the SystemException into the
- // response until after the ending point is called.
- ORB orb = (ORB)orb();
- orb.getPIHandler().setServerPIInfo( ex );
- }
-
- if (orb() != null && ((ORB)orb()).subcontractDebugFlag && ex != null)
- ORBUtility.dprint(this, "Sending SystemException:", ex);
-
- LocalServerResponseImpl response =
- new LocalServerResponseImpl(this, svc, false);
- ORBUtility.writeSystemException(ex, response);
- return response;
- }
-
- public ServerResponse createLocationForward(
- IOR ior, ServiceContexts svc) {
- ReplyMessage reply = MessageBase.createReply( (ORB)orb(),
- request.getGIOPVersion(), request.getRequestId(),
- ReplyMessage.LOCATION_FORWARD, svc, ior);
- LocalServerResponseImpl response =
- new LocalServerResponseImpl(this, reply, ior);
-
- return response;
- }
-
- private RequestMessage request;
-
- /**
- * Check to see if the request is local.
- */
- public boolean isLocal(){
- return true;
- }
-
- private boolean _executeReturnServantInResponseConstructor = false;
-
- public boolean executeReturnServantInResponseConstructor()
- {
- return _executeReturnServantInResponseConstructor;
- }
-
- public void setExecuteReturnServantInResponseConstructor(boolean b)
- {
- _executeReturnServantInResponseConstructor = b;
- }
-
-
- private boolean _executeRemoveThreadInfoInResponseConstructor = false;
-
- public boolean executeRemoveThreadInfoInResponseConstructor()
- {
- return _executeRemoveThreadInfoInResponseConstructor;
- }
-
- public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b)
- {
- _executeRemoveThreadInfoInResponseConstructor = b;
- }
-
-
- private boolean _executePIInResponseConstructor = false;
-
- public boolean executePIInResponseConstructor() {
- return _executePIInResponseConstructor;
- }
-
- public void setExecutePIInResponseConstructor( boolean b ) {
- _executePIInResponseConstructor = b;
- }
-
- // We know that we're talking to the same ValueHandler, so
- // use the maximum version it supports.
- public byte getStreamFormatVersionForReply() {
- return ORBUtility.getMaxStreamFormatVersion();
- }
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/oldlocal/LocalServerResponseImpl.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 1999, 2003, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.iiop;
-
-import org.omg.CORBA.SystemException;
-
-import com.sun.corba.se.impl.core.ServerResponse;
-import com.sun.corba.se.impl.core.ORB;
-import com.sun.corba.se.impl.corba.IOR;
-import com.sun.corba.se.impl.core.ServiceContext;
-import com.sun.corba.se.impl.core.ServiceContexts;
-import com.sun.corba.se.impl.core.ClientResponse;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
-
-class LocalServerResponseImpl
- extends IIOPOutputStream
- implements ServerResponse
-{
- LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc)
- {
- this(request,
- MessageBase.createReply(
- (ORB)request.orb(),
- request.getGIOPVersion(),
- request.getRequestId(), ReplyMessage.NO_EXCEPTION,
- svc, null),
- null);
- }
-
- LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc,
- boolean user)
- {
- this(request,
- MessageBase.createReply(
- (ORB)request.orb(),
- request.getGIOPVersion(), request.getRequestId(),
- user ? ReplyMessage.USER_EXCEPTION :
- ReplyMessage.SYSTEM_EXCEPTION,
- svc, null),
- null);
- }
-
- LocalServerResponseImpl( LocalServerRequestImpl request, ReplyMessage reply,
- IOR ior)
- {
- super(request.getGIOPVersion(),
- (ORB)request.orb(),
- null,
- BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW),
- request.getStreamFormatVersionForReply());
-
- setMessage(reply);
-
- ORB orb = (ORB)request.orb();
-
- ServerResponseImpl.runServantPostInvoke(orb, request);
-
- if( request.executePIInResponseConstructor() ) {
- // Invoke server request ending interception points (send_*):
- // Note: this may end up with a SystemException or an internal
- // Runtime ForwardRequest.
- orb.getPIHandler().invokeServerPIEndingPoint( reply );
-
- // Note this will be executed even if a ForwardRequest or
- // SystemException is thrown by a Portable Interceptors ending
- // point since we end up in this constructor again anyway.
- orb.getPIHandler().cleanupServerPIRequest();
-
- // See (Local)ServerRequestImpl.createSystemExceptionResponse
- // for why this is necesary.
- request.setExecutePIInResponseConstructor(false);
- }
-
- // Once you get here then the final reply is available (i.e.,
- // postinvoke and interceptors have completed.
- if (request.executeRemoveThreadInfoInResponseConstructor()) {
- ServerResponseImpl.removeThreadInfo(orb, request);
- }
-
- reply.write(this);
- if (reply.getIOR() != null)
- reply.getIOR().write(this);
-
- this.reply = reply;
- this.ior = reply.getIOR();
- }
-
- public boolean isSystemException() {
- if (reply != null)
- return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION;
- return false;
- }
-
- public boolean isUserException() {
- if (reply != null)
- return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION;
- return false;
- }
-
- public boolean isLocationForward() {
- if (ior != null)
- return true;
- return false;
- }
-
- public IOR getForwardedIOR() {
- return ior;
- }
-
- public int getRequestId() {
- if (reply != null)
- return reply.getRequestId();
- return -1;
- }
-
- public ServiceContexts getServiceContexts() {
- if (reply != null)
- return reply.getServiceContexts();
- return null;
- }
-
- public SystemException getSystemException() {
- if (reply != null)
- return reply.getSystemException();
- return null;
- }
-
- public ReplyMessage getReply()
- {
- return reply ;
- }
-
- public ClientResponse getClientResponse()
- {
- // set the size of the marshalled data in the message header
- getMessage().setSize(getByteBuffer(), getSize());
-
- // Construct a new ClientResponse out of the buffer in this ClientRequest
- LocalClientResponseImpl result =
- new LocalClientResponseImpl( (ORB)orb(), toByteArray(), reply);
-
- // NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin) here
- // then the LocalClientResponse does not need to read the headers anymore.
- // This will be an optimisation which is can be done to speed up the
- // local invocation by avoiding reading the headers in the local cases.
-
- // BUGFIX(Ram Jeyaraman) result.setOffset is now done in
- // LocalClientResponseImpl constructor.
- /*
- // Skip over all of the GIOP header information. This positions
- // the offset in the buffer so that the skeleton can correctly read
- // the marshalled arguments.
- result.setOffset( bodyBegin ) ;
- */
-
- return result ;
- }
-
- /**
- * Check to see if the response is local.
- */
- public boolean isLocal(){
- return true;
- }
-
- private ReplyMessage reply;
- private IOR ior; // forwarded IOR
-}
diff -r 424d84a2276f -r 9dc631273af7 corba/src/share/classes/com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava
--- a/corba/src/share/classes/com/sun/corba/se/impl/transport/BufferConnectionImpl.sjava Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,710 +0,0 @@
-/*
- * Copyright (c) 2004, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.corba.se.impl.transport;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.nio.ByteBuffer;
-import java.nio.channels.SelectableChannel;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.SocketChannel;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.Hashtable;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.omg.CORBA.COMM_FAILURE;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.DATA_CONVERSION;
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.OBJECT_NOT_EXIST;
-import org.omg.CORBA.SystemException;
-
-import com.sun.org.omg.SendingContext.CodeBase;
-
-import com.sun.corba.se.pept.broker.Broker;
-import com.sun.corba.se.pept.encoding.InputObject;
-import com.sun.corba.se.pept.encoding.OutputObject;
-import com.sun.corba.se.pept.protocol.MessageMediator;
-import com.sun.corba.se.pept.transport.Acceptor;
-import com.sun.corba.se.pept.transport.Connection;
-import com.sun.corba.se.pept.transport.ConnectionCache;
-import com.sun.corba.se.pept.transport.ContactInfo;
-import com.sun.corba.se.pept.transport.EventHandler;
-import com.sun.corba.se.pept.transport.InboundConnectionCache;
-import com.sun.corba.se.pept.transport.OutboundConnectionCache;
-import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
-import com.sun.corba.se.pept.transport.Selector;
-
-import com.sun.corba.se.spi.ior.IOR;
-import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
-import com.sun.corba.se.spi.logging.CORBALogDomains;
-import com.sun.corba.se.spi.orb.ORB ;
-import com.sun.corba.se.spi.orbutil.threadpool.Work;
-import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
-import com.sun.corba.se.spi.transport.CorbaContactInfo;
-import com.sun.corba.se.spi.transport.CorbaConnection;
-import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom;
-
-import com.sun.corba.se.impl.encoding.CachedCodeBase;
-import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
-import com.sun.corba.se.impl.encoding.CDROutputObject;
-import com.sun.corba.se.impl.encoding.CDROutputStream_1_0;
-import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
-import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
-import com.sun.corba.se.impl.logging.ORBUtilSystemException;
-import com.sun.corba.se.impl.orbutil.ORBConstants;
-import com.sun.corba.se.impl.orbutil.ORBUtility;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
-import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
-import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl;
-
-/**
- * @author Ken Cavanaugh
- */
-public class BufferConnectionImpl
- extends
- EventHandlerBase
- implements
- CorbaConnection,
- Work
-{
- //
- // New transport.
- //
-
- protected long enqueueTime;
-
- public SocketChannel getSocketChannel()
- {
- return null;
- }
-
- // REVISIT:
- // protected for test: genericRPCMSGFramework.IIOPConnection constructor.
-
- //
- // From iiop.Connection.java
- //
-
- protected long timeStamp = 0;
- protected boolean isServer = false;
-
- // Start at some value other than zero since this is a magic
- // value in some protocols.
- protected int requestId = 5;
- protected CorbaResponseWaitingRoom responseWaitingRoom;
- protected int state;
- protected java.lang.Object stateEvent = new java.lang.Object();
- protected java.lang.Object writeEvent = new java.lang.Object();
- protected boolean writeLocked;
- protected int serverRequestCount = 0;
-
- // Server request map: used on the server side of Connection
- // Maps request ID to IIOPInputStream.
- Map serverRequestMap = new HashMap() ;
-
- // This is a flag associated per connection telling us if the
- // initial set of sending contexts were sent to the receiver
- // already...
- protected boolean postInitialContexts = false;
-
- // Remote reference to CodeBase server (supplies
- // FullValueDescription, among other things)
- protected IOR codeBaseServerIOR;
-
- // CodeBase cache for this connection. This will cache remote operations,
- // handle connecting, and ensure we don't do any remote operations until
- // necessary.
- protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this);
-
- protected ORBUtilSystemException wrapper ;
-
- List buffers ;
-
- public BufferConnectionImpl(ORB orb, byte[][] data )
- {
- this.orb = orb;
- wrapper = ORBUtilSystemException.get( orb,
- CORBALogDomains.RPC_TRANSPORT ) ;
- buffers = new ArrayList() ;
- }
-
- ////////////////////////////////////////////////////
- //
- // framework.transport.Connection
- //
-
- public boolean shouldRegisterReadEvent()
- {
- return false;
- }
-
- public boolean shouldRegisterServerReadEvent()
- {
- return false;
- }
-
- public boolean read()
- {
- return true ;
- }
-
- protected CorbaMessageMediator readBits()
- {
- return null ;
- }
-
- protected boolean dispatch(CorbaMessageMediator messageMediator)
- {
- }
-
- public boolean shouldUseDirectByteBuffers()
- {
- return false ;
- }
-
- // Only called from readGIOPMessage with (12, 0, 12) as arguments
- // size is size of buffer to create
- // offset is offset from start of message in buffer
- // length is length to read
- public ByteBuffer read(int size, int offset, int length)
- throws IOException
- {
- byte[] buf = new byte[size];
- readFully( buf, offset, length);
- ByteBuffer byteBuffer = ByteBuffer.wrap(buf);
- byteBuffer.limit(size);
- return byteBuffer;
- }
-
- // Only called as read( buf, 12, msgsize-12 ) in readGIOPMessage
- // We can ignore the byteBuffer parameter
- // offset is the starting position to place data in the result
- // length is the length of the data to read
- public ByteBuffer read(ByteBuffer byteBuffer, int offset, int length)
- throws IOException
- {
- int size = offset + length;
- byte[] buf = new byte[size];
- readFully(buf, offset, length);
- return ByteBuffer.wrap(buf);
- }
-
- // Read size bytes from buffer list and place the data
- // starting at offset in buf.
- public void readFully(byte[] buf, int offset, int size)
- throws IOException
- {
- int remaining = size ;
- int position = offset ;
- while (remaining > 0) {
- ByteBuffer buff = (ByteBuffer)buffers.get(0) ;
- int dataSize = buff.remaining() ;
- int xferSize = dataSize ;
- if (dataSize >= remaining) :
- xferSize = remaining ;
- buffers.remove(0) ;
- }
-
- buff.get( buf, offset, xferSize ) ;
-
- offset += xferSize ;
- remaining -= xferSize ;
- }
- }
-
- public void write(ByteBuffer byteBuffer)
- throws IOException
- {
- buffers.add( byteBuffer ) ;
- }
-
- /**
- * Note:it is possible for this to be called more than once
- */
- public synchronized void close()
- {
- }
-
- public Acceptor getAcceptor()
- {
- return null;
- }
-
- public ContactInfo getContactInfo()
- {
- return null;
- }
-
- public EventHandler getEventHandler()
- {
- return this;
- }
-
- public OutputObject createOutputObject(MessageMediator messageMediator)
- {
- // REVISIT - remove this method from Connection and all it subclasses.
- throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called.");
- }
-
- // This is used by the GIOPOutputObject in order to
- // throw the correct error when handling code sets.
- // Can we determine if we are on the server side by
- // other means? XREVISIT
- public boolean isServer()
- {
- return isServer;
- }
-
- public boolean isBusy()
- {
- return false ;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- public void setTimeStamp(long time)
- {
- timeStamp = time;
- }
-
- public void setState(String stateString)
- {
- synchronized (stateEvent) {
- if (stateString.equals("ESTABLISHED")) {
- state = ESTABLISHED;
- stateEvent.notifyAll();
- } else {
- // REVISIT: ASSERT
- }
- }
- }
-
- public void writeLock()
- {
- }
-
- public void writeUnlock()
- {
- }
-
- public void sendWithoutLock(OutputObject outputObject)
- {
- }
-
- public void registerWaiter(MessageMediator messageMediator)
- {
- }
-
- public void unregisterWaiter(MessageMediator messageMediator)
- {
- }
-
- public InputObject waitForResponse(MessageMediator messageMediator)
- {
- return null ;
- }
-
- public void setConnectionCache(ConnectionCache connectionCache)
- {
- }
-
- public ConnectionCache getConnectionCache()
- {
- return null;
- }
-
- ////////////////////////////////////////////////////
- //
- // EventHandler methods
- //
-
- public SelectableChannel getChannel()
- {
- return null;
- }
-
- public int getInterestOps()
- {
- return null;
- }
-
- // public Acceptor getAcceptor() - already defined above.
-
- public Connection getConnection()
- {
- return this;
- }
-
- ////////////////////////////////////////////////////
- //
- // Work methods.
- //
-
- public String getName()
- {
- return this.toString();
- }
-
- public void doWork()
- {
- }
-
- public void setEnqueueTime(long timeInMillis)
- {
- enqueueTime = timeInMillis;
- }
-
- public long getEnqueueTime()
- {
- return enqueueTime;
- }
-
- ////////////////////////////////////////////////////
- //
- // spi.transport.CorbaConnection.
- //
-
- public ResponseWaitingRoom getResponseWaitingRoom()
- {
- return null ;
- }
-
- // REVISIT - inteface defines isServer but already defined in
- // higher interface.
-
-
- public void serverRequestMapPut(int requestId,
- CorbaMessageMediator messageMediator)
- {
- serverRequestMap.put(new Integer(requestId), messageMediator);
- }
-
- public CorbaMessageMediator serverRequestMapGet(int requestId)
- {
- return (CorbaMessageMediator)
- serverRequestMap.get(new Integer(requestId));
- }
-
- public void serverRequestMapRemove(int requestId)
- {
- serverRequestMap.remove(new Integer(requestId));
- }
-
-
- // REVISIT: this is also defined in:
- // com.sun.corba.se.spi.legacy.connection.Connection
- public java.net.Socket getSocket()
- {
- return null;
- }
-
- /** It is possible for a Close Connection to have been
- ** sent here, but we will not check for this. A "lazy"
- ** Exception will be thrown in the Worker thread after the
- ** incoming request has been processed even though the connection
- ** is closed before the request is processed. This is o.k because
- ** it is a boundary condition. To prevent it we would have to add
- ** more locks which would reduce performance in the normal case.
- **/
- public synchronized void serverRequestProcessingBegins()
- {
- serverRequestCount++;
- }
-
- public synchronized void serverRequestProcessingEnds()
- {
- serverRequestCount--;
- }
-
- //
- //
- //
-
- public synchronized int getNextRequestId()
- {
- return requestId++;
- }
-
- // Negotiated code sets for char and wchar data
- protected CodeSetComponentInfo.CodeSetContext codeSetContext = null;
-
- public ORB getBroker()
- {
- return orb;
- }
-
- public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
- {
- // Needs to be synchronized for the following case when the client
- // doesn't send the code set context twice, and we have two threads
- // in ServerRequestDispatcher processCodeSetContext.
- //
- // Thread A checks to see if there is a context, there is none, so
- // it calls setCodeSetContext, getting the synch lock.
- // Thread B checks to see if there is a context. If we didn't synch,
- // it might decide to outlaw wchar/wstring.
- if (codeSetContext == null) {
- synchronized(this) {
- return codeSetContext;
- }
- }
-
- return codeSetContext;
- }
-
- public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
- // Double check whether or not we need to do this
- if (codeSetContext == null) {
-
- if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
- OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
- // If the client says it's negotiated a code set that
- // isn't a fallback and we never said we support, then
- // it has a bug.
- throw wrapper.badCodesetsFromClient() ;
- }
-
- codeSetContext = csc;
- }
- }
-
- //
- // from iiop.IIOPConnection.java
- //
-
- // Map request ID to an InputObject.
- // This is so the client thread can start unmarshaling
- // the reply and remove it from the out_calls map while the
- // ReaderThread can still obtain the input stream to give
- // new fragments. Only the ReaderThread touches the clientReplyMap,
- // so it doesn't incur synchronization overhead.
-
- public MessageMediator clientRequestMapGet(int requestId)
- {
- return null ;
- }
-
- protected MessageMediator clientReply_1_1;
-
- public void clientReply_1_1_Put(MessageMediator x)
- {
- clientReply_1_1 = x;
- }
-
- public MessageMediator clientReply_1_1_Get()
- {
- return clientReply_1_1;
- }
-
- public void clientReply_1_1_Remove()
- {
- clientReply_1_1 = null;
- }
-
- protected MessageMediator serverRequest_1_1;
-
- public void serverRequest_1_1_Put(MessageMediator x)
- {
- serverRequest_1_1 = x;
- }
-
- public MessageMediator serverRequest_1_1_Get()
- {
- return serverRequest_1_1;
- }
-
- public void serverRequest_1_1_Remove()
- {
- serverRequest_1_1 = null;
- }
-
- protected String getStateString( int state )
- {
- synchronized ( stateEvent ){
- switch (state) {
- case OPENING : return "OPENING" ;
- case ESTABLISHED : return "ESTABLISHED" ;
- case CLOSE_SENT : return "CLOSE_SENT" ;
- case CLOSE_RECVD : return "CLOSE_RECVD" ;
- case ABORT : return "ABORT" ;
- default : return "???" ;
- }
- }
- }
-
- public synchronized boolean isPostInitialContexts() {
- return postInitialContexts;
- }
-
- // Can never be unset...
- public synchronized void setPostInitialContexts(){
- postInitialContexts = true;
- }
-
- /**
- * Wake up the outstanding requests on the connection, and hand them
- * COMM_FAILURE exception with a given minor code.
- *
- * Also, delete connection from connection table and
- * stop the reader thread.
-
- * Note that this should only ever be called by the Reader thread for
- * this connection.
- *
- * @param minor_code The minor code for the COMM_FAILURE major code.
- * @param die Kill the reader thread (this thread) before exiting.
- */
- public void purgeCalls(SystemException systemException,
- boolean die, boolean lockHeld)
- {
- }
-
- /*************************************************************************
- * The following methods are for dealing with Connection cleaning for
- * better scalability of servers in high network load conditions.
- **************************************************************************/
-
- public void sendCloseConnection(GIOPVersion giopVersion)
- throws IOException
- {
- Message msg = MessageBase.createCloseConnection(giopVersion);
- sendHelper(giopVersion, msg);
- }
-
- public void sendMessageError(GIOPVersion giopVersion)
- throws IOException
- {
- Message msg = MessageBase.createMessageError(giopVersion);
- sendHelper(giopVersion, msg);
- }
-
- /**
- * Send a CancelRequest message. This does not lock the connection, so the
- * caller needs to ensure this method is called appropriately.
- * @exception IOException - could be due to abortive connection closure.
- */
- public void sendCancelRequest(GIOPVersion giopVersion, int requestId)
- throws IOException
- {
-
- Message msg = MessageBase.createCancelRequest(giopVersion, requestId);
- sendHelper(giopVersion, msg);
- }
-
- protected void sendHelper(GIOPVersion giopVersion, Message msg)
- throws IOException
- {
- // REVISIT: See comments in CDROutputObject constructor.
- CDROutputObject outputObject =
- new CDROutputObject((ORB)orb, null, giopVersion, this, msg,
- ORBConstants.STREAM_FORMAT_VERSION_1);
- msg.write(outputObject);
-
- outputObject.writeTo(this);
- }
-
- public void sendCancelRequestWithLock(GIOPVersion giopVersion,
- int requestId)
- throws IOException
- {
- writeLock();
- try {
- sendCancelRequest(giopVersion, requestId);
- } finally {
- writeUnlock();
- }
- }
-
- // Begin Code Base methods ---------------------------------------
- //
- // Set this connection's code base IOR. The IOR comes from the
- // SendingContext. This is an optional service context, but all
- // JavaSoft ORBs send it.
- //
- // The set and get methods don't need to be synchronized since the
- // first possible get would occur during reading a valuetype, and
- // that would be after the set.
-
- // Sets this connection's code base IOR. This is done after
- // getting the IOR out of the SendingContext service context.
- // Our ORBs always send this, but it's optional in CORBA.
-
- public final void setCodeBaseIOR(IOR ior) {
- codeBaseServerIOR = ior;
- }
-
- public final IOR getCodeBaseIOR() {
- return codeBaseServerIOR;
- }
-
- // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase
- // won't connect to the remote codebase unless it's necessary.
- public final CodeBase getCodeBase() {
- return cachedCodeBase;
- }
-
- // End Code Base methods -----------------------------------------
-
- // Can be overridden in subclass for different options.
- protected void setSocketOptions(Socket socket)
- {
- }
-
- public String toString()
- {
- synchronized ( stateEvent ){
- return
- "BufferConnectionImpl[" + " "
- + getStateString( state ) + " "
- + shouldUseSelectThreadToWait() + " "
- + shouldUseWorkerThreadForEvent()
- + "]" ;
- }
- }
-
- // Must be public - used in encoding.
- public void dprint(String msg)
- {
- ORBUtility.dprint("SocketOrChannelConnectionImpl", msg);
- }
-
- protected void dprint(String msg, Throwable t)
- {
- dprint(msg);
- t.printStackTrace(System.out);
- }
-}
-
-// End of file.
diff -r 424d84a2276f -r 9dc631273af7 hotspot/.hgtags
--- a/hotspot/.hgtags Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/.hgtags Tue Aug 13 15:49:37 2013 -0700
@@ -365,3 +365,5 @@
46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43
f6921c876db192bba389cec062855a66372da01c jdk8-b101
530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44
+c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102
+7f55137d6aa81efc6eb0035813709f2cb6a26b8b hs25-b45
diff -r 424d84a2276f -r 9dc631273af7 hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java Tue Aug 13 15:49:37 2013 -0700
@@ -29,11 +29,10 @@
public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
- public static final int JVMTI_THREAD_STATE_WAITING = 0x0008;
+ public static final int JVMTI_THREAD_STATE_WAITING = 0x0080;
public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040;
- public static final int JVMTI_THREAD_STATE_WAITING_FOR_NOTIFICATION = 0x0080;
public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100;
public static final int JVMTI_THREAD_STATE_PARKED = 0x0200;
public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;
diff -r 424d84a2276f -r 9dc631273af7 hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/OSThread.java Tue Aug 13 15:49:37 2013 -0700
@@ -32,7 +32,7 @@
// to the sys_thread_t structure of the classic JVM implementation.
public class OSThread extends VMObject {
private static JIntField interruptedField;
- private static JIntField threadIdField;
+ private static Field threadIdField;
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
@@ -44,7 +44,7 @@
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("OSThread");
interruptedField = type.getJIntField("_interrupted");
- threadIdField = type.getJIntField("_thread_id");
+ threadIdField = type.getField("_thread_id");
}
public OSThread(Address addr) {
@@ -56,7 +56,7 @@
}
public int threadId() {
- return (int)threadIdField.getValue(addr);
+ return threadIdField.getJInt(addr);
}
}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, 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
@@ -74,23 +74,24 @@
public void run() {
// Ready to go with the database...
try {
- // The name of the filter always comes from a System property.
- // If we have a pkgList, pass it, otherwise let the filter read
- // its own System property for the list of classes.
- String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
- "sun.jvm.hotspot.tools.jcore.PackageNameFilter");
- try {
- Class filterClass = Class.forName(filterClassName);
- if (pkgList == null) {
- classFilter = (ClassFilter) filterClass.newInstance();
- } else {
- Constructor con = filterClass.getConstructor(String.class);
- classFilter = (ClassFilter) con.newInstance(pkgList);
+ if (classFilter == null) {
+ // If not already set, the name of the filter comes from a System property.
+ // If we have a pkgList, pass it, otherwise let the filter read
+ // its own System property for the list of classes.
+ String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
+ "sun.jvm.hotspot.tools.jcore.PackageNameFilter");
+ try {
+ Class filterClass = Class.forName(filterClassName);
+ if (pkgList == null) {
+ classFilter = (ClassFilter) filterClass.newInstance();
+ } else {
+ Constructor con = filterClass.getConstructor(String.class);
+ classFilter = (ClassFilter) con.newInstance(pkgList);
+ }
+ } catch(Exception exp) {
+ System.err.println("Warning: Can not create class filter!");
}
- } catch(Exception exp) {
- System.err.println("Warning: Can not create class filter!");
}
-
String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", ".");
setOutputDirectory(outputDirectory);
diff -r 424d84a2276f -r 9dc631273af7 hotspot/make/hotspot_version
--- a/hotspot/make/hotspot_version Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/make/hotspot_version Tue Aug 13 15:49:37 2013 -0700
@@ -35,7 +35,7 @@
HS_MAJOR_VER=25
HS_MINOR_VER=0
-HS_BUILD_NUMBER=44
+HS_BUILD_NUMBER=45
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue Aug 13 15:49:37 2013 -0700
@@ -2295,7 +2295,7 @@
if (gen_type_check) {
// We have determined that offset == referent_offset && src != null.
// if (src->_klass->_reference_type == REF_NONE) -> continue
- __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), UseCompressedKlassPointers ? T_OBJECT : T_ADDRESS), src_klass);
+ __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE);
LIR_Opr reference_type = new_register(T_INT);
__ move(reference_type_addr, reference_type);
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/classfile/classLoader.cpp
--- a/hotspot/src/share/vm/classfile/classLoader.cpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp Tue Aug 13 15:49:37 2013 -0700
@@ -878,7 +878,7 @@
instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) {
ResourceMark rm(THREAD);
- EventMark m("loading class " INTPTR_FORMAT, (address)h_name);
+ EventMark m("loading class %s", h_name->as_C_string());
ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion);
stringStream st;
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/runtime/arguments.cpp
--- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Tue Aug 13 15:49:37 2013 -0700
@@ -60,6 +60,28 @@
#define DEFAULT_VENDOR_URL_BUG "http://bugreport.sun.com/bugreport/crash.jsp"
#define DEFAULT_JAVA_LAUNCHER "generic"
+// Disable options not supported in this release, with a warning if they
+// were explicitly requested on the command-line
+#define UNSUPPORTED_OPTION(opt, description) \
+do { \
+ if (opt) { \
+ if (FLAG_IS_CMDLINE(opt)) { \
+ warning(description " is disabled in this release."); \
+ } \
+ FLAG_SET_DEFAULT(opt, false); \
+ } \
+} while(0)
+
+#define UNSUPPORTED_GC_OPTION(gc) \
+do { \
+ if (gc) { \
+ if (FLAG_IS_CMDLINE(gc)) { \
+ warning(#gc " is not supported in this VM. Using Serial GC."); \
+ } \
+ FLAG_SET_DEFAULT(gc, false); \
+ } \
+} while(0)
+
char** Arguments::_jvm_flags_array = NULL;
int Arguments::_num_jvm_flags = 0;
char** Arguments::_jvm_args_array = NULL;
@@ -3128,14 +3150,17 @@
FLAG_SET_DEFAULT(UseLargePages, false);
}
- // Tiered compilation is undefined with C1.
- TieredCompilation = false;
#else
if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {
FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);
}
#endif
+#ifndef TIERED
+ // Tiered compilation is undefined.
+ UNSUPPORTED_OPTION(TieredCompilation, "TieredCompilation");
+#endif
+
// If we are running in a headless jre, force java.awt.headless property
// to be true unless the property has already been set.
// Also allow the OS environment variable JAVA_AWT_HEADLESS to set headless state.
@@ -3278,29 +3303,6 @@
}
}
-// Disable options not supported in this release, with a warning if they
-// were explicitly requested on the command-line
-#define UNSUPPORTED_OPTION(opt, description) \
-do { \
- if (opt) { \
- if (FLAG_IS_CMDLINE(opt)) { \
- warning(description " is disabled in this release."); \
- } \
- FLAG_SET_DEFAULT(opt, false); \
- } \
-} while(0)
-
-
-#define UNSUPPORTED_GC_OPTION(gc) \
-do { \
- if (gc) { \
- if (FLAG_IS_CMDLINE(gc)) { \
- warning(#gc " is not supported in this VM. Using Serial GC."); \
- } \
- FLAG_SET_DEFAULT(gc, false); \
- } \
-} while(0)
-
#if !INCLUDE_ALL_GCS
static void force_serial_gc() {
FLAG_SET_DEFAULT(UseSerialGC, true);
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/services/gcNotifier.cpp
--- a/hotspot/src/share/vm/services/gcNotifier.cpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/services/gcNotifier.cpp Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, 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
@@ -211,9 +211,9 @@
NotificationMark nm(request);
Handle objGcInfo = createGcInfo(request->gcManager, request->gcStatInfo, THREAD);
- Handle objName = java_lang_String::create_from_platform_dependent_str(request->gcManager->name(), CHECK);
- Handle objAction = java_lang_String::create_from_platform_dependent_str(request->gcAction, CHECK);
- Handle objCause = java_lang_String::create_from_platform_dependent_str(request->gcCause, CHECK);
+ Handle objName = java_lang_String::create_from_str(request->gcManager->name(), CHECK);
+ Handle objAction = java_lang_String::create_from_str(request->gcAction, CHECK);
+ Handle objCause = java_lang_String::create_from_str(request->gcCause, CHECK);
Klass* k = Management::sun_management_GarbageCollectorImpl_klass(CHECK);
instanceKlassHandle gc_mbean_klass(THREAD, k);
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/services/management.cpp
--- a/hotspot/src/share/vm/services/management.cpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/services/management.cpp Tue Aug 13 15:49:37 2013 -0700
@@ -1831,13 +1831,13 @@
private:
objArrayHandle _names_strings;
char **_names_chars;
- typeArrayOop _times;
+ typeArrayHandle _times;
int _names_len;
int _times_len;
int _count;
public:
- ThreadTimesClosure(objArrayHandle names, typeArrayOop times);
+ ThreadTimesClosure(objArrayHandle names, typeArrayHandle times);
~ThreadTimesClosure();
virtual void do_thread(Thread* thread);
void do_unlocked();
@@ -1845,9 +1845,9 @@
};
ThreadTimesClosure::ThreadTimesClosure(objArrayHandle names,
- typeArrayOop times) {
+ typeArrayHandle times) {
assert(names() != NULL, "names was NULL");
- assert(times != NULL, "times was NULL");
+ assert(times() != NULL, "times was NULL");
_names_strings = names;
_names_len = names->length();
_names_chars = NEW_C_HEAP_ARRAY(char*, _names_len, mtInternal);
@@ -1925,7 +1925,7 @@
typeArrayOop ta = typeArrayOop(JNIHandles::resolve_non_null(times));
typeArrayHandle times_ah(THREAD, ta);
- ThreadTimesClosure ttc(names_ah, times_ah());
+ ThreadTimesClosure ttc(names_ah, times_ah);
{
MutexLockerEx ml(Threads_lock);
Threads::threads_do(&ttc);
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/utilities/exceptions.cpp
--- a/hotspot/src/share/vm/utilities/exceptions.cpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp Tue Aug 13 15:49:37 2013 -0700
@@ -125,13 +125,13 @@
}
void Exceptions::_throw(Thread* thread, const char* file, int line, Handle h_exception, const char* message) {
+ ResourceMark rm;
assert(h_exception() != NULL, "exception should not be NULL");
// tracing (do this up front - so it works during boot strapping)
if (TraceExceptions) {
ttyLocker ttyl;
- ResourceMark rm;
- tty->print_cr("Exception <%s>%s%s (" INTPTR_FORMAT " ) \n"
+ tty->print_cr("Exception <%s%s%s> (" INTPTR_FORMAT ") \n"
"thrown [%s, line %d]\nfor thread " INTPTR_FORMAT,
h_exception->print_value_string(),
message ? ": " : "", message ? message : "",
@@ -141,7 +141,9 @@
NOT_PRODUCT(Exceptions::debug_check_abort(h_exception, message));
// Check for special boot-strapping/vm-thread handling
- if (special_exception(thread, file, line, h_exception)) return;
+ if (special_exception(thread, file, line, h_exception)) {
+ return;
+ }
assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
@@ -149,7 +151,9 @@
thread->set_pending_exception(h_exception(), file, line);
// vm log
- Events::log_exception(thread, "Threw " INTPTR_FORMAT " at %s:%d", (address)h_exception(), file, line);
+ Events::log_exception(thread, "Exception <%s%s%s> (" INTPTR_FORMAT ") thrown at [%s, line %d]",
+ h_exception->print_value_string(), message ? ": " : "", message ? message : "",
+ (address)h_exception(), file, line);
}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/src/share/vm/utilities/taskqueue.hpp
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp Tue Aug 13 15:49:37 2013 -0700
@@ -395,7 +395,13 @@
template
bool GenericTaskQueue::pop_global(E& t) {
Age oldAge = _age.get();
- uint localBot = _bottom;
+ // Architectures with weak memory model require a barrier here
+ // to guarantee that bottom is not older than age,
+ // which is crucial for the correctness of the algorithm.
+#if !(defined SPARC || defined IA32 || defined AMD64)
+ OrderAccess::fence();
+#endif
+ uint localBot = OrderAccess::load_acquire((volatile juint*)&_bottom);
uint n_elems = size(localBot, oldAge.top());
if (n_elems == 0) {
return false;
@@ -644,7 +650,7 @@
template inline bool
GenericTaskQueue::push(E t) {
uint localBot = _bottom;
- assert((localBot >= 0) && (localBot < N), "_bottom out of range.");
+ assert(localBot < N, "_bottom out of range.");
idx_t top = _age.top();
uint dirty_n_elems = dirty_size(localBot, top);
assert(dirty_n_elems < N, "n_elems out of range.");
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/compiler/codecache/CheckUpperLimit.java
--- a/hotspot/test/compiler/codecache/CheckUpperLimit.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java Tue Aug 13 15:49:37 2013 -0700
@@ -35,10 +35,6 @@
ProcessBuilder pb;
OutputAnalyzer out;
- pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2048m", "-version");
- out = new OutputAnalyzer(pb.start());
- out.shouldHaveExitValue(0);
-
pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=2049m", "-version");
out = new OutputAnalyzer(pb.start());
out.shouldContain("Invalid ReservedCodeCacheSize=");
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java Tue Aug 13 15:49:37 2013 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016474
+ * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8)
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier
+ */
+
+import java.lang.reflect.Field;
+
+import sun.misc.Unsafe;
+
+public class GetUnsafeObjectG1PreBarrier {
+ private static final Unsafe unsafe;
+ private static final int N = 100_000;
+
+ static {
+ try {
+ Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
+ theUnsafe.setAccessible(true);
+ unsafe = (Unsafe) theUnsafe.get(null);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ public Object a;
+
+ public static void main(String[] args) throws Throwable {
+ new GetUnsafeObjectG1PreBarrier();
+ }
+
+ public GetUnsafeObjectG1PreBarrier() throws Throwable {
+ doit();
+ }
+
+ private void doit() throws Throwable {
+ Field field = GetUnsafeObjectG1PreBarrier.class.getField("a");
+ long fieldOffset = unsafe.objectFieldOffset(field);
+
+ for (int i = 0; i < N; i++) {
+ readField(this, fieldOffset);
+ }
+ }
+
+ private void readField(Object o, long fieldOffset) {
+ unsafe.getObject(o, fieldOffset);
+ }
+}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/runtime/7196045/Test7196045.java
--- a/hotspot/test/runtime/7196045/Test7196045.java Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/*
- * @test
- * @bug 7196045
- * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
- * @run main/othervm -XX:+UsePerfData Test7196045
- */
-
-import java.lang.management.ManagementFactory;
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-public class Test7196045 {
-
- public static long duration = 1000 * 60 * 2;
- private static final String HOTSPOT_INTERNAL = "sun.management:type=HotspotInternal";
-
- public static void main(String[] args) {
-
- MBeanServer server = ManagementFactory.getPlatformMBeanServer();
- ObjectName objName= null;
- try {
- ObjectName hotspotInternal = new ObjectName(HOTSPOT_INTERNAL);
- try {
- server.registerMBean(new sun.management.HotspotInternal(), hotspotInternal);
- } catch (JMException e) {
- throw new RuntimeException("HotSpotWatcher: Failed to register the HotspotInternal MBean" + e);
- }
- objName= new ObjectName("sun.management:type=HotspotThreading");
-
- } catch (MalformedObjectNameException e1) {
- throw new RuntimeException("Bad object name" + e1);
- }
-
- long endTime = System.currentTimeMillis() + duration;
- long i = 0;
- while (true) {
- try {
- server.getAttribute(objName, "InternalThreadCpuTimes");
- } catch (Exception ex) {
- System.err.println("Exception while getting attribute: " + ex);
- }
- i++;
- if (i % 10000 == 0) {
- System.out.println("Successful iterations: " + i);
- }
- if (System.currentTimeMillis() > endTime) {
- break;
- }
- }
- System.out.println("PASSED.");
- }
-}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/runtime/8000968/Test8000968.sh
--- a/hotspot/test/runtime/8000968/Test8000968.sh Tue Aug 13 15:41:55 2013 +0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-#
-# Copyright (c) 2013, 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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-
-# @test Test8000968.sh
-# @bug 8000968
-# @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32
-# @run shell Test8000968.sh
-#
-
-if [ "${TESTJAVA}" = "" ]
-then
- PARENT=`dirname \`which java\``
- TESTJAVA=`dirname ${PARENT}`
- printf "TESTJAVA not set, selecting " ${TESTJAVA}
- printf " If this is incorrect, try setting the variable manually.\n"
-fi
-
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- Windows_* )
- FS="\\"
- NULL=NUL
- ;;
- * )
- FS="/"
- NULL=/dev/null
- ;;
-esac
-
-JAVA=${TESTJAVA}${FS}bin${FS}java
-
-#
-# See if platform has 64 bit java.
-#
-${JAVA} ${TESTVMOPTS} -d64 -version 2>&1 | grep -i "does not support" > ${NULL}
-if [ "$?" != "1" ]
-then
- printf "Platform is 32 bit, does not support -XX:ObjectAlignmentInBytes= option.\n"
- printf "Passed.\n"
- exit 0
-fi
-
-#
-# Test -XX:ObjectAlignmentInBytes with -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops.
-#
-${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=16 -version 2>&1 > ${NULL}
-if [ "$?" != "0" ]
-then
- printf "FAILED: -XX:ObjectAlignmentInBytes=16 option did not work.\n"
- exit 1
-fi
-
-${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=32 -version 2>&1 > ${NULL}
-if [ "$?" != "0" ]
-then
- printf "FAILED: -XX:ObjectAlignmentInBytes=32 option did not work.\n"
- exit 1
-fi
-
-${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=64 -version 2>&1 > ${NULL}
-if [ "$?" != "0" ]
-then
- printf "FAILED: -XX:ObjectAlignmentInBytes=64 option did not work.\n"
- exit 1
-fi
-
-${JAVA} ${TESTVMOPTS} -d64 -XX:+UseCompressedKlassPointers -XX:+UseCompressedOops -XX:ObjectAlignmentInBytes=128 -version 2>&1 > ${NULL}
-if [ "$?" != "0" ]
-then
- printf "FAILED: -XX:ObjectAlignmentInBytes=128 option did not work.\n"
- exit 1
-fi
-
-
-printf "Passed.\n"
-exit 0
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java Tue Aug 13 15:49:37 2013 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8000968
+ * @key regression
+ * @summary NPG: UseCompressedKlassPointers asserts with ObjectAlignmentInBytes=32
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class CompressedKlassPointerAndOops {
+
+ public static void main(String[] args) throws Exception {
+
+ if (!Platform.is64bit()) {
+ // Can't test this on 32 bit, just pass
+ System.out.println("Skipping test on 32bit");
+ return;
+ }
+
+ runWithAlignment(16);
+ runWithAlignment(32);
+ runWithAlignment(64);
+ runWithAlignment(128);
+ }
+
+ private static void runWithAlignment(int alignment) throws Exception {
+ ProcessBuilder pb;
+ OutputAnalyzer output;
+
+ pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+UseCompressedKlassPointers",
+ "-XX:+UseCompressedOops",
+ "-XX:ObjectAlignmentInBytes=" + alignment,
+ "-version");
+
+ output = new OutputAnalyzer(pb.start());
+ output.shouldHaveExitValue(0);
+ }
+}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java Tue Aug 13 15:49:37 2013 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2012, 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 7196045
+ * @bug 8014294
+ * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
+ * @run main/othervm -XX:+UsePerfData -Xmx32m ThreadCpuTimesDeadlock
+ */
+
+import java.lang.management.ManagementFactory;
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+public class ThreadCpuTimesDeadlock {
+
+ public static byte[] dummy;
+ public static long duration = 10 * 1000;
+ private static final String HOTSPOT_INTERNAL = "sun.management:type=HotspotInternal";
+
+ public static void main(String[] args) {
+
+ MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+ ObjectName objName= null;
+ try {
+ ObjectName hotspotInternal = new ObjectName(HOTSPOT_INTERNAL);
+ try {
+ server.registerMBean(new sun.management.HotspotInternal(), hotspotInternal);
+ } catch (JMException e) {
+ throw new RuntimeException("HotSpotWatcher: Failed to register the HotspotInternal MBean" + e);
+ }
+ objName= new ObjectName("sun.management:type=HotspotThreading");
+
+ } catch (MalformedObjectNameException e1) {
+ throw new RuntimeException("Bad object name" + e1);
+ }
+
+ // Thread that allocs memory to generate GC's
+ Thread allocThread = new Thread() {
+ public void run() {
+ while (true) {
+ dummy = new byte[4096];
+ }
+ }
+ };
+
+ allocThread.setDaemon(true);
+ allocThread.start();
+
+ long endTime = System.currentTimeMillis() + duration;
+ long i = 0;
+ while (true) {
+ try {
+ server.getAttribute(objName, "InternalThreadCpuTimes");
+ } catch (Exception ex) {
+ System.err.println("Exception while getting attribute: " + ex);
+ }
+ i++;
+ if (i % 10000 == 0) {
+ System.out.println("Successful iterations: " + i);
+ }
+ if (System.currentTimeMillis() > endTime) {
+ break;
+ }
+ }
+ System.out.println("PASSED.");
+ }
+}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/testlibrary/OutputAnalyzerReportingTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/OutputAnalyzerReportingTest.java Tue Aug 13 15:49:37 2013 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2013, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test
+ * @summary Test the OutputAnalyzer reporting functionality,
+ * such as printing additional diagnostic info
+ * (exit code, stdout, stderr, command line, etc.)
+ * @library /testlibrary
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+
+public class OutputAnalyzerReportingTest {
+
+ public static void main(String[] args) throws Exception {
+ // Create the output analyzer under test
+ String stdout = "aaaaaa";
+ String stderr = "bbbbbb";
+ OutputAnalyzer output = new OutputAnalyzer(stdout, stderr);
+
+ // Expected summary values should be the same for all cases,
+ // since the outputAnalyzer object is the same
+ String expectedExitValue = "-1";
+ String expectedSummary =
+ " stdout: [" + stdout + "];\n" +
+ " stderr: [" + stderr + "]\n" +
+ " exitValue = " + expectedExitValue + "\n";
+
+
+ DiagnosticSummaryTestRunner testRunner =
+ new DiagnosticSummaryTestRunner();
+
+ // should have exit value
+ testRunner.init(expectedSummary);
+ int unexpectedExitValue = 2;
+ try {
+ output.shouldHaveExitValue(unexpectedExitValue);
+ } catch (RuntimeException e) { }
+ testRunner.closeAndCheckResults();
+
+ // should not contain
+ testRunner.init(expectedSummary);
+ try {
+ output.shouldNotContain(stdout);
+ } catch (RuntimeException e) { }
+ testRunner.closeAndCheckResults();
+
+ // should contain
+ testRunner.init(expectedSummary);
+ try {
+ output.shouldContain("unexpected-stuff");
+ } catch (RuntimeException e) { }
+ testRunner.closeAndCheckResults();
+
+ // should not match
+ testRunner.init(expectedSummary);
+ try {
+ output.shouldNotMatch("[a]");
+ } catch (RuntimeException e) { }
+ testRunner.closeAndCheckResults();
+
+ // should match
+ testRunner.init(expectedSummary);
+ try {
+ output.shouldMatch("[qwerty]");
+ } catch (RuntimeException e) { }
+ testRunner.closeAndCheckResults();
+
+ }
+
+ private static class DiagnosticSummaryTestRunner {
+ private ByteArrayOutputStream byteStream =
+ new ByteArrayOutputStream(10000);
+
+ private String expectedSummary = "";
+ private PrintStream errStream;
+
+
+ public void init(String expectedSummary) {
+ this.expectedSummary = expectedSummary;
+ byteStream.reset();
+ errStream = new PrintStream(byteStream);
+ System.setErr(errStream);
+ }
+
+ public void closeAndCheckResults() {
+ // check results
+ errStream.close();
+ String stdErrStr = byteStream.toString();
+ if (!stdErrStr.contains(expectedSummary)) {
+ throw new RuntimeException("The output does not contain "
+ + "the diagnostic message, or the message is incorrect");
+ }
+ }
+ }
+
+}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java Tue Aug 13 15:49:37 2013 -0700
@@ -76,7 +76,8 @@
*/
public void shouldContain(String expectedString) {
if (!stdout.contains(expectedString) && !stderr.contains(expectedString)) {
- throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr: [" + stdout + stderr + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr \n");
}
}
@@ -88,7 +89,8 @@
*/
public void stdoutShouldContain(String expectedString) {
if (!stdout.contains(expectedString)) {
- throw new RuntimeException("'" + expectedString + "' missing from stdout: [" + stdout + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + expectedString + "' missing from stdout \n");
}
}
@@ -100,7 +102,8 @@
*/
public void stderrShouldContain(String expectedString) {
if (!stderr.contains(expectedString)) {
- throw new RuntimeException("'" + expectedString + "' missing from stderr: [" + stderr + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + expectedString + "' missing from stderr \n");
}
}
@@ -112,10 +115,12 @@
*/
public void shouldNotContain(String notExpectedString) {
if (stdout.contains(notExpectedString)) {
- throw new RuntimeException("'" + notExpectedString + "' found in stdout: [" + stdout + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + notExpectedString + "' found in stdout \n");
}
if (stderr.contains(notExpectedString)) {
- throw new RuntimeException("'" + notExpectedString + "' found in stderr: [" + stderr + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + notExpectedString + "' found in stderr \n");
}
}
@@ -127,7 +132,8 @@
*/
public void stdoutShouldNotContain(String notExpectedString) {
if (stdout.contains(notExpectedString)) {
- throw new RuntimeException("'" + notExpectedString + "' found in stdout: [" + stdout + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + notExpectedString + "' found in stdout \n");
}
}
@@ -139,7 +145,8 @@
*/
public void stderrShouldNotContain(String notExpectedString) {
if (stderr.contains(notExpectedString)) {
- throw new RuntimeException("'" + notExpectedString + "' found in stderr: [" + stderr + "]\n");
+ reportDiagnosticSummary();
+ throw new RuntimeException("'" + notExpectedString + "' found in stderr \n");
}
}
@@ -154,9 +161,9 @@
Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!stdoutMatcher.find() && !stderrMatcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' missing from stdout/stderr: [" + stdout + stderr
- + "]\n");
+ + "' missing from stdout/stderr \n");
}
}
@@ -170,8 +177,9 @@
public void stdoutShouldMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
if (!matcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' missing from stdout: [" + stdout + "]\n");
+ + "' missing from stdout \n");
}
}
@@ -185,8 +193,9 @@
public void stderrShouldMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!matcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' missing from stderr: [" + stderr + "]\n");
+ + "' missing from stderr \n");
}
}
@@ -200,13 +209,15 @@
public void shouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
if (matcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' found in stdout: [" + stdout + "]\n");
+ + "' found in stdout \n");
}
matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (matcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' found in stderr: [" + stderr + "]\n");
+ + "' found in stderr \n");
}
}
@@ -220,8 +231,9 @@
public void stdoutShouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
if (matcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' found in stdout: [" + stdout + "]\n");
+ + "' found in stdout \n");
}
}
@@ -235,23 +247,45 @@
public void stderrShouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (matcher.find()) {
+ reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
- + "' found in stderr: [" + stderr + "]\n");
+ + "' found in stderr \n");
}
}
/**
- * Verifiy the exit value of the process
+ * Verify the exit value of the process
*
* @param expectedExitValue Expected exit value from process
* @throws RuntimeException If the exit value from the process did not match the expected value
*/
public void shouldHaveExitValue(int expectedExitValue) {
if (getExitValue() != expectedExitValue) {
- throw new RuntimeException("Exit value " + getExitValue() + " , expected to get " + expectedExitValue);
+ reportDiagnosticSummary();
+ throw new RuntimeException("Expected to get exit value of ["
+ + expectedExitValue + "]\n");
}
}
+
+ /**
+ * Report summary that will help to diagnose the problem
+ * Currently includes:
+ * - standard input produced by the process under test
+ * - standard output
+ * - exit code
+ * Note: the command line is printed by the ProcessTools
+ */
+ private void reportDiagnosticSummary() {
+ String msg =
+ " stdout: [" + stdout + "];\n" +
+ " stderr: [" + stderr + "]\n" +
+ " exitValue = " + getExitValue() + "\n";
+
+ System.err.println(msg);
+ }
+
+
/**
* Get the contents of the output buffer (stdout and stderr)
*
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java Tue Aug 13 15:49:37 2013 -0700
@@ -27,6 +27,7 @@
private static final String osName = System.getProperty("os.name");
private static final String dataModel = System.getProperty("sun.arch.data.model");
private static final String vmVersion = System.getProperty("java.vm.version");
+ private static final String osArch = System.getProperty("os.arch");
public static boolean is64bit() {
return dataModel.equals("64");
@@ -59,4 +60,14 @@
public static String getVMVersion() {
return vmVersion;
}
+
+ // Returns true for sparc and sparcv9.
+ public static boolean isSparc() {
+ return osArch.toLowerCase().startsWith("sparc");
+ }
+
+ public static String getOsArch() {
+ return osArch;
+ }
+
}
diff -r 424d84a2276f -r 9dc631273af7 hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Tue Aug 13 15:41:55 2013 +0400
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/ProcessTools.java Tue Aug 13 15:49:37 2013 -0700
@@ -31,6 +31,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import sun.management.VMManagement;
@@ -107,6 +108,22 @@
}
/**
+ * Get the string containing input arguments passed to the VM
+ *
+ * @return arguments
+ */
+ public static String getVmInputArguments() {
+ RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+
+ List args = runtime.getInputArguments();
+ StringBuilder result = new StringBuilder();
+ for (String arg : args)
+ result.append(arg).append(' ');
+
+ return result.toString();
+ }
+
+ /**
* Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
*
* @return String[] with platform specific arguments, empty if there are none
@@ -132,8 +149,13 @@
Collections.addAll(args, getPlatformSpecificVMArgs());
Collections.addAll(args, command);
+ // Reporting
+ StringBuilder cmdLine = new StringBuilder();
+ for (String cmd : args)
+ cmdLine.append(cmd).append(' ');
+ System.out.println("Command line: [" + cmdLine.toString() + "]");
+
return new ProcessBuilder(args.toArray(new String[args.size()]));
-
}
}
diff -r 424d84a2276f -r 9dc631273af7 jaxp/.hgtags
--- a/jaxp/.hgtags Tue Aug 13 15:41:55 2013 +0400
+++ b/jaxp/.hgtags Tue Aug 13 15:49:37 2013 -0700
@@ -223,3 +223,4 @@
adf49c3ef83c160d53ece623049b2cdccaf78fc7 jdk8-b99
5d1974c1d7b9a86431bc253dc5a6a52d4586622e jdk8-b100
0a7432f898e579ea35e8c51e3edab37f949168e4 jdk8-b101
+7cffafa606e9fb865e7b5e6a56e0a681ce5cf617 jdk8-b102
diff -r 424d84a2276f -r 9dc631273af7 jaxws/.hgtags
--- a/jaxws/.hgtags Tue Aug 13 15:41:55 2013 +0400
+++ b/jaxws/.hgtags Tue Aug 13 15:49:37 2013 -0700
@@ -223,3 +223,4 @@
8ef83d4b23c933935e28f59b282cea920b1b1f5f jdk8-b99
4fd722afae5c02f00bbd44c3a34425ee474afb1c jdk8-b100
60b623a361642a0f5aef5f06dad9e5f279b9d9a9 jdk8-b101
+988a5f2ac559dcab05698b8a8633aa453e012260 jdk8-b102
diff -r 424d84a2276f -r 9dc631273af7 jdk/.hgtags
--- a/jdk/.hgtags Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/.hgtags Tue Aug 13 15:49:37 2013 -0700
@@ -223,3 +223,4 @@
6a099a36589bd933957272ba63e5263bede29971 jdk8-b99
5be9c5bfcfe9b2a40412b4fb364377d49de014eb jdk8-b100
6901612328239fbd471d20823113c1cf3fdaebee jdk8-b101
+8ed8e2b4b90e0ac9aa5b3efef51cd576a9db96a9 jdk8-b102
diff -r 424d84a2276f -r 9dc631273af7 jdk/makefiles/CompileNativeLibraries.gmk
--- a/jdk/makefiles/CompileNativeLibraries.gmk Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/makefiles/CompileNativeLibraries.gmk Tue Aug 13 15:49:37 2013 -0700
@@ -798,6 +798,16 @@
LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
endif
+ifeq ($(OPENJDK_TARGET_OS),linux)
+ifndef OPENJDK
+include $(JDK_TOPDIR)/make/closed/xawt.gmk
+endif
+
+ifeq ($(DISABLE_XRENDER),true)
+ LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
+endif
+endif
+
ifeq ($(MILESTONE),internal)
LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
endif
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m
--- a/jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/macosx/native/java/util/SCDynamicStoreConfig.m Tue Aug 13 15:49:37 2013 -0700
@@ -103,7 +103,6 @@
CFTypeRef realmInfo = SCDynamicStoreCopyValue(store, (CFStringRef) [NSString stringWithFormat:@"Kerberos:%@", realm]);
if (CFGetTypeID(realmInfo) != CFDictionaryGetTypeID()) {
- NSLog(@"Unexpected CFType for realm Info: %lu", CFGetTypeID(realmInfo));
return nil;
}
@@ -140,7 +139,6 @@
SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("java"), _SCDynamicStoreCallBack, NULL);
if (store == NULL) {
- NSLog(@"Unable to load SCDynamicStore to install NotificationCallback");
return;
}
@@ -171,19 +169,11 @@
SCDynamicStoreRef store = SCDynamicStoreCreate(NULL, CFSTR("java-kerberos"), NULL, NULL);
if (store == NULL) {
- NSLog(@"Unable to load SCDynamicStore");
- return NULL;
- }
-
- // Create the store if it is NULL and set it.
- if (store == NULL) {
- NSLog(@"Invalid value for SCDynamicStore");
return NULL;
}
CFTypeRef realms = SCDynamicStoreCopyValue(store, (CFStringRef) KERBEROS_DEFAULT_REALMS);
if (realms == NULL || CFGetTypeID(realms) != CFArrayGetTypeID()) {
- NSLog(@"Unable to load realm info from SCDynamicStore");
if (realms) CFRelease(realms);
CFRelease(store);
return NULL;
@@ -192,7 +182,6 @@
CFTypeRef realmMappings = SCDynamicStoreCopyValue(store, (CFStringRef) KERBEROS_DEFAULT_REALM_MAPPINGS);
if (realmMappings == NULL || CFGetTypeID(realmMappings) != CFArrayGetTypeID()) {
- NSLog(@"Unable to load realm mapping info from SCDynamicStore");
if (realmMappings) CFRelease(realmMappings);
CFRelease(realms);
CFRelease(store);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/com/sun/security/auth/PolicyFile.java
--- a/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -47,6 +47,10 @@
import sun.security.util.PropertyExpander;
+import sun.security.provider.PolicyParser.PrincipalEntry;
+import sun.security.provider.PolicyParser.GrantEntry;
+import sun.security.provider.PolicyParser.PermissionEntry;
+
/**
* This class represents a default implementation for
* javax.security.auth.Policy
.
@@ -469,7 +473,8 @@
* @param policyFile the policy Reader object.
*/
private void init(URL policy) {
- PolicyParser pp = new PolicyParser(expandProperties);
+ sun.security.provider.PolicyParser pp =
+ new sun.security.provider.PolicyParser(expandProperties);
try {
InputStreamReader isr
= new InputStreamReader(getInputStream(policy));
@@ -477,12 +482,12 @@
isr.close();
KeyStore keyStore = initKeyStore(policy, pp.getKeyStoreUrl(),
pp.getKeyStoreType());
- Enumeration enum_ = pp.grantElements();
+ Enumeration enum_ = pp.grantElements();
while (enum_.hasMoreElements()) {
- PolicyParser.GrantEntry ge = enum_.nextElement();
+ GrantEntry ge = enum_.nextElement();
addGrantEntry(ge, keyStore);
}
- } catch (PolicyParser.ParsingException pe) {
+ } catch (sun.security.provider.PolicyParser.ParsingException pe) {
System.err.println(AUTH_POLICY +
rb.getString(".error.parsing.") + policy);
System.err.println(AUTH_POLICY +
@@ -521,8 +526,8 @@
*
* @return null if signedBy alias is not recognized
*/
- CodeSource getCodeSource(PolicyParser.GrantEntry ge, KeyStore keyStore)
- throws java.net.MalformedURLException
+ CodeSource getCodeSource(GrantEntry ge, KeyStore keyStore)
+ throws java.net.MalformedURLException
{
Certificate[] certs = null;
if (ge.signedBy != null) {
@@ -559,20 +564,18 @@
/**
* Add one policy entry to the vector.
*/
- private void addGrantEntry(PolicyParser.GrantEntry ge,
- KeyStore keyStore) {
+ private void addGrantEntry(GrantEntry ge, KeyStore keyStore) {
if (debug != null) {
debug.println("Adding policy entry: ");
debug.println(" signedBy " + ge.signedBy);
debug.println(" codeBase " + ge.codeBase);
if (ge.principals != null && ge.principals.size() > 0) {
- ListIterator li =
- ge.principals.listIterator();
+ ListIterator li = ge.principals.listIterator();
while (li.hasNext()) {
- PolicyParser.PrincipalEntry pppe = li.next();
- debug.println(" " + pppe.principalClass +
- " " + pppe.principalName);
+ PrincipalEntry pppe = li.next();
+ debug.println(" " + pppe.getPrincipalClass() +
+ " " + pppe.getPrincipalName());
}
}
debug.println();
@@ -584,10 +587,9 @@
if (codesource == null) return;
PolicyEntry entry = new PolicyEntry(codesource);
- Enumeration enum_ =
- ge.permissionElements();
+ Enumeration enum_ = ge.permissionElements();
while (enum_.hasMoreElements()) {
- PolicyParser.PermissionEntry pe = enum_.nextElement();
+ PermissionEntry pe = enum_.nextElement();
try {
// XXX special case PrivateCredentialPermission-SELF
Permission perm;
@@ -998,11 +1000,11 @@
return true;
}
- ListIterator pli =
- scs.getPrincipals().listIterator();
+ ListIterator pli =
+ scs.getPrincipals().listIterator();
while (pli.hasNext()) {
- PolicyParser.PrincipalEntry principal = pli.next();
+ PrincipalEntry principal = pli.next();
// XXX
// if the Policy entry's Principal does not contain a
@@ -1050,30 +1052,29 @@
* if (y == 1), it's the principal name.
*/
private String[][] getPrincipalInfo
- (PolicyParser.PrincipalEntry principal,
- final CodeSource accCs) {
+ (PrincipalEntry principal, final CodeSource accCs) {
// there are 3 possibilities:
// 1) the entry's Principal class and name are not wildcarded
// 2) the entry's Principal name is wildcarded only
// 3) the entry's Principal class and name are wildcarded
- if (!principal.principalClass.equals
- (PolicyParser.PrincipalEntry.WILDCARD_CLASS) &&
- !principal.principalName.equals
- (PolicyParser.PrincipalEntry.WILDCARD_NAME)) {
+ if (!principal.getPrincipalClass().equals
+ (PrincipalEntry.WILDCARD_CLASS) &&
+ !principal.getPrincipalName().equals
+ (PrincipalEntry.WILDCARD_NAME)) {
// build a PrivateCredentialPermission for the principal
// from the Policy entry
String[][] info = new String[1][2];
- info[0][0] = principal.principalClass;
- info[0][1] = principal.principalName;
+ info[0][0] = principal.getPrincipalClass();
+ info[0][1] = principal.getPrincipalName();
return info;
- } else if (!principal.principalClass.equals
- (PolicyParser.PrincipalEntry.WILDCARD_CLASS) &&
- principal.principalName.equals
- (PolicyParser.PrincipalEntry.WILDCARD_NAME)) {
+ } else if (!principal.getPrincipalClass().equals
+ (PrincipalEntry.WILDCARD_CLASS) &&
+ principal.getPrincipalName().equals
+ (PrincipalEntry.WILDCARD_NAME)) {
// build a PrivateCredentialPermission for all
// the Subject's principals that are instances of principalClass
@@ -1088,7 +1089,7 @@
// If it doesn't, we should stop here with a ClassCastException.
@SuppressWarnings("unchecked")
Class extends Principal> pClass = (Class extends Principal>)
- Class.forName(principal.principalClass, false,
+ Class.forName(principal.getPrincipalClass(), false,
ClassLoader.getSystemClassLoader());
principalSet = scs.getSubject().getPrincipals(pClass);
} catch (Exception e) {
@@ -1387,6 +1388,7 @@
}
}
+@SuppressWarnings("deprecation")
class PolicyPermissions extends PermissionCollection {
private static final long serialVersionUID = -1954188373270545523L;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java
--- a/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/com/sun/security/auth/SubjectCodeSource.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, 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
@@ -33,6 +33,7 @@
import java.lang.reflect.Constructor;
import javax.security.auth.Subject;
+import sun.security.provider.PolicyParser.PrincipalEntry;
/**
* This SubjectCodeSource
class contains
@@ -57,7 +58,7 @@
});
private Subject subject;
- private LinkedList principals;
+ private LinkedList principals;
private static final Class[] PARAMS = { String.class };
private static final sun.security.util.Debug debug =
sun.security.util.Debug.getInstance("auth", "\t[Auth Access]");
@@ -87,14 +88,14 @@
* SubjectCodeSource
*/
SubjectCodeSource(Subject subject,
- LinkedList principals,
+ LinkedList principals,
URL url, Certificate[] certs) {
super(url, certs);
this.subject = subject;
this.principals = (principals == null ?
- new LinkedList() :
- new LinkedList(principals));
+ new LinkedList() :
+ new LinkedList(principals));
sysClassLoader = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction() {
public ClassLoader run() {
@@ -114,7 +115,7 @@
* SubjectCodeSource
as a LinkedList
* of PolicyParser.PrincipalEntry
objects.
*/
- LinkedList getPrincipals() {
+ LinkedList getPrincipals() {
return principals;
}
@@ -167,7 +168,7 @@
*/
public boolean implies(CodeSource codesource) {
- LinkedList subjectList = null;
+ LinkedList subjectList = null;
if (codesource == null ||
!(codesource instanceof SubjectCodeSource) ||
@@ -197,20 +198,19 @@
return false;
}
- ListIterator li =
- this.principals.listIterator(0);
+ ListIterator li = this.principals.listIterator(0);
while (li.hasNext()) {
- PolicyParser.PrincipalEntry pppe = li.next();
+ PrincipalEntry pppe = li.next();
try {
// handle PrincipalComparators
Class> principalComparator = Class.forName(
- pppe.principalClass, true, sysClassLoader);
+ pppe.getPrincipalClass(), true, sysClassLoader);
Constructor> c = principalComparator.getConstructor(PARAMS);
PrincipalComparator pc =
(PrincipalComparator)c.newInstance
- (new Object[] { pppe.principalName });
+ (new Object[] { pppe.getPrincipalName() });
if (!pc.implies(that.getSubject())) {
if (debug != null)
@@ -236,11 +236,10 @@
Iterator i =
that.getSubject().getPrincipals().iterator();
- subjectList = new LinkedList();
+ subjectList = new LinkedList();
while (i.hasNext()) {
Principal p = i.next();
- PolicyParser.PrincipalEntry spppe =
- new PolicyParser.PrincipalEntry
+ PrincipalEntry spppe = new PrincipalEntry
(p.getClass().getName(), p.getName());
subjectList.add(spppe);
}
@@ -281,23 +280,19 @@
* pppe argument.
*/
private boolean subjectListImpliesPrincipalEntry(
- LinkedList subjectList,
- PolicyParser.PrincipalEntry pppe) {
+ LinkedList subjectList, PrincipalEntry pppe) {
- ListIterator li =
- subjectList.listIterator(0);
+ ListIterator li = subjectList.listIterator(0);
while (li.hasNext()) {
- PolicyParser.PrincipalEntry listPppe = li.next();
+ PrincipalEntry listPppe = li.next();
- if (pppe.principalClass.equals
- (PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
- pppe.principalClass.equals
- (listPppe.principalClass)) {
-
- if (pppe.principalName.equals
- (PolicyParser.PrincipalEntry.WILDCARD_NAME) ||
- pppe.principalName.equals
- (listPppe.principalName))
+ if (pppe.getPrincipalClass().equals
+ (PrincipalEntry.WILDCARD_CLASS) ||
+ pppe.getPrincipalClass().equals(listPppe.getPrincipalClass()))
+ {
+ if (pppe.getPrincipalName().equals
+ (PrincipalEntry.WILDCARD_NAME) ||
+ pppe.getPrincipalName().equals(listPppe.getPrincipalName()))
return true;
}
}
@@ -390,13 +385,12 @@
}
}
if (principals != null) {
- ListIterator li =
- principals.listIterator();
+ ListIterator li = principals.listIterator();
while (li.hasNext()) {
- PolicyParser.PrincipalEntry pppe = li.next();
+ PrincipalEntry pppe = li.next();
returnMe = returnMe + rb.getString("NEWLINE") +
- pppe.principalClass + " " +
- pppe.principalName;
+ pppe.getPrincipalClass() + " " +
+ pppe.getPrincipalName();
}
}
return returnMe;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/com/sun/tools/hat/resources/hat.js
--- a/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/com/sun/tools/hat/resources/hat.js Tue Aug 13 15:49:37 2013 -0700
@@ -151,7 +151,7 @@
while (tmp != null) {
res[res.length] = tmp;
tmp = tmp.superclass;
- }
+ }
return res;
}
@@ -263,16 +263,19 @@
if (name == 'class') {
return wrapJavaValue(instance.clazz);
- } else if (name == 'toString') {
- return function() {
- return instance.toString();
- }
} else if (name == 'wrapped-object') {
return instance;
}
return undefined;
- }
+ },
+ __call__: function(name) {
+ if (name == 'toString') {
+ return instance.toString();
+ } else {
+ return undefined;
+ }
+ }
}
}
@@ -297,7 +300,7 @@
return true;
}
}
- return theJavaClassProto[name] != undefined;
+ return false;
},
__get__ : function(name) {
for (var i in fields) {
@@ -305,7 +308,7 @@
return wrapJavaValue(fields[i].value);
}
}
- return theJavaClassProto[name];
+ return undefined;
}
}
@@ -322,7 +325,12 @@
this.name = jclass.name;
this.fields = jclass.fields;
this['wrapped-object'] = jclass;
- this.__proto__ = this.statics;
+ }
+
+ for (var i in theJavaClassProto) {
+ if (typeof theJavaClassProto[i] == 'function') {
+ JavaClassWrapper.prototype[i] = theJavaClassProto[i];
+ }
}
// returns wrapper for Java object arrays
@@ -334,32 +342,35 @@
__getIds__ : function() {
var res = new Array(elements.length);
for (var i = 0; i < elements.length; i++) {
- res[i] = i;
+ res[i] = String(i);
}
return res;
},
__has__: function(name) {
- return (typeof(name) == 'number' &&
- name >= 0 && name < elements.length) ||
+ return (name >= 0 && name < elements.length) ||
name == 'length' || name == 'class' ||
name == 'toString' || name == 'wrapped-object';
},
__get__ : function(name) {
- if (typeof(name) == 'number' &&
- name >= 0 && name < elements.length) {
+ if (name >= 0 && name < elements.length) {
return wrapJavaValue(elements[name]);
} else if (name == 'length') {
return elements.length;
} else if (name == 'class') {
return wrapJavaValue(array.clazz);
- } else if (name == 'toString') {
- return function() { return array.toString(); }
} else if (name == 'wrapped-object') {
return array;
} else {
return undefined;
}
- }
+ },
+ __call__: function(name) {
+ if (name == 'toString') {
+ return array.toString();
+ } else {
+ return undefined;
+ }
+ }
}
}
@@ -373,26 +384,22 @@
__getIds__ : function() {
var r = new Array(array.length);
for (var i = 0; i < array.length; i++) {
- r[i] = i;
+ r[i] = String(i);
}
return r;
},
__has__: function(name) {
- return (typeof(name) == 'number' &&
- name >= 0 && name < array.length) ||
+ return (name >= 0 && name < array.length) ||
name == 'length' || name == 'class' ||
name == 'toString' || name == 'wrapped-object';
},
__get__: function(name) {
- if (typeof(name) == 'number' &&
- name >= 0 && name < array.length) {
+ if (name >= 0 && name < array.length) {
return elements[name];
}
if (name == 'length') {
return array.length;
- } else if (name == 'toString') {
- return function() { return array.valueString(true); }
} else if (name == 'wrapped-object') {
return array;
} else if (name == 'class') {
@@ -400,7 +407,14 @@
} else {
return undefined;
}
- }
+ },
+ __call__: function(name) {
+ if (name == 'toString') {
+ return array.valueString(true);
+ } else {
+ return undefined;
+ }
+ }
}
}
return javaObject(thing);
@@ -673,34 +687,33 @@
__getIds__ : function() {
var res = new Array(path.length);
for (var i = 0; i < path.length; i++) {
- res[i] = i;
+ res[i] = String(i);
}
return res;
},
__has__ : function (name) {
- return (typeof(name) == 'number' &&
- name >= 0 && name < path.length) ||
+ return (name >= 0 && name < path.length) ||
name == 'length' || name == 'toHtml' ||
name == 'toString';
},
__get__ : function(name) {
- if (typeof(name) == 'number' &&
- name >= 0 && name < path.length) {
+ if (name >= 0 && name < path.length) {
return path[name];
} else if (name == 'length') {
return path.length;
- } else if (name == 'toHtml') {
- return function() {
- return computeDescription(true);
- }
- } else if (name == 'toString') {
- return function() {
- return computeDescription(false);
- }
} else {
return undefined;
}
},
+ __call__: function(name) {
+ if (name == 'toHtml') {
+ return computeDescription(true);
+ } else if (name == 'toString') {
+ return computeDescription(false);
+ } else {
+ return undefined;
+ }
+ }
};
}
@@ -1005,22 +1018,8 @@
return "" +
name + "@" + id + "";
}
- } else if ((typeof(obj) == 'object') || (obj instanceof JSAdapter)) {
- if (obj instanceof java.lang.Object) {
- // script wrapped Java object
- obj = wrapIterator(obj);
- // special case for enumeration
- if (obj instanceof java.util.Enumeration) {
- var res = "[ ";
- while (obj.hasMoreElements()) {
- res += toHtml(obj.nextElement()) + ", ";
- }
- res += "]";
- return res;
- } else {
- return obj;
- }
- } else if (obj instanceof Array) {
+ } else if (obj instanceof Object) {
+ if (Array.isArray(obj)) {
// script array
var res = "[ ";
for (var i in obj) {
@@ -1047,8 +1046,19 @@
}
}
} else {
- // JavaScript primitive value
- return obj;
+ // a Java object
+ obj = wrapIterator(obj);
+ // special case for enumeration
+ if (obj instanceof java.util.Enumeration) {
+ var res = "[ ";
+ while (obj.hasMoreElements()) {
+ res += toHtml(obj.nextElement()) + ", ";
+ }
+ res += "]";
+ return res;
+ } else {
+ return obj;
+ }
}
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html
--- a/jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/com/sun/tools/hat/resources/oqlhelp.html Tue Aug 13 15:49:37 2013 -0700
@@ -79,7 +79,7 @@
select all Strings of length 100 or more
- select s from java.lang.String s where s.count >= 100
+ select s from java.lang.String s where s.value.length >= 100
select all int arrays of length 256 or more
@@ -92,7 +92,7 @@
select s.value.toString() from java.lang.String s
- where /java/(s.value.toString())
+ where /java/.test(s.value.toString())
show path value of all File objects
@@ -219,7 +219,6 @@
select heap.findClass("java.lang.System").statics.props
- select heap.findClass("java.lang.System").props
get number of fields of java.lang.String class
@@ -237,7 +236,7 @@
select all classes that have name pattern java.net.*
- select filter(heap.classes(), "/java.net./(it.name)")
+ select filter(heap.classes(), "/java.net./.test(it.name)")
@@ -536,7 +535,7 @@
Example: print number of classes that have specific name pattern
- select count(heap.classes(), "/java.io./(it.name)")
+ select count(heap.classes(), "/java.io./.test(it.name)")
@@ -559,14 +558,14 @@
show all classes that have java.io.* name pattern
- select filter(heap.classes(), "/java.io./(it.name)")
+ select filter(heap.classes(), "/java.io./.test(it.name)")
show all referrers of URL object where the referrer is not from
java.net package
- select filter(referrers(u), "! /java.net./(classof(it).name)")
+ select filter(referrers(u), "! /java.net./.test(classof(it).name)")
from java.net.URL u
@@ -619,13 +618,13 @@
find the maximum length of any String instance
- select max(map(heap.objects('java.lang.String', false), 'it.count'))
+ select max(map(heap.objects('java.lang.String', false), 'it.value.length'))
find string instance that has the maximum length
- select max(heap.objects('java.lang.String'), 'lhs.count > rhs.count')
+ select max(heap.objects('java.lang.String'), 'lhs.value.length > rhs.value.length')
@@ -775,7 +774,7 @@
- select map(filter(heap.findClass('java.lang.System').props.table, 'it != null'),
+ select map(filter(heap.findClass('java.lang.System').statics.props.table, 'it != null'),
function (it) {
var res = "";
while (it != null) {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/applet/AppletContext.java
--- a/jdk/src/share/classes/java/applet/AppletContext.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/applet/AppletContext.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, 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
@@ -56,7 +56,7 @@
/**
* Returns an Image
object that can then be painted on
- * the screen. The url
argument
that is
+ * the screen. The url
argument that is
* passed as an argument must specify an absolute URL.
*
* This method always returns immediately, whether or not the image
@@ -157,7 +157,7 @@
* @param stream stream to be associated with the specified key. If this
* parameter is null
, the specified key is removed
* in this applet context.
- * @throws IOException
if the stream size exceeds a certain
+ * @throws IOException if the stream size exceeds a certain
* size limit. Size limit is decided by the implementor of this
* interface.
* @since 1.4
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/BufferStrategy.java
--- a/jdk/src/share/classes/java/awt/image/BufferStrategy.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/BufferStrategy.java Tue Aug 13 15:49:37 2013 -0700
@@ -55,7 +55,7 @@
* Alternatively, the contents of the back buffer can be copied, or
* blitted forward in a chain instead of moving the video pointer.
*
- *
+ * {@code
* Double buffering:
*
* *********** ***********
@@ -72,7 +72,7 @@
* * * <------ * * <----- * *
* *********** *********** ***********
*
- *
+ * }
*
* Here is an example of how buffer strategies can be created and used:
*
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/BufferedImage.java
--- a/jdk/src/share/classes/java/awt/image/BufferedImage.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java Tue Aug 13 15:49:37 2013 -0700
@@ -602,12 +602,12 @@
* the raster has been premultiplied with alpha.
* @param properties Hashtable
of
* String
/Object
pairs.
- * @exception RasterFormatException
if the number and
+ * @exception RasterFormatException if the number and
* types of bands in the SampleModel
of the
* Raster
do not match the number and types required by
* the ColorModel
to represent its color and alpha
* components.
- * @exception IllegalArgumentException
if
+ * @exception IllegalArgumentException if
* raster
is incompatible with cm
* @see ColorModel
* @see Raster
@@ -927,7 +927,7 @@
* each color component in the returned data when
* using this method. With a specified coordinate (x, y) in the
* image, the ARGB pixel can be accessed in this way:
- *
+ *
*
*
* pixel = rgbArray[offset + (y-startY)*scansize + (x-startX)];
@@ -1131,7 +1131,7 @@
* @return an {@link Object} that is the property referred to by the
* specified name
or null
if the
* properties of this image are not yet known.
- * @throws NullPointerException
if the property name is null.
+ * @throws NullPointerException if the property name is null.
* @see ImageObserver
* @see java.awt.Image#UndefinedProperty
*/
@@ -1144,7 +1144,7 @@
* @param name the property name
* @return an Object
that is the property referred to by
* the specified name
.
- * @throws NullPointerException
if the property name is null.
+ * @throws NullPointerException if the property name is null.
*/
public Object getProperty(String name) {
if (name == null) {
@@ -1196,7 +1196,7 @@
* @param h the height of the specified rectangular region
* @return a BufferedImage
that is the subimage of this
* BufferedImage
.
- * @exception RasterFormatException
if the specified
+ * @exception RasterFormatException if the specified
* area is not contained within this BufferedImage
.
*/
public BufferedImage getSubimage (int x, int y, int w, int h) {
@@ -1388,7 +1388,7 @@
* @param tileY the y index of the requested tile in the tile array
* @return a Raster
that is the tile defined by the
* arguments tileX
and tileY
.
- * @exception ArrayIndexOutOfBoundsException
if both
+ * @exception ArrayIndexOutOfBoundsException if both
* tileX
and tileY
are not
* equal to 0
*/
@@ -1558,7 +1558,7 @@
* @return true
if the tile specified by the specified
* indices is checked out for writing; false
* otherwise.
- * @exception ArrayIndexOutOfBoundsException
if both
+ * @exception ArrayIndexOutOfBoundsException if both
* tileX
and tileY
are not equal
* to 0
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/ByteLookupTable.java
--- a/jdk/src/share/classes/java/awt/image/ByteLookupTable.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/ByteLookupTable.java Tue Aug 13 15:49:37 2013 -0700
@@ -171,7 +171,7 @@
* @exception ArrayIndexOutOfBoundsException if src
is
* longer than dst
or if for any element
* i
of src
,
- * (src[i]&0xff)-offset
is either less than
+ * {@code (src[i]&0xff)-offset} is either less than
* zero or greater than or equal to the length of the
* lookup table for any band.
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/ColorModel.java
--- a/jdk/src/share/classes/java/awt/image/ColorModel.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/ColorModel.java Tue Aug 13 15:49:37 2013 -0700
@@ -692,12 +692,12 @@
* DataBuffer.TYPE_INT
.
* @param inData an array of pixel values
* @return the value of the green component of the specified pixel.
- * @throws ClassCastException
if inData
+ * @throws ClassCastException if inData
* is not a primitive array of type transferType
- * @throws ArrayIndexOutOfBoundsException
if
+ * @throws ArrayIndexOutOfBoundsException if
* inData
is not large enough to hold a pixel value
* for this ColorModel
- * @throws UnsupportedOperationException
if this
+ * @throws UnsupportedOperationException if this
* tranferType
is not supported by this
* ColorModel
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/DirectColorModel.java
--- a/jdk/src/share/classes/java/awt/image/DirectColorModel.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/DirectColorModel.java Tue Aug 13 15:49:37 2013 -0700
@@ -642,12 +642,12 @@
* @param inData the specified pixel
* @return the alpha component of the specified pixel, scaled from
* 0 to 255.
- * @exception ClassCastException
if inData
+ * @exception ClassCastException if inData
* is not a primitive array of type transferType
- * @exception ArrayIndexOutOfBoundsException
if
+ * @exception ArrayIndexOutOfBoundsException if
* inData
is not large enough to hold a pixel value
* for this ColorModel
- * @exception UnsupportedOperationException
if this
+ * @exception UnsupportedOperationException if this
* tranferType
is not supported by this
* ColorModel
*/
@@ -1055,7 +1055,7 @@
* begin retrieving the color and alpha components
* @return an int
pixel value in this
* ColorModel
corresponding to the specified components.
- * @exception ArrayIndexOutOfBoundsException
if
+ * @exception ArrayIndexOutOfBoundsException if
* the components
array is not large enough to
* hold all of the color and alpha components starting at
* offset
@@ -1097,9 +1097,9 @@
* and alpha components
* @return an Object
representing an array of color and
* alpha components.
- * @exception ClassCastException
if obj
+ * @exception ClassCastException if obj
* is not a primitive array of type transferType
- * @exception ArrayIndexOutOfBoundsException
if
+ * @exception ArrayIndexOutOfBoundsException if
* obj
is not large enough to hold a pixel value
* for this ColorModel
or the components
* array is not large enough to hold all of the color and alpha
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/ImageProducer.java
--- a/jdk/src/share/classes/java/awt/image/ImageProducer.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/ImageProducer.java Tue Aug 13 15:49:37 2013 -0700
@@ -100,11 +100,11 @@
* ImageProducer
should respond by executing
* the following minimum set of ImageConsumer
* method calls:
- *
+ * {@code
* ic.setHints(TOPDOWNLEFTRIGHT | < otherhints >);
* ic.setPixels(...); // As many times as needed
* ic.imageComplete();
- *
+ * }
* @param ic the specified ImageConsumer
* @see ImageConsumer#setHints
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/IndexColorModel.java
--- a/jdk/src/share/classes/java/awt/image/IndexColorModel.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/IndexColorModel.java Tue Aug 13 15:49:37 2013 -0700
@@ -98,6 +98,7 @@
* Index values greater than or equal to the map size, but less than
* 2n, are undefined and return 0 for all color and
* alpha components.
+ *
*
* For those methods that use a primitive array pixel representation of
* type transferType
, the array length is always one.
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/MemoryImageSource.java
--- a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java Tue Aug 13 15:49:37 2013 -0700
@@ -37,7 +37,7 @@
* uses an array to produce pixel values for an Image. Here is an example
* which calculates a 100x100 image representing a fade from black to blue
* along the X axis and a fade from black to red along the Y axis:
- *
+ * {@code
*
* int w = 100;
* int h = 100;
@@ -52,12 +52,12 @@
* }
* Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
*
- *
+ * }
* The MemoryImageSource is also capable of managing a memory image which
* varies over time to allow animation or custom rendering. Here is an
* example showing how to set up the animation source and signal changes
* in the data (adapted from the MemoryAnimationSourceDemo by Garth Dickie):
- *
+ * {@code
*
* int pixels[];
* MemoryImageSource source;
@@ -96,7 +96,7 @@
* }
* }
*
- *
+ * }
*
* @see ImageProducer
*
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java
--- a/jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/MultiPixelPackedSampleModel.java Tue Aug 13 15:49:37 2013 -0700
@@ -52,14 +52,14 @@
* x, y
from DataBuffer
data
* and storing the pixel data in data elements of type
* dataType
:
- *
+ * {@code
* int dataElementSize = DataBuffer.getDataTypeSize(dataType);
* int bitnum = dataBitOffset + x*pixelBitStride;
* int element = data.getElem(y*scanlineStride + bitnum/dataElementSize);
* int shift = dataElementSize - (bitnum & (dataElementSize-1))
* - pixelBitStride;
* int pixel = (element >> shift) & ((1 << pixelBitStride) - 1);
- *
+ * }
*/
public class MultiPixelPackedSampleModel extends SampleModel
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/PixelGrabber.java
--- a/jdk/src/share/classes/java/awt/image/PixelGrabber.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/PixelGrabber.java Tue Aug 13 15:49:37 2013 -0700
@@ -35,7 +35,7 @@
* The PixelGrabber class implements an ImageConsumer which can be attached
* to an Image or ImageProducer object to retrieve a subset of the pixels
* in that image. Here is an example:
- *
+ * {@code
*
* public void handlesinglepixel(int x, int y, int pixel) {
* int alpha = (pixel >> 24) & 0xff;
@@ -65,7 +65,7 @@
* }
* }
*
- *
+ * }
*
* @see ColorModel#getRGBdefault
*
@@ -165,8 +165,8 @@
* accumulated in the default RGB ColorModel. If the forceRGB
* parameter is true, then the pixels will be accumulated in the
* default RGB ColorModel anyway. A buffer is allocated by the
- * PixelGrabber to hold the pixels in either case. If (w < 0) or
- * (h < 0), then they will default to the remaining width and
+ * PixelGrabber to hold the pixels in either case. If {@code (w < 0)} or
+ * {@code (h < 0)}, then they will default to the remaining width and
* height of the source data when that information is delivered.
* @param img the image to retrieve the image data from
* @param x the x coordinate of the upper left corner of the rectangle
@@ -233,10 +233,10 @@
* behaves in the following ways, depending on the value of
* ms
:
*
- * - If
ms
== 0, waits until all pixels are delivered
- * - If
ms
> 0, waits until all pixels are delivered
+ * - If {@code ms == 0}, waits until all pixels are delivered
+ *
- If {@code ms > 0}, waits until all pixels are delivered
* as timeout expires.
- *
- If
ms
< 0, returns true
if all pixels
+ * - If {@code ms < 0}, returns
true
if all pixels
* are grabbed, false
otherwise and does not wait.
*
* @param ms the number of milliseconds to wait for the image pixels
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/RGBImageFilter.java
--- a/jdk/src/share/classes/java/awt/image/RGBImageFilter.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/RGBImageFilter.java Tue Aug 13 15:49:37 2013 -0700
@@ -39,7 +39,7 @@
* The only method which needs to be defined to create a useable image
* filter is the filterRGB method. Here is an example of a definition
* of a filter which swaps the red and blue components of an image:
- *
+ * {@code
*
* class RedBlueSwapFilter extends RGBImageFilter {
* public RedBlueSwapFilter() {
@@ -56,7 +56,7 @@
* }
* }
*
- *
+ * }
*
* @see FilteredImageSource
* @see ImageFilter
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/ShortLookupTable.java
--- a/jdk/src/share/classes/java/awt/image/ShortLookupTable.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/ShortLookupTable.java Tue Aug 13 15:49:37 2013 -0700
@@ -114,7 +114,7 @@
* @exception ArrayIndexOutOfBoundsException if src
is
* longer than dst
or if for any element
* i
of src
,
- * (src[i]&0xffff)-offset
is either less than
+ * {@code (src[i]&0xffff)-offset} is either less than
* zero or greater than or equal to the length of the
* lookup table for any band.
*/
@@ -165,7 +165,7 @@
* @exception ArrayIndexOutOfBoundsException if src
is
* longer than dst
or if for any element
* i
of src
,
- * (src[i]&0xffff)-offset
is either less than
+ * {@code (src[i]&0xffff)-offset} is either less than
* zero or greater than or equal to the length of the
* lookup table for any band.
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java
--- a/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java Tue Aug 13 15:49:37 2013 -0700
@@ -57,10 +57,10 @@
* The following code illustrates extracting the bits of the sample
* representing band b
for pixel x,y
* from DataBuffer data
:
- *
+ * {@code
* int sample = data.getElem(y * scanlineStride + x);
* sample = (sample & bitMasks[b]) >>> bitOffsets[b];
- *
+ * }
*/
public class SinglePixelPackedSampleModel extends SampleModel
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/awt/image/WritableRaster.java
--- a/jdk/src/share/classes/java/awt/image/WritableRaster.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/awt/image/WritableRaster.java Tue Aug 13 15:49:37 2013 -0700
@@ -372,13 +372,13 @@
* integral type and less than or equal to 32 bits in size, then calling
* this method is equivalent to executing the following code for all
* x,y
addresses valid in both Rasters.
- *
+ * {@code
* Raster srcRaster;
* WritableRaster dstRaster;
* for (int b = 0; b < srcRaster.getNumBands(); b++) {
* dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b));
* }
- *
+ * }
* Thus, when copying an integral type source to an integral type
* destination, if the source sample size is greater than the destination
* sample size for a particular band, the high order bits of the source
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/AppletInitializer.java
--- a/jdk/src/share/classes/java/beans/AppletInitializer.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/AppletInitializer.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -68,7 +68,6 @@
* the Applet with its Container during the subsequent invocation of its
* addChildren() method.
*
- *
*
* @param newAppletBean The newly instantiated JavaBean
* @param bCtxt The BeanContext intended for this Applet, or
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/Beans.java
--- a/jdk/src/share/classes/java/beans/Beans.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/Beans.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -62,7 +62,7 @@
*
* Instantiate a JavaBean.
*
- *
+ * @return a JavaBean
* @param cls the class-loader from which we should create
* the bean. If this is null, then the system
* class-loader is used.
@@ -82,6 +82,7 @@
*
* Instantiate a JavaBean.
*
+ * @return a JavaBean
*
* @param cls the class-loader from which we should create
* the bean. If this is null, then the system
@@ -137,6 +138,7 @@
* the JDK appletviewer (for a reference browser environment) and the
* BDK BeanBox (for a reference bean container).
*
+ * @return a JavaBean
* @param cls the class-loader from which we should create
* the bean. If this is null, then the system
* class-loader is used.
@@ -361,6 +363,8 @@
* This method is provided in Beans 1.0 as a hook to allow the
* addition of more flexible bean behaviour in the future.
*
+ * @return an object representing a specified type view of the
+ * source object
* @param bean Object from which we want to obtain a view.
* @param targetType The type of view we'd like to get.
*
@@ -384,7 +388,6 @@
return Introspector.isSubclass(bean.getClass(), targetType);
}
-
/**
* Test if we are in design-mode.
*
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/ConstructorProperties.java
--- a/jdk/src/share/classes/java/beans/ConstructorProperties.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/ConstructorProperties.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, 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
@@ -61,7 +61,7 @@
the {@code getY()} method. Since parameter names are not in
general available at runtime, without the annotation there would be
no way to know whether the parameters correspond to {@code getX()}
- and {@code getY()} or the other way around.
+ and {@code getY()} or the other way around.
@since 1.6
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java
--- a/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/DefaultPersistenceDelegate.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -382,6 +382,7 @@
* a class such that no property value depends on the value of
* a subsequent property.
*
+ * @param type the type of the instances
* @param oldInstance The instance to be copied.
* @param newInstance The instance that is to be modified.
* @param out The stream to which any initialization statements should be written.
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/EventHandler.java
--- a/jdk/src/share/classes/java/beans/EventHandler.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/EventHandler.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -515,6 +515,7 @@
*
*
*
+ * @param the type to create
* @param listenerInterface the listener interface to create a proxy for
* @param target the object that will perform the action
* @param action the name of a (possibly qualified) property or method on
@@ -570,6 +571,7 @@
*
*
*
+ * @param the type to create
* @param listenerInterface the listener interface to create a proxy for
* @param target the object that will perform the action
* @param action the name of a (possibly qualified) property or method on
@@ -659,6 +661,7 @@
*
*
*
+ * @param the type to create
* @param listenerInterface the listener interface to create a proxy for
* @param target the object that will perform the action
* @param action the name of a (possibly qualified) property or method on
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/Expression.java
--- a/jdk/src/share/classes/java/beans/Expression.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/Expression.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -139,7 +139,7 @@
* replaces this default value in the same way that any other value
* would, ensuring that expressions are never evaluated more than once.
*
- * See the excecute
method for details on how
+ * See the execute
method for details on how
* methods are chosen using the dynamic types of the target
* and arguments.
*
@@ -147,6 +147,8 @@
* @see #setValue
*
* @return The result of applying this method to these arguments.
+ * @throws Exception if the method with the specified methodName
+ * throws an exception
*/
public Object getValue() throws Exception {
if (value == unbound) {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java Tue Aug 13 15:49:37 2013 -0700
@@ -207,6 +207,8 @@
* Sets the method that should be used to read an indexed property value.
*
* @param readMethod The new indexed read method.
+ * @throws IntrospectionException if an exception occurs during
+ * introspection.
*/
public synchronized void setIndexedReadMethod(Method readMethod)
throws IntrospectionException {
@@ -285,6 +287,8 @@
* Sets the method that should be used to write an indexed property value.
*
* @param writeMethod The new indexed write method.
+ * @throws IntrospectionException if an exception occurs during
+ * introspection.
*/
public synchronized void setIndexedWriteMethod(Method writeMethod)
throws IntrospectionException {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/Introspector.java
--- a/jdk/src/share/classes/java/beans/Introspector.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/Introspector.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -93,8 +93,17 @@
public class Introspector {
// Flags that can be used to control getBeanInfo:
+ /**
+ * Flag to indicate to use of all beaninfo.
+ */
public final static int USE_ALL_BEANINFO = 1;
+ /**
+ * Flag to indicate to ignore immediate beaninfo.
+ */
public final static int IGNORE_IMMEDIATE_BEANINFO = 2;
+ /**
+ * Flag to indicate to ignore all beaninfo.
+ */
public final static int IGNORE_ALL_BEANINFO = 3;
// Static Caches to speed up introspection.
@@ -202,7 +211,7 @@
* If the BeanInfo class for a Java Bean has been previously Introspected
* based on the same arguments, then the BeanInfo class is retrieved
* from the BeanInfo cache.
- *
+ * @return the BeanInfo for the bean
* @param beanClass The bean class to be analyzed.
* @param stopClass The baseclass at which to stop the analysis. Any
* methods/properties/events in the stopClass or in its baseclasses
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/PersistenceDelegate.java
--- a/jdk/src/share/classes/java/beans/PersistenceDelegate.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/PersistenceDelegate.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -197,6 +197,7 @@
* The default implementation, calls the initialize
* method of the type's superclass.
*
+ * @param type the type of the instances
* @param oldInstance The instance to be copied.
* @param newInstance The instance that is to be modified.
* @param out The stream to which any initialization statements should be written.
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/PropertyChangeSupport.java
--- a/jdk/src/share/classes/java/beans/PropertyChangeSupport.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/PropertyChangeSupport.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -156,7 +156,7 @@
* PropertyChangeListenerProxy
, perform the cast, and examine
* the parameter.
*
- *
+ * {@code
* PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
* for (int i = 0; i < listeners.length; i++) {
* if (listeners[i] instanceof PropertyChangeListenerProxy) {
@@ -168,7 +168,7 @@
* }
* }
* }
- *
+ * }
*
* @see PropertyChangeListenerProxy
* @return all of the PropertyChangeListeners
added or an
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/PropertyDescriptor.java
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java Tue Aug 13 15:49:37 2013 -0700
@@ -243,6 +243,7 @@
* Sets the method that should be used to read the property value.
*
* @param readMethod The new read method.
+ * @throws IntrospectionException if the read method is invalid
*/
public synchronized void setReadMethod(Method readMethod)
throws IntrospectionException {
@@ -313,6 +314,7 @@
* Sets the method that should be used to write the property value.
*
* @param writeMethod The new write method.
+ * @throws IntrospectionException if the write method is invalid
*/
public synchronized void setWriteMethod(Method writeMethod)
throws IntrospectionException {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/Transient.java
--- a/jdk/src/share/classes/java/beans/Transient.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/Transient.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, 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
@@ -40,7 +40,7 @@
* A {@code true} value for the "transient" attribute
* indicates to encoders derived from {@link Encoder}
* that this feature should be ignored.
- *
+ *
* The {@code Transient} annotation may be be used
* in any of the methods that are involved
* in a {@link FeatureDescriptor} subclass
@@ -49,7 +49,7 @@
* to put the annotation and it is this declaration
* that takes precedence in the case of multiple annotations
* being defined for the same feature.
- *
+ *
* To declare a feature non-transient in a class
* whose superclass declares it transient,
* use {@code @Transient(false)}.
@@ -64,5 +64,11 @@
@Target({METHOD})
@Retention(RUNTIME)
public @interface Transient {
+ /**
+ * Returns whether or not the {@code Introspector} should
+ * construct artifacts for the annotated method.
+ * @return whether or not the {@code Introspector} should
+ * construct artifacts for the annotated method
+ */
boolean value() default true;
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/VetoableChangeSupport.java
--- a/jdk/src/share/classes/java/beans/VetoableChangeSupport.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/VetoableChangeSupport.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -42,7 +42,7 @@
*
* Here is an example of {@code VetoableChangeSupport} usage that follows
* the rules and recommendations laid out in the JavaBeans™ specification:
- *
+ * {@code
* public class MyBean {
* private final VetoableChangeSupport vcs = new VetoableChangeSupport(this);
*
@@ -68,7 +68,7 @@
*
* [...]
* }
- *
+ * }
*
* A {@code VetoableChangeSupport} instance is thread-safe.
*
@@ -156,7 +156,7 @@
* VetoableChangeListenerProxy
, perform the cast, and examine
* the parameter.
*
- *
+ * {@code
* VetoableChangeListener[] listeners = bean.getVetoableChangeListeners();
* for (int i = 0; i < listeners.length; i++) {
* if (listeners[i] instanceof VetoableChangeListenerProxy) {
@@ -168,7 +168,7 @@
* }
* }
* }
- *
+ * }
*
* @see VetoableChangeListenerProxy
* @return all of the VetoableChangeListeners
added or an
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContext.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContext.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContext.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -64,10 +64,12 @@
* and is defined by the
* java.beans.Beans.instantiate()
method.
*
+ * @return a javaBean named as a child of this
+ * BeanContext
* @param beanName The name of the JavaBean to instantiate
* as a child of this BeanContext
- * @throws IOException
- * @throws ClassNotFoundException
if the class identified
+ * @throws IOException if an IO problem occurs
+ * @throws ClassNotFoundException if the class identified
* by the beanName parameter is not found
*/
Object instantiateChild(String beanName) throws IOException, ClassNotFoundException;
@@ -83,7 +85,7 @@
* @return an InputStream
for reading the resource,
* or null
if the resource could not
* be found.
- * @throws IllegalArgumentException
if
+ * @throws IllegalArgumentException if
* the resource is not valid
*/
InputStream getResourceAsStream(String name, BeanContextChild bcc) throws IllegalArgumentException;
@@ -98,7 +100,7 @@
* @param bcc the specified child
* @return a URL
for the named
* resource for the specified child
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException
* if the resource is not valid
*/
URL getResource(String name, BeanContextChild bcc) throws IllegalArgumentException;
@@ -109,7 +111,7 @@
* this BeanContext
whenever it adds
* or removes a child Component
(s).
*
- * @param bcml the BeanContextMembershipListener
to be added
+ * @param bcml the BeanContextMembershipListener to be added
*/
void addBeanContextMembershipListener(BeanContextMembershipListener bcml);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChild.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -82,7 +82,7 @@
*
* @param bc The BeanContext
with which
* to associate this BeanContextChild
.
- * @throws PropertyVetoException
if the
+ * @throws PropertyVetoException if the
* addition of the specified BeanContext
is refused.
*/
void setBeanContext(BeanContext bc) throws PropertyVetoException;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextChildSupport.java Tue Aug 13 15:49:37 2013 -0700
@@ -78,6 +78,7 @@
* construct a BeanContextChildSupport where the JavaBean component
* itself implements BeanContextChild, and encapsulates this, delegating
* that interface to this implementation
+ * @param bcc the underlying bean context child
*/
public BeanContextChildSupport(BeanContextChild bcc) {
@@ -94,7 +95,7 @@
* this BeanContextChildSupport
.
* @param bc the new value to be assigned to the BeanContext
* property
- * @throws PropertyVetoException
if the change is rejected
+ * @throws PropertyVetoException if the change is rejected
*/
public synchronized void setBeanContext(BeanContext bc) throws PropertyVetoException {
if (bc == beanContext) return;
@@ -361,6 +362,9 @@
*/
protected VetoableChangeSupport vcSupport;
+ /**
+ * The bean context.
+ */
protected transient BeanContext beanContext;
/**
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -103,6 +103,7 @@
* Is the child specified affected by the event?
* @return true
if affected, false
* if not
+ * @param child the object to check for being affected
*/
public boolean contains(Object child) {
return children.contains(child);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServices.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -60,6 +60,7 @@
* @param serviceClass the service to add
* @param serviceProvider the BeanContextServiceProvider
* associated with the service
+ * @return true if the service was successful added, false otherwise
*/
boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider);
@@ -108,7 +109,7 @@
* @param bcsrl the
* BeanContextServiceRevokedListener
to notify
* if the service should later become revoked
- * @throws TooManyListenersException
+ * @throws TooManyListenersException if there are too many listeners
* @return a reference to this context's named
* Service as requested or null
*/
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, 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
@@ -603,12 +603,16 @@
serviceProvider = bcsp;
}
+ /**
+ * Returns the service provider.
+ * @return the service provider
+ */
protected BeanContextServiceProvider getServiceProvider() {
return serviceProvider;
}
- /*
- * fields
+ /**
+ * The service provider.
*/
protected BeanContextServiceProvider serviceProvider;
@@ -618,6 +622,9 @@
* subclasses can override this method to create new subclasses of
* BCSSServiceProvider without having to overrride addService() in
* order to instantiate.
+ * @param sc the class
+ * @param bcsp the service provider
+ * @return a service provider without overriding addService()
*/
protected BCSSServiceProvider createBCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
@@ -629,7 +636,7 @@
/**
* add a BeanContextServicesListener
*
- * @throws NullPointerException
+ * @throws NullPointerException if the argument is null
*/
public void addBeanContextServicesListener(BeanContextServicesListener bcsl) {
@@ -660,6 +667,8 @@
/**
* add a service
+ * @param serviceClass the service class
+ * @param bcsp the service provider
*/
public boolean addService(Class serviceClass, BeanContextServiceProvider bcsp) {
@@ -668,6 +677,10 @@
/**
* add a service
+ * @param serviceClass the service class
+ * @param bcsp the service provider
+ * @param fireEvent whether or not an event should be fired
+ * @return true if the service was successfully added
*/
protected boolean addService(Class serviceClass, BeanContextServiceProvider bcsp, boolean fireEvent) {
@@ -709,6 +722,9 @@
/**
* remove a service
+ * @param serviceClass the service class
+ * @param bcsp the service provider
+ * @param revokeCurrentServicesNow whether or not to revoke the service
*/
public void revokeService(Class serviceClass, BeanContextServiceProvider bcsp, boolean revokeCurrentServicesNow) {
@@ -1067,6 +1083,7 @@
/**
* Fires a BeanContextServiceEvent notifying of a new service.
+ * @param serviceClass the service class
*/
protected final void fireServiceAdded(Class serviceClass) {
BeanContextServiceAvailableEvent bcssae = new BeanContextServiceAvailableEvent(getBeanContextServicesPeer(), serviceClass);
@@ -1109,6 +1126,8 @@
* Fires a BeanContextServiceRevokedEvent
* indicating that a particular service is
* no longer available.
+ * @param serviceClass the service class
+ * @param revokeNow whether or not the event should be revoked now
*/
protected final void fireServiceRevoked(Class serviceClass, boolean revokeNow) {
Object[] copy;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextSupport.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, 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
@@ -62,7 +62,6 @@
/**
* This helper class provides a utility implementation of the
* java.beans.beancontext.BeanContext interface.
- *
*
* Since this class directly implements the BeanContext interface, the class
* can, and is intended to be used either by subclassing this implementation,
@@ -351,9 +350,8 @@
* of Child without having to override add() or the other Collection
* methods that add children to the set.
*
- *
* @param targetChild the child to create the Child on behalf of
- * @param peer the peer if the tragetChild and the peer are related by an implementation of BeanContextProxy
+ * @param peer the peer if the tragetChild and the peer are related by an implementation of BeanContextProxy * @return Subtype-specific subclass of Child without overriding collection methods
*/
protected BCSChild createBCSChild(Object targetChild, Object peer) {
@@ -492,6 +490,7 @@
* @param callChildSetBC used to indicate that
* the child should be notified that it is no
* longer nested in this BeanContext.
+ * @return whether or not was present before being removed
*/
protected boolean remove(Object targetChild, boolean callChildSetBC) {
@@ -580,7 +579,8 @@
/**
* add Collection to set of Children (Unsupported)
* implementations must synchronized on the hierarchy lock and "children" protected field
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException thrown unconditionally by this implementation
+ * @return this implementation unconditionally throws {@code UnsupportedOperationException}
*/
public boolean addAll(Collection c) {
throw new UnsupportedOperationException();
@@ -589,7 +589,9 @@
/**
* remove all specified children (Unsupported)
* implementations must synchronized on the hierarchy lock and "children" protected field
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException thrown unconditionally by this implementation
+ * @return this implementation unconditionally throws {@code UnsupportedOperationException}
+
*/
public boolean removeAll(Collection c) {
throw new UnsupportedOperationException();
@@ -599,7 +601,8 @@
/**
* retain only specified children (Unsupported)
* implementations must synchronized on the hierarchy lock and "children" protected field
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException thrown unconditionally by this implementation
+ * @return this implementation unconditionally throws {@code UnsupportedOperationException}
*/
public boolean retainAll(Collection c) {
throw new UnsupportedOperationException();
@@ -608,7 +611,7 @@
/**
* clear the children (Unsupported)
* implementations must synchronized on the hierarchy lock and "children" protected field
- * @throws UnsupportedOperationException
+ * @throws UnsupportedOperationException thrown unconditionally by this implementation
*/
public void clear() {
throw new UnsupportedOperationException();
@@ -618,7 +621,7 @@
* Adds a BeanContextMembershipListener
*
* @param bcml the BeanContextMembershipListener to add
- * @throws NullPointerException
+ * @throws NullPointerException if the argument is null
*/
public void addBeanContextMembershipListener(BeanContextMembershipListener bcml) {
@@ -636,7 +639,7 @@
* Removes a BeanContextMembershipListener
*
* @param bcml the BeanContextMembershipListener to remove
- * @throws NullPointerException
+ * @throws NullPointerException if the argument is null
*/
public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml) {
@@ -655,7 +658,7 @@
* @param bcc the child object making the request.
*
* @return the requested resource as an InputStream
- * @throws NullPointerException
+ * @throws NullPointerException if the argument is null
*/
public InputStream getResourceAsStream(String name, BeanContextChild bcc) {
@@ -849,6 +852,8 @@
*
* This method should not however be used by subclasses to replace their
* own implementation (if any) of writeObject().
+ * @param oos the {@code ObjectOutputStream} to use during serialization
+ * @throws IOException if serialization failed
*/
protected void bcsPreSerializationHook(ObjectOutputStream oos) throws IOException {
@@ -864,6 +869,9 @@
*
* This method should not however be used by subclasses to replace their
* own implementation (if any) of readObject().
+ * @param ois the {@code ObjectInputStream} to use during deserialization
+ * @throws IOException if deserialization failed
+ * @throws ClassNotFoundException if needed classes are not found
*/
protected void bcsPreDeserializationHook(ObjectInputStream ois) throws IOException, ClassNotFoundException {
@@ -914,6 +922,8 @@
* used by readObject to deserialize a collection.
* @param ois the ObjectInputStream to use
* @param coll the Collection
+ * @throws IOException if deserialization failed
+ * @throws ClassNotFoundException if needed classes are not found
*/
protected final void deserialize(ObjectInputStream ois, Collection coll) throws IOException, ClassNotFoundException {
int count = 0;
@@ -1005,6 +1015,9 @@
* When an instance of this class is used as a delegate for the
* implementation of the BeanContext protocols (and its subprotocols)
* there exists a 'chicken and egg' problem during deserialization
+ * @param ois the ObjectInputStream to use
+ * @throws IOException if deserialization failed
+ * @throws ClassNotFoundException if needed classes are not found
*/
public final void readChildren(ObjectInputStream ois) throws IOException, ClassNotFoundException {
@@ -1122,6 +1135,7 @@
* immediately prior to their being added to the BeanContext.
*
*
+ * @param targetChild the child to create the Child on behalf of
* @return true iff the child may be added to this BeanContext, otherwise false.
*/
@@ -1136,6 +1150,7 @@
* immediately prior to their being removed from the BeanContext.
*
*
+ * @param targetChild the child to create the Child on behalf of
* @return true iff the child may be removed from this BeanContext, otherwise false.
*/
@@ -1147,6 +1162,8 @@
* subclasses may override this method to simply extend add() semantics
* after the child has been added and before the event notification has
* occurred. The method is called with the child synchronized.
+ * @param child the child
+ * @param bcsc the BCSChild
*/
protected void childJustAddedHook(Object child, BCSChild bcsc) {
@@ -1156,6 +1173,8 @@
* subclasses may override this method to simply extend remove() semantics
* after the child has been removed and before the event notification has
* occurred. The method is called with the child synchronized.
+ * @param child the child
+ * @param bcsc the BCSChild
*/
protected void childJustRemovedHook(Object child, BCSChild bcsc) {
@@ -1254,6 +1273,7 @@
/**
* Fire a BeanContextshipEvent on the BeanContextMembershipListener interface
+ * @param bcme the event to fire
*/
protected final void fireChildrenAdded(BeanContextMembershipEvent bcme) {
@@ -1267,6 +1287,7 @@
/**
* Fire a BeanContextshipEvent on the BeanContextMembershipListener interface
+ * @param bcme the event to fire
*/
protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme) {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/net/SocketAddress.java
--- a/jdk/src/share/classes/java/net/SocketAddress.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketAddress.java Tue Aug 13 15:49:37 2013 -0700
@@ -39,4 +39,7 @@
* @since 1.4
*/
public abstract class SocketAddress implements java.io.Serializable {
+
+ static final long serialVersionUID = 5215720748342549866L;
+
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/nio/file/Files.java
--- a/jdk/src/share/classes/java/nio/file/Files.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/nio/file/Files.java Tue Aug 13 15:49:37 2013 -0700
@@ -25,10 +25,10 @@
package java.nio.file;
-import java.nio.ByteBuffer;
import java.nio.file.attribute.*;
import java.nio.file.spi.FileSystemProvider;
import java.nio.file.spi.FileTypeDetector;
+import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.channels.SeekableByteChannel;
import java.io.Closeable;
@@ -2965,7 +2965,63 @@
}
/**
- * Read all the bytes from a file. The method ensures that the file is
+ * The maximum size of array to allocate.
+ * Some VMs reserve some header words in an array.
+ * Attempts to allocate larger arrays may result in
+ * OutOfMemoryError: Requested array size exceeds VM limit
+ */
+ private static final int MAX_BUFFER_SIZE = Integer.MAX_VALUE - 8;
+
+ /**
+ * Reads all the bytes from an input stream. Uses {@code initialSize} as a hint
+ * about how many bytes the stream will have.
+ *
+ * @param source
+ * the input stream to read from
+ * @param initialSize
+ * the initial size of the byte array to allocate
+ *
+ * @return a byte array containing the bytes read from the file
+ *
+ * @throws IOException
+ * if an I/O error occurs reading from the stream
+ * @throws OutOfMemoryError
+ * if an array of the required size cannot be allocated
+ */
+ private static byte[] read(InputStream source, int initialSize)
+ throws IOException
+ {
+ int capacity = initialSize;
+ byte[] buf = new byte[capacity];
+ int nread = 0;
+ int n;
+ for (;;) {
+ // read to EOF which may read more or less than initialSize (eg: file
+ // is truncated while we are reading)
+ while ((n = source.read(buf, nread, capacity - nread)) > 0)
+ nread += n;
+
+ // if last call to source.read() returned -1, we are done
+ // otherwise, try to read one more byte; if that failed we're done too
+ if (n < 0 || (n = source.read()) < 0)
+ break;
+
+ // one more byte was read; need to allocate a larger buffer
+ if (capacity <= MAX_BUFFER_SIZE - capacity) {
+ capacity = Math.max(capacity << 1, BUFFER_SIZE);
+ } else {
+ if (capacity == MAX_BUFFER_SIZE)
+ throw new OutOfMemoryError("Required array size too large");
+ capacity = MAX_BUFFER_SIZE;
+ }
+ buf = Arrays.copyOf(buf, capacity);
+ buf[nread++] = (byte)n;
+ }
+ return (capacity == nread) ? buf : Arrays.copyOf(buf, nread);
+ }
+
+ /**
+ * Reads all the bytes from a file. The method ensures that the file is
* closed when all bytes have been read or an I/O error, or other runtime
* exception, is thrown.
*
@@ -2989,22 +3045,13 @@
* method is invoked to check read access to the file.
*/
public static byte[] readAllBytes(Path path) throws IOException {
- try (FileChannel fc = FileChannel.open(path)) {
+ try (FileChannel fc = FileChannel.open(path);
+ InputStream is = Channels.newInputStream(fc)) {
long size = fc.size();
- if (size > (long)Integer.MAX_VALUE)
+ if (size > (long)MAX_BUFFER_SIZE)
throw new OutOfMemoryError("Required array size too large");
- byte[] arr = new byte[(int)size];
- ByteBuffer bb = ByteBuffer.wrap(arr);
- while (bb.hasRemaining()) {
- if (fc.read(bb) < 0) {
- // truncated
- break;
- }
- }
-
- int nread = bb.position();
- return (nread == size) ? arr : Arrays.copyOf(arr, nread);
+ return read(is, (int)size);
}
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/rmi/server/RMISocketFactory.java
--- a/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/rmi/server/RMISocketFactory.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -33,15 +33,47 @@
* in order to obtain client and server sockets for RMI calls. An
* application may use the setSocketFactory
method to
* request that the RMI runtime use its socket factory instance
- * instead of the default implementation.
+ * instead of the default implementation.
*
- * The default socket factory implementation used goes through a
+ *
The default socket factory implementation performs a
* three-tiered approach to creating client sockets. First, a direct
* socket connection to the remote VM is attempted. If that fails
* (due to a firewall), the runtime uses HTTP with the explicit port
* number of the server. If the firewall does not allow this type of
* communication, then HTTP to a cgi-bin script on the server is used
- * to POST the RMI call.
+ * to POST the RMI call.
+ *
+ *
The default socket factory implementation creates server sockets that
+ * are bound to the wildcard address, which accepts requests from all network
+ * interfaces.
+ *
+ * @implNote
+ *
You can use the {@code RMISocketFactory} class to create a server socket that
+ * is bound to a specific address, restricting the origin of requests. For example,
+ * the following code implements a socket factory that binds server sockets to the
+ * loopback address. This restricts RMI to processing requests only from the local host.
+ *
+ *
{@code
+ * class LoopbackSocketFactory extends RMISocketFactory {
+ * public ServerSocket createServerSocket(int port) throws IOException {
+ * return new ServerSocket(port, 5, InetAddress.getLoopbackAddress());
+ * }
+ *
+ * public Socket createSocket(String host, int port) throws IOException {
+ * // just call the default client socket factory
+ * return RMISocketFactory.getDefaultSocketFactory()
+ * .createSocket(host, port);
+ * }
+ * }
+ *
+ * // ...
+ *
+ * RMISocketFactory.setSocketFactory(new LoopbackSocketFactory());
+ * }
+ *
+ * Set the {@code java.rmi.server.hostname} system property
+ * to a host name (typically {@code localhost}) that resolves to the loopback
+ * interface to ensure that the generated stubs use the right network interface.
*
* @author Ann Wollrath
* @author Peter Jones
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java
--- a/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/rmi/server/UnicastRemoteObject.java Tue Aug 13 15:49:37 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -100,6 +100,26 @@
*
*
*
+ * If an object is exported with the
+ * {@link #exportObject(Remote) exportObject(Remote)}
+ * or
+ * {@link #exportObject(Remote, int) exportObject(Remote, port)}
+ * methods, or if a subclass constructor invokes one of the
+ * {@link #UnicastRemoteObject()}
+ * or
+ * {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)}
+ * constructors, the object is exported with a server socket created using the
+ * {@link RMISocketFactory}
+ * class.
+ *
+ * @implNote
+ *
By default, server sockets created by the {@link RMISocketFactory} class
+ * listen on all network interfaces. See the
+ * {@link RMISocketFactory} class and the section
+ * RMI Socket Factories
+ * in the
+ * Java RMI Specification.
+ *
* @author Ann Wollrath
* @author Peter Jones
* @since JDK1.1
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/security/Security.java
--- a/jdk/src/share/classes/java/security/Security.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/security/Security.java Tue Aug 13 15:49:37 2013 -0700
@@ -326,17 +326,13 @@
*
*
A provider cannot be added if it is already installed.
*
- *
First, if there is a security manager, its
- * {@code checkSecurityAccess}
- * method is called with the string
- * {@code "insertProvider."+provider.getName()}
- * to see if it's ok to add a new provider.
- * If the default implementation of {@code checkSecurityAccess}
- * is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's {@code checkPermission} method
- * with a
- * {@code SecurityPermission("insertProvider."+provider.getName())}
- * permission.
+ *
If there is a security manager, the
+ * {@link java.lang.SecurityManager#checkSecurityAccess} method is called
+ * with the {@code "insertProvider"} permission target name to see if
+ * it's ok to add a new provider. If this permission check is denied,
+ * {@code checkSecurityAccess} is called again with the
+ * {@code "insertProvider."+provider.getName()} permission target name. If
+ * both checks are denied, a {@code SecurityException} is thrown.
*
* @param provider the provider to be added.
*
@@ -360,7 +356,7 @@
public static synchronized int insertProviderAt(Provider provider,
int position) {
String providerName = provider.getName();
- check("insertProvider." + providerName);
+ checkInsertProvider(providerName);
ProviderList list = Providers.getFullProviderList();
ProviderList newList = ProviderList.insertAt(list, provider, position - 1);
if (list == newList) {
@@ -373,17 +369,13 @@
/**
* Adds a provider to the next position available.
*
- *
First, if there is a security manager, its
- * {@code checkSecurityAccess}
- * method is called with the string
- * {@code "insertProvider."+provider.getName()}
- * to see if it's ok to add a new provider.
- * If the default implementation of {@code checkSecurityAccess}
- * is used (i.e., that method is not overriden), then this will result in
- * a call to the security manager's {@code checkPermission} method
- * with a
- * {@code SecurityPermission("insertProvider."+provider.getName())}
- * permission.
+ *
If there is a security manager, the
+ * {@link java.lang.SecurityManager#checkSecurityAccess} method is called
+ * with the {@code "insertProvider"} permission target name to see if
+ * it's ok to add a new provider. If this permission check is denied,
+ * {@code checkSecurityAccess} is called again with the
+ * {@code "insertProvider."+provider.getName()} permission target name. If
+ * both checks are denied, a {@code SecurityException} is thrown.
*
* @param provider the provider to be added.
*
@@ -863,6 +855,23 @@
}
}
+ private static void checkInsertProvider(String name) {
+ SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ try {
+ security.checkSecurityAccess("insertProvider");
+ } catch (SecurityException se1) {
+ try {
+ security.checkSecurityAccess("insertProvider." + name);
+ } catch (SecurityException se2) {
+ // throw first exception, but add second to suppressed
+ se1.addSuppressed(se2);
+ throw se1;
+ }
+ }
+ }
+ }
+
/*
* Returns all providers who satisfy the specified
* criterion.
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/security/SecurityPermission.java
--- a/jdk/src/share/classes/java/security/SecurityPermission.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/security/SecurityPermission.java Tue Aug 13 15:49:37 2013 -0700
@@ -130,14 +130,17 @@
*
*
*
- * insertProvider.{provider name} |
- * Addition of a new provider, with the specified name |
+ * insertProvider |
+ * Addition of a new provider |
* This would allow somebody to introduce a possibly
* malicious provider (e.g., one that discloses the private keys passed
* to it) as the highest-priority provider. This would be possible
* because the Security object (which manages the installed providers)
* currently does not check the integrity or authenticity of a provider
- * before attaching it. |
+ * before attaching it. The "insertProvider" permission subsumes the
+ * "insertProvider.{provider name}" permission (see the section below for
+ * more information).
+ *
*
*
*
@@ -186,9 +189,10 @@
*
*
*
- * The following permissions are associated with classes that have been
- * deprecated: {@link Identity}, {@link IdentityScope}, {@link Signer}. Use of
- * them is discouraged. See the applicable classes for more information.
+ * The following permissions have been superseded by newer permissions or are
+ * associated with classes that have been deprecated: {@link Identity},
+ * {@link IdentityScope}, {@link Signer}. Use of them is discouraged. See the
+ * applicable classes for more information.
*
*
*
@@ -199,6 +203,23 @@
*
*
*
+ * insertProvider.{provider name} |
+ * Addition of a new provider, with the specified name |
+ * Use of this permission is discouraged from further use because it is
+ * possible to circumvent the name restrictions by overriding the
+ * {@link java.security.Provider#getName} method. Also, there is an equivalent
+ * level of risk associated with granting code permission to insert a provider
+ * with a specific name, or any name it chooses. Users should use the
+ * "insertProvider" permission instead.
+ * This would allow somebody to introduce a possibly
+ * malicious provider (e.g., one that discloses the private keys passed
+ * to it) as the highest-priority provider. This would be possible
+ * because the Security object (which manages the installed providers)
+ * currently does not check the integrity or authenticity of a provider
+ * before attaching it. |
+ *
+ *
+ *
* setSystemScope |
* Setting of the system identity scope |
* This would allow an attacker to configure the system identity scope with
@@ -306,7 +327,6 @@
* @throws NullPointerException if {@code name} is {@code null}.
* @throws IllegalArgumentException if {@code name} is empty.
*/
-
public SecurityPermission(String name)
{
super(name);
@@ -323,7 +343,6 @@
* @throws NullPointerException if {@code name} is {@code null}.
* @throws IllegalArgumentException if {@code name} is empty.
*/
-
public SecurityPermission(String name, String actions)
{
super(name, actions);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/ArrayPrefixHelpers.java
--- a/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java Tue Aug 13 15:49:37 2013 -0700
@@ -128,6 +128,7 @@
this.lo = lo; this.hi = hi;
}
+ @SuppressWarnings("unchecked")
public final void compute() {
final BinaryOperator fn;
final T[] a;
@@ -692,6 +693,4 @@
}
}
}
-
-
-}
\ No newline at end of file
+}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Collections.java
--- a/jdk/src/share/classes/java/util/Collections.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Collections.java Tue Aug 13 15:49:37 2013 -0700
@@ -1143,6 +1143,7 @@
public boolean removeIf(Predicate super E> filter) {
throw new UnsupportedOperationException();
}
+ @SuppressWarnings("unchecked")
@Override
public Spliterator spliterator() {
return (Spliterator)c.spliterator();
@@ -1900,7 +1901,7 @@
private static final long serialVersionUID = -2239321462712562324L;
- EmptyNavigableMap() { super(new TreeMap()); }
+ EmptyNavigableMap() { super(new TreeMap()); }
@Override
public NavigableSet navigableKeySet()
@@ -1928,46 +1929,52 @@
public K ceilingKey(K key) { return nm.ceilingKey(key); }
public K higherKey(K key) { return nm.higherKey(key); }
+ @SuppressWarnings("unchecked")
public Entry lowerEntry(K key) {
Entry lower = (Entry) nm.lowerEntry(key);
return (null != lower)
- ? new UnmodifiableEntrySet.UnmodifiableEntry(lower)
+ ? new UnmodifiableEntrySet.UnmodifiableEntry<>(lower)
: null;
}
+ @SuppressWarnings("unchecked")
public Entry floorEntry(K key) {
Entry floor = (Entry) nm.floorEntry(key);
return (null != floor)
- ? new UnmodifiableEntrySet.UnmodifiableEntry(floor)
+ ? new UnmodifiableEntrySet.UnmodifiableEntry<>(floor)
: null;
}
+ @SuppressWarnings("unchecked")
public Entry ceilingEntry(K key) {
Entry ceiling = (Entry) nm.ceilingEntry(key);
return (null != ceiling)
- ? new UnmodifiableEntrySet.UnmodifiableEntry(ceiling)
+ ? new UnmodifiableEntrySet.UnmodifiableEntry<>(ceiling)
: null;
}
+ @SuppressWarnings("unchecked")
public Entry higherEntry(K key) {
Entry higher = (Entry) nm.higherEntry(key);
return (null != higher)
- ? new UnmodifiableEntrySet.UnmodifiableEntry(higher)
+ ? new UnmodifiableEntrySet.UnmodifiableEntry<>(higher)
: null;
}
+ @SuppressWarnings("unchecked")
public Entry firstEntry() {
Entry first = (Entry) nm.firstEntry();
return (null != first)
- ? new UnmodifiableEntrySet.UnmodifiableEntry(first)
+ ? new UnmodifiableEntrySet.UnmodifiableEntry<>(first)
: null;
}
+ @SuppressWarnings("unchecked")
public Entry lastEntry() {
Entry last = (Entry) nm.lastEntry();
return (null != last)
- ? new UnmodifiableEntrySet.UnmodifiableEntry(last)
+ ? new UnmodifiableEntrySet.UnmodifiableEntry<>(last)
: null;
}
@@ -2360,7 +2367,7 @@
}
public NavigableSet tailSet(E fromElement) {
synchronized (mutex) {
- return new SynchronizedNavigableSet(ns.tailSet(fromElement, true), mutex);
+ return new SynchronizedNavigableSet<>(ns.tailSet(fromElement, true), mutex);
}
}
@@ -2925,7 +2932,7 @@
public NavigableMap descendingMap() {
synchronized (mutex) {
return
- new SynchronizedNavigableMap(nm.descendingMap(), mutex);
+ new SynchronizedNavigableMap<>(nm.descendingMap(), mutex);
}
}
@@ -2935,13 +2942,13 @@
public NavigableSet navigableKeySet() {
synchronized (mutex) {
- return new SynchronizedNavigableSet(nm.navigableKeySet(), mutex);
+ return new SynchronizedNavigableSet<>(nm.navigableKeySet(), mutex);
}
}
public NavigableSet descendingKeySet() {
synchronized (mutex) {
- return new SynchronizedNavigableSet(nm.descendingKeySet(), mutex);
+ return new SynchronizedNavigableSet<>(nm.descendingKeySet(), mutex);
}
}
@@ -2959,27 +2966,27 @@
}
public SortedMap tailMap(K fromKey) {
synchronized (mutex) {
- return new SynchronizedNavigableMap<>(nm.tailMap(fromKey, true),mutex);
+ return new SynchronizedNavigableMap<>(nm.tailMap(fromKey, true),mutex);
}
}
public NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) {
synchronized (mutex) {
- return new SynchronizedNavigableMap(
+ return new SynchronizedNavigableMap<>(
nm.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex);
}
}
public NavigableMap headMap(K toKey, boolean inclusive) {
synchronized (mutex) {
- return new SynchronizedNavigableMap(
+ return new SynchronizedNavigableMap<>(
nm.headMap(toKey, inclusive), mutex);
}
}
public NavigableMap tailMap(K fromKey, boolean inclusive) {
synchronized (mutex) {
- return new SynchronizedNavigableMap(
+ return new SynchronizedNavigableMap<>(
nm.tailMap(fromKey, inclusive), mutex);
}
}
@@ -4081,7 +4088,7 @@
public Entry lowerEntry(K key) {
Entry lower = nm.lowerEntry(key);
return (null != lower)
- ? new CheckedMap.CheckedEntrySet.CheckedEntry(lower, valueType)
+ ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(lower, valueType)
: null;
}
@@ -4090,7 +4097,7 @@
public Entry floorEntry(K key) {
Entry floor = nm.floorEntry(key);
return (null != floor)
- ? new CheckedMap.CheckedEntrySet.CheckedEntry(floor, valueType)
+ ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(floor, valueType)
: null;
}
@@ -4099,7 +4106,7 @@
public Entry ceilingEntry(K key) {
Entry ceiling = nm.ceilingEntry(key);
return (null != ceiling)
- ? new CheckedMap.CheckedEntrySet.CheckedEntry(ceiling, valueType)
+ ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(ceiling, valueType)
: null;
}
@@ -4108,7 +4115,7 @@
public Entry higherEntry(K key) {
Entry higher = nm.higherEntry(key);
return (null != higher)
- ? new CheckedMap.CheckedEntrySet.CheckedEntry(higher, valueType)
+ ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(higher, valueType)
: null;
}
@@ -4117,14 +4124,14 @@
public Entry firstEntry() {
Entry first = nm.firstEntry();
return (null != first)
- ? new CheckedMap.CheckedEntrySet.CheckedEntry(first, valueType)
+ ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(first, valueType)
: null;
}
public Entry lastEntry() {
Entry last = nm.lastEntry();
return (null != last)
- ? new CheckedMap.CheckedEntrySet.CheckedEntry(last, valueType)
+ ? new CheckedMap.CheckedEntrySet.CheckedEntry<>(last, valueType)
: null;
}
@@ -4132,14 +4139,14 @@
Entry entry = nm.pollFirstEntry();
return (null == entry)
? null
- : new CheckedMap.CheckedEntrySet.CheckedEntry(entry, valueType);
+ : new CheckedMap.CheckedEntrySet.CheckedEntry<>(entry, valueType);
}
public Entry pollLastEntry() {
Entry entry = nm.pollLastEntry();
return (null == entry)
? null
- : new CheckedMap.CheckedEntrySet.CheckedEntry(entry, valueType);
+ : new CheckedMap.CheckedEntrySet.CheckedEntry<>(entry, valueType);
}
public NavigableMap descendingMap() {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Comparator.java
--- a/jdk/src/share/classes/java/util/Comparator.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Comparator.java Tue Aug 13 15:49:37 2013 -0700
@@ -352,6 +352,7 @@
* @see Comparable
* @since 1.8
*/
+ @SuppressWarnings("unchecked")
public static > Comparator naturalOrder() {
return (Comparator) Comparators.NaturalOrderComparator.INSTANCE;
}
@@ -374,7 +375,7 @@
* @since 1.8
*/
public static Comparator nullsFirst(Comparator super T> comparator) {
- return new Comparators.NullComparator(true, comparator);
+ return new Comparators.NullComparator<>(true, comparator);
}
/**
@@ -395,7 +396,7 @@
* @since 1.8
*/
public static Comparator nullsLast(Comparator super T> comparator) {
- return new Comparators.NullComparator(false, comparator);
+ return new Comparators.NullComparator<>(false, comparator);
}
/**
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Comparators.java
--- a/jdk/src/share/classes/java/util/Comparators.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Comparators.java Tue Aug 13 15:49:37 2013 -0700
@@ -87,12 +87,12 @@
@Override
public Comparator thenComparing(Comparator super T> other) {
Objects.requireNonNull(other);
- return new NullComparator(nullFirst, real == null ? other : real.thenComparing(other));
+ return new NullComparator<>(nullFirst, real == null ? other : real.thenComparing(other));
}
@Override
public Comparator reversed() {
- return new NullComparator(!nullFirst, real == null ? null : real.reversed());
+ return new NullComparator<>(!nullFirst, real == null ? null : real.reversed());
}
}
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Deque.java
--- a/jdk/src/share/classes/java/util/Deque.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Deque.java Tue Aug 13 15:49:37 2013 -0700
@@ -38,7 +38,7 @@
/**
* A linear collection that supports element insertion and removal at
* both ends. The name deque is short for "double ended queue"
- * and is usually pronounced "deck". Most Deque
+ * and is usually pronounced "deck". Most {@code Deque}
* implementations place no fixed limits on the number of elements
* they may contain, but this interface supports capacity-restricted
* deques as well as those with no fixed size limit.
@@ -47,10 +47,10 @@
* ends of the deque. Methods are provided to insert, remove, and
* examine the element. Each of these methods exists in two forms:
* one throws an exception if the operation fails, the other returns a
- * special value (either null or false, depending on
+ * special value (either {@code null} or {@code false}, depending on
* the operation). The latter form of the insert operation is
* designed specifically for use with capacity-restricted
- * Deque implementations; in most implementations, insert
+ * {@code Deque} implementations; in most implementations, insert
* operations cannot fail.
*
* The twelve methods described above are summarized in the
@@ -58,6 +58,7 @@
*
*
*
+ * Summary of Deque methods
*
* |
* First Element (Head) |
@@ -72,38 +73,39 @@
*
*
* Insert |
- * {@link #addFirst addFirst(e)} |
- * {@link #offerFirst offerFirst(e)} |
- * {@link #addLast addLast(e)} |
- * {@link #offerLast offerLast(e)} |
+ * {@link Deque#addFirst addFirst(e)} |
+ * {@link Deque#offerFirst offerFirst(e)} |
+ * {@link Deque#addLast addLast(e)} |
+ * {@link Deque#offerLast offerLast(e)} |
*
*
* Remove |
- * {@link #removeFirst removeFirst()} |
- * {@link #pollFirst pollFirst()} |
- * {@link #removeLast removeLast()} |
- * {@link #pollLast pollLast()} |
+ * {@link Deque#removeFirst removeFirst()} |
+ * {@link Deque#pollFirst pollFirst()} |
+ * {@link Deque#removeLast removeLast()} |
+ * {@link Deque#pollLast pollLast()} |
*
*
* Examine |
- * {@link #getFirst getFirst()} |
- * {@link #peekFirst peekFirst()} |
- * {@link #getLast getLast()} |
- * {@link #peekLast peekLast()} |
+ * {@link Deque#getFirst getFirst()} |
+ * {@link Deque#peekFirst peekFirst()} |
+ * {@link Deque#getLast getLast()} |
+ * {@link Deque#peekLast peekLast()} |
*
*
*
* This interface extends the {@link Queue} interface. When a deque is
* used as a queue, FIFO (First-In-First-Out) behavior results. Elements are
* added at the end of the deque and removed from the beginning. The methods
- * inherited from the Queue interface are precisely equivalent to
- * Deque methods as indicated in the following table:
+ * inherited from the {@code Queue} interface are precisely equivalent to
+ * {@code Deque} methods as indicated in the following table:
*
*
*
+ * Comparison of Queue and Deque methods
*
- * Queue Method |
- * Equivalent Deque Method |
+ * {@code Queue} Method |
+ * Equivalent {@code Deque} Method |
*
*
* {@link java.util.Queue#add add(e)} |
@@ -135,13 +137,14 @@
* interface should be used in preference to the legacy {@link Stack} class.
* When a deque is used as a stack, elements are pushed and popped from the
* beginning of the deque. Stack methods are precisely equivalent to
- * Deque methods as indicated in the table below:
+ * {@code Deque} methods as indicated in the table below:
*
*
*
+ * Comparison of Stack and Deque methods
*
* Stack Method |
- * Equivalent Deque Method |
+ * Equivalent {@code Deque} Method |
*
*
* {@link #push push(e)} |
@@ -168,18 +171,18 @@
* Unlike the {@link List} interface, this interface does not
* provide support for indexed access to elements.
*
- * While Deque implementations are not strictly required
+ * While {@code Deque} implementations are not strictly required
* to prohibit the insertion of null elements, they are strongly
- * encouraged to do so. Users of any Deque implementations
+ * encouraged to do so. Users of any {@code Deque} implementations
* that do allow null elements are strongly encouraged not to
* take advantage of the ability to insert nulls. This is so because
- * null is used as a special return value by various methods
+ * {@code null} is used as a special return value by various methods
* to indicated that the deque is empty.
*
- * Deque implementations generally do not define
- * element-based versions of the equals and hashCode
+ * {@code Deque} implementations generally do not define
+ * element-based versions of the {@code equals} and {@code hashCode}
* methods, but instead inherit the identity-based versions from class
- * Object.
+ * {@code Object}.
*
* This interface is a member of the Java Collections
@@ -190,13 +193,13 @@
* @since 1.6
* @param the type of elements held in this collection
*/
-
public interface Deque extends Queue {
/**
* Inserts the specified element at the front of this deque if it is
- * possible to do so immediately without violating capacity restrictions.
- * When using a capacity-restricted deque, it is generally preferable to
- * use method {@link #offerFirst}.
+ * possible to do so immediately without violating capacity restrictions,
+ * throwing an {@code IllegalStateException} if no space is currently
+ * available. When using a capacity-restricted deque, it is generally
+ * preferable to use method {@link #offerFirst}.
*
* @param e the element to add
* @throws IllegalStateException if the element cannot be added at this
@@ -212,9 +215,10 @@
/**
* Inserts the specified element at the end of this deque if it is
- * possible to do so immediately without violating capacity restrictions.
- * When using a capacity-restricted deque, it is generally preferable to
- * use method {@link #offerLast}.
+ * possible to do so immediately without violating capacity restrictions,
+ * throwing an {@code IllegalStateException} if no space is currently
+ * available. When using a capacity-restricted deque, it is generally
+ * preferable to use method {@link #offerLast}.
*
* This method is equivalent to {@link #add}.
*
@@ -237,8 +241,8 @@
* which can fail to insert an element only by throwing an exception.
*
* @param e the element to add
- * @return true if the element was added to this deque, else
- * false
+ * @return {@code true} if the element was added to this deque, else
+ * {@code false}
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this deque
* @throws NullPointerException if the specified element is null and this
@@ -255,8 +259,8 @@
* which can fail to insert an element only by throwing an exception.
*
* @param e the element to add
- * @return true if the element was added to this deque, else
- * false
+ * @return {@code true} if the element was added to this deque, else
+ * {@code false}
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this deque
* @throws NullPointerException if the specified element is null and this
@@ -288,17 +292,17 @@
/**
* Retrieves and removes the first element of this deque,
- * or returns null if this deque is empty.
+ * or returns {@code null} if this deque is empty.
*
- * @return the head of this deque, or null if this deque is empty
+ * @return the head of this deque, or {@code null} if this deque is empty
*/
E pollFirst();
/**
* Retrieves and removes the last element of this deque,
- * or returns null if this deque is empty.
+ * or returns {@code null} if this deque is empty.
*
- * @return the tail of this deque, or null if this deque is empty
+ * @return the tail of this deque, or {@code null} if this deque is empty
*/
E pollLast();
@@ -325,31 +329,31 @@
/**
* Retrieves, but does not remove, the first element of this deque,
- * or returns null if this deque is empty.
+ * or returns {@code null} if this deque is empty.
*
- * @return the head of this deque, or null if this deque is empty
+ * @return the head of this deque, or {@code null} if this deque is empty
*/
E peekFirst();
/**
* Retrieves, but does not remove, the last element of this deque,
- * or returns null if this deque is empty.
+ * or returns {@code null} if this deque is empty.
*
- * @return the tail of this deque, or null if this deque is empty
+ * @return the tail of this deque, or {@code null} if this deque is empty
*/
E peekLast();
/**
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
- * More formally, removes the first element e such that
+ * More formally, removes the first element {@code e} such that
* (o==null ? e==null : o.equals(e))
* (if such an element exists).
- * Returns true if this deque contained the specified element
+ * Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
- * @return true if an element was removed as a result of this call
+ * @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (optional)
@@ -362,14 +366,14 @@
/**
* Removes the last occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
- * More formally, removes the last element e such that
+ * More formally, removes the last element {@code e} such that
* (o==null ? e==null : o.equals(e))
* (if such an element exists).
- * Returns true if this deque contained the specified element
+ * Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
* @param o element to be removed from this deque, if present
- * @return true if an element was removed as a result of this call
+ * @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (optional)
@@ -385,15 +389,15 @@
* Inserts the specified element into the queue represented by this deque
* (in other words, at the tail of this deque) if it is possible to do so
* immediately without violating capacity restrictions, returning
- * true upon success and throwing an
- * IllegalStateException if no space is currently available.
+ * {@code true} upon success and throwing an
+ * {@code IllegalStateException} if no space is currently available.
* When using a capacity-restricted deque, it is generally preferable to
* use {@link #offer(Object) offer}.
*
* This method is equivalent to {@link #addLast}.
*
* @param e the element to add
- * @return true (as specified by {@link Collection#add})
+ * @return {@code true} (as specified by {@link Collection#add})
* @throws IllegalStateException if the element cannot be added at this
* time due to capacity restrictions
* @throws ClassCastException if the class of the specified element
@@ -409,7 +413,7 @@
* Inserts the specified element into the queue represented by this deque
* (in other words, at the tail of this deque) if it is possible to do so
* immediately without violating capacity restrictions, returning
- * true upon success and false if no space is currently
+ * {@code true} upon success and {@code false} if no space is currently
* available. When using a capacity-restricted deque, this method is
* generally preferable to the {@link #add} method, which can fail to
* insert an element only by throwing an exception.
@@ -417,8 +421,8 @@
* This method is equivalent to {@link #offerLast}.
*
* @param e the element to add
- * @return true if the element was added to this deque, else
- * false
+ * @return {@code true} if the element was added to this deque, else
+ * {@code false}
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this deque
* @throws NullPointerException if the specified element is null and this
@@ -444,11 +448,11 @@
/**
* Retrieves and removes the head of the queue represented by this deque
* (in other words, the first element of this deque), or returns
- * null if this deque is empty.
+ * {@code null} if this deque is empty.
*
* This method is equivalent to {@link #pollFirst()}.
*
- * @return the first element of this deque, or null if
+ * @return the first element of this deque, or {@code null} if
* this deque is empty
*/
E poll();
@@ -469,12 +473,12 @@
/**
* Retrieves, but does not remove, the head of the queue represented by
* this deque (in other words, the first element of this deque), or
- * returns null if this deque is empty.
+ * returns {@code null} if this deque is empty.
*
* This method is equivalent to {@link #peekFirst()}.
*
* @return the head of the queue represented by this deque, or
- * null if this deque is empty
+ * {@code null} if this deque is empty
*/
E peek();
@@ -484,9 +488,8 @@
/**
* Pushes an element onto the stack represented by this deque (in other
* words, at the head of this deque) if it is possible to do so
- * immediately without violating capacity restrictions, returning
- * true upon success and throwing an
- * IllegalStateException if no space is currently available.
+ * immediately without violating capacity restrictions, throwing an
+ * {@code IllegalStateException} if no space is currently available.
*
* This method is equivalent to {@link #addFirst}.
*
@@ -520,16 +523,16 @@
/**
* Removes the first occurrence of the specified element from this deque.
* If the deque does not contain the element, it is unchanged.
- * More formally, removes the first element e such that
+ * More formally, removes the first element {@code e} such that
* (o==null ? e==null : o.equals(e))
* (if such an element exists).
- * Returns true if this deque contained the specified element
+ * Returns {@code true} if this deque contained the specified element
* (or equivalently, if this deque changed as a result of the call).
*
- * This method is equivalent to {@link #removeFirstOccurrence}.
+ * This method is equivalent to {@link #removeFirstOccurrence(Object)}.
*
* @param o element to be removed from this deque, if present
- * @return true if an element was removed as a result of this call
+ * @return {@code true} if an element was removed as a result of this call
* @throws ClassCastException if the class of the specified element
* is incompatible with this deque
* (optional)
@@ -540,13 +543,13 @@
boolean remove(Object o);
/**
- * Returns true if this deque contains the specified element.
- * More formally, returns true if and only if this deque contains
- * at least one element e such that
+ * Returns {@code true} if this deque contains the specified element.
+ * More formally, returns {@code true} if and only if this deque contains
+ * at least one element {@code e} such that
* (o==null ? e==null : o.equals(e)).
*
* @param o element whose presence in this deque is to be tested
- * @return true if this deque contains the specified element
+ * @return {@code true} if this deque contains the specified element
* @throws ClassCastException if the type of the specified element
* is incompatible with this deque
* (optional)
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/DoubleSummaryStatistics.java
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java Tue Aug 13 15:49:37 2013 -0700
@@ -25,6 +25,7 @@
package java.util;
import java.util.function.DoubleConsumer;
+import java.util.stream.Collector;
/**
* A state object for collecting statistics such as count, min, max, sum, and
@@ -35,24 +36,24 @@
* summary statistics on a stream of doubles with:
* {@code
* DoubleSummaryStatistics stats = doubleStream.collect(DoubleSummaryStatistics::new,
- * DoubleSummaryStatistics::accept,
- * DoubleSummaryStatistics::combine);
+ * DoubleSummaryStatistics::accept,
+ * DoubleSummaryStatistics::combine);
* }
*
* {@code DoubleSummaryStatistics} can be used as a
- * {@linkplain java.util.stream.Stream#reduce(java.util.function.BinaryOperator) reduction}
+ * {@linkplain java.util.stream.Stream#collect(Collector) reduction}
* target for a {@linkplain java.util.stream.Stream stream}. For example:
*
* {@code
* DoubleSummaryStatistics stats = people.stream()
- * .collect(Collectors.toDoubleSummaryStatistics(Person::getWeight));
+ * .collect(Collectors.summarizingDouble(Person::getWeight));
*}
*
* This computes, in a single pass, the count of people, as well as the minimum,
* maximum, sum, and average of their weights.
*
* @implNote This implementation is not thread safe. However, it is safe to use
- * {@link java.util.stream.Collectors#toDoubleSummaryStatistics(java.util.function.ToDoubleFunction)
+ * {@link java.util.stream.Collectors#summarizingDouble(java.util.function.ToDoubleFunction)
* Collectors.toDoubleStatistics()} on a parallel stream, because the parallel
* implementation of {@link java.util.stream.Stream#collect Stream.collect()}
* provides the necessary partitioning, isolation, and merging of results for
@@ -152,7 +153,7 @@
}
/**
- * Returns the average of values recorded, or zero if no values have been
+ * Returns the arithmetic mean of values recorded, or zero if no values have been
* recorded. The average returned can vary depending upon the order in
* which values are recorded. This is due to accumulated rounding error in
* addition of values of differing magnitudes. Values sorted by increasing
@@ -160,7 +161,7 @@
* value is a {@code NaN} or the sum is at any point a {@code NaN} then the
* average will be {@code NaN}.
*
- * @return the average of values, or zero if none
+ * @return the arithmetic mean of values, or zero if none
*/
public final double getAverage() {
return getCount() > 0 ? getSum() / getCount() : 0.0d;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Formatter.java
--- a/jdk/src/share/classes/java/util/Formatter.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Formatter.java Tue Aug 13 15:49:37 2013 -0700
@@ -626,12 +626,11 @@
* For general argument types, the precision is the maximum number of
* characters to be written to the output.
*
- * For the floating-point conversions {@code 'e'}, {@code 'E'}, and
- * {@code 'f'} the precision is the number of digits after the decimal
- * separator. If the conversion is {@code 'g'} or {@code 'G'}, then the
+ * For the floating-point conversions {@code 'a'}, {@code 'A'}, {@code 'e'},
+ * {@code 'E'}, and {@code 'f'} the precision is the number of digits after the
+ * radix point. If the conversion is {@code 'g'} or {@code 'G'}, then the
* precision is the total number of digits in the resulting magnitude after
- * rounding. If the conversion is {@code 'a'} or {@code 'A'}, then the
- * precision must not be specified.
+ * rounding.
*
* For character, integral, and date/time argument types and the percent
* and line separator conversions, the precision is not applicable; if a
@@ -1297,14 +1296,21 @@
* of the significand as a fraction. The exponent is represented by
* {@code 'p'} ('\u0070') followed by a decimal string of the
* unbiased exponent as if produced by invoking {@link
- * Integer#toString(int) Integer.toString} on the exponent value.
+ * Integer#toString(int) Integer.toString} on the exponent value. If the
+ * precision is specified, the value is rounded to the given number of
+ * hexadecimal digits.
*
* If m is a {@code double} value with a subnormal
- * representation then the significand is represented by the characters
- * {@code '0x0.'} followed by the hexadecimal representation of the rest
- * of the significand as a fraction. The exponent is represented by
- * {@code 'p-1022'}. Note that there must be at least one nonzero digit
- * in a subnormal significand.
+ * representation then, unless the precision is specified to be in the range
+ * 1 through 12, inclusive, the significand is represented by the characters
+ * {@code '0x0.'} followed by the hexadecimal representation of the rest of
+ * the significand as a fraction, and the exponent represented by
+ * {@code 'p-1022'}. If the precision is in the interval
+ * [1, 12], the subnormal value is normalized such that it
+ * begins with the characters {@code '0x1.'}, rounded to the number of
+ * hexadecimal digits of precision, and the exponent adjusted
+ * accordingly. Note that there must be at least one nonzero digit in a
+ * subnormal significand.
*
*
*
@@ -1367,7 +1373,7 @@
* {@code 1}.
*
* If the conversion is {@code 'a'} or {@code 'A'}, then the precision
- * is the number of hexadecimal digits after the decimal separator. If the
+ * is the number of hexadecimal digits after the radix point. If the
* precision is not provided, then all of the digits as returned by {@link
* Double#toHexString(double)} will be output.
*
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/HashMap.java
--- a/jdk/src/share/classes/java/util/HashMap.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/HashMap.java Tue Aug 13 15:49:37 2013 -0700
@@ -876,13 +876,9 @@
private static int roundUpToPowerOf2(int number) {
// assert number >= 0 : "number must be non-negative";
- int rounded = number >= MAXIMUM_CAPACITY
+ return number >= MAXIMUM_CAPACITY
? MAXIMUM_CAPACITY
- : (rounded = Integer.highestOneBit(number)) != 0
- ? (Integer.bitCount(number) > 1) ? rounded << 1 : rounded
- : 1;
-
- return rounded;
+ : (number > 1) ? Integer.highestOneBit((number - 1) << 1) : 1;
}
/**
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Hashtable.java
--- a/jdk/src/share/classes/java/util/Hashtable.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Hashtable.java Tue Aug 13 15:49:37 2013 -0700
@@ -928,6 +928,7 @@
return (null == result) ? defaultValue : result;
}
+ @SuppressWarnings("unchecked")
@Override
public synchronized void forEach(BiConsumer super K, ? super V> action) {
Objects.requireNonNull(action); // explicit check required in case
@@ -947,6 +948,7 @@
}
}
+ @SuppressWarnings("unchecked")
@Override
public synchronized void replaceAll(BiFunction super K, ? super V, ? extends V> function) {
Objects.requireNonNull(function); // explicit check required in case
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/IdentityHashMap.java
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java Tue Aug 13 15:49:37 2013 -0700
@@ -1339,6 +1339,7 @@
tab[i + 1] = value;
}
+ @SuppressWarnings("unchecked")
@Override
public void forEach(BiConsumer super K, ? super V> action) {
Objects.requireNonNull(action);
@@ -1357,6 +1358,7 @@
}
}
+ @SuppressWarnings("unchecked")
@Override
public void replaceAll(BiFunction super K, ? super V, ? extends V> function) {
Objects.requireNonNull(function);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/IntSummaryStatistics.java
--- a/jdk/src/share/classes/java/util/IntSummaryStatistics.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/IntSummaryStatistics.java Tue Aug 13 15:49:37 2013 -0700
@@ -25,6 +25,7 @@
package java.util;
import java.util.function.IntConsumer;
+import java.util.stream.Collector;
/**
* A state object for collecting statistics such as count, min, max, sum, and
@@ -35,24 +36,24 @@
* summary statistics on a stream of ints with:
* {@code
* IntSummaryStatistics stats = intStream.collect(IntSummaryStatistics::new,
- * IntSummaryStatistics::accept,
- * IntSummaryStatistics::combine);
+ * IntSummaryStatistics::accept,
+ * IntSummaryStatistics::combine);
* }
*
* {@code IntSummaryStatistics} can be used as a
- * {@linkplain java.util.stream.Stream#reduce(java.util.function.BinaryOperator) reduction}
+ * {@linkplain java.util.stream.Stream#collect(Collector) reduction}
* target for a {@linkplain java.util.stream.Stream stream}. For example:
*
* {@code
* IntSummaryStatistics stats = people.stream()
- * .collect(Collectors.toIntSummaryStatistics(Person::getDependents));
+ * .collect(Collectors.summarizingInt(Person::getDependents));
*}
*
* This computes, in a single pass, the count of people, as well as the minimum,
* maximum, sum, and average of their number of dependents.
*
* @implNote This implementation is not thread safe. However, it is safe to use
- * {@link java.util.stream.Collectors#toIntSummaryStatistics(java.util.function.ToIntFunction)
+ * {@link java.util.stream.Collectors#summarizingInt(java.util.function.ToIntFunction)
* Collectors.toIntStatistics()} on a parallel stream, because the parallel
* implementation of {@link java.util.stream.Stream#collect Stream.collect()}
* provides the necessary partitioning, isolation, and merging of results for
@@ -140,10 +141,10 @@
}
/**
- * Returns the average of values recorded, or zero if no values have been
+ * Returns the arithmetic mean of values recorded, or zero if no values have been
* recorded.
*
- * @return the average of values, or zero if none
+ * @return the arithmetic mean of values, or zero if none
*/
public final double getAverage() {
return getCount() > 0 ? (double) getSum() / getCount() : 0.0d;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/LongSummaryStatistics.java
--- a/jdk/src/share/classes/java/util/LongSummaryStatistics.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/LongSummaryStatistics.java Tue Aug 13 15:49:37 2013 -0700
@@ -26,6 +26,7 @@
import java.util.function.IntConsumer;
import java.util.function.LongConsumer;
+import java.util.stream.Collector;
/**
* A state object for collecting statistics such as count, min, max, sum, and
@@ -36,24 +37,24 @@
* summary statistics on a stream of longs with:
* {@code
* LongSummaryStatistics stats = longStream.collect(LongSummaryStatistics::new,
- * LongSummaryStatistics::accept,
- * LongSummaryStatistics::combine);
+ * LongSummaryStatistics::accept,
+ * LongSummaryStatistics::combine);
* }
*
* {@code LongSummaryStatistics} can be used as a
- * {@linkplain java.util.stream.Stream#reduce(java.util.function.BinaryOperator) reduction}
+ * {@linkplain java.util.stream.Stream#collect(Collector)} reduction}
* target for a {@linkplain java.util.stream.Stream stream}. For example:
*
* {@code
* LongSummaryStatistics stats = people.stream()
- * .collect(Collectors.toLongSummaryStatistics(Person::getAge));
+ * .collect(Collectors.summarizingLong(Person::getAge));
*}
*
* This computes, in a single pass, the count of people, as well as the minimum,
- * maximum, sum, and average of their ages in milliseconds.
+ * maximum, sum, and average of their ages.
*
* @implNote This implementation is not thread safe. However, it is safe to use
- * {@link java.util.stream.Collectors#toLongSummaryStatistics(java.util.function.ToLongFunction)
+ * {@link java.util.stream.Collectors#summarizingLong(java.util.function.ToLongFunction)
* Collectors.toLongStatistics()} on a parallel stream, because the parallel
* implementation of {@link java.util.stream.Stream#collect Stream.collect()}
* provides the necessary partitioning, isolation, and merging of results for
@@ -152,10 +153,10 @@
}
/**
- * Returns the average of values recorded, or zero if no values have been
+ * Returns the arithmetic mean of values recorded, or zero if no values have been
* recorded.
*
- * @return The average of values, or zero if none
+ * @return The arithmetic mean of values, or zero if none
*/
public final double getAverage() {
return getCount() > 0 ? (double) getSum() / getCount() : 0.0d;
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Optional.java
--- a/jdk/src/share/classes/java/util/Optional.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Optional.java Tue Aug 13 15:49:37 2013 -0700
@@ -307,7 +307,7 @@
return false;
}
- Optional other = (Optional) obj;
+ Optional> other = (Optional>) obj;
return Objects.equals(value, other.value);
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Queue.java
--- a/jdk/src/share/classes/java/util/Queue.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Queue.java Tue Aug 13 15:49:37 2013 -0700
@@ -41,14 +41,15 @@
* queues provide additional insertion, extraction, and inspection
* operations. Each of these methods exists in two forms: one throws
* an exception if the operation fails, the other returns a special
- * value (either null or false, depending on the
+ * value (either {@code null} or {@code false}, depending on the
* operation). The latter form of the insert operation is designed
- * specifically for use with capacity-restricted Queue
+ * specifically for use with capacity-restricted {@code Queue}
* implementations; in most implementations, insert operations cannot
* fail.
*
*
*
+ * Summary of Queue methods
*
* |
* Throws exception |
@@ -56,18 +57,18 @@
*
*
* Insert |
- * {@link #add add(e)} |
- * {@link #offer offer(e)} |
+ * {@link Queue#add add(e)} |
+ * {@link Queue#offer offer(e)} |
*
*
* Remove |
- * {@link #remove remove()} |
- * {@link #poll poll()} |
+ * {@link Queue#remove remove()} |
+ * {@link Queue#poll poll()} |
*
*
* Examine |
- * {@link #element element()} |
- * {@link #peek peek()} |
+ * {@link Queue#element element()} |
+ * {@link Queue#peek peek()} |
*
*
*
@@ -79,15 +80,15 @@
* Whatever the ordering used, the head of the queue is that
* element which would be removed by a call to {@link #remove() } or
* {@link #poll()}. In a FIFO queue, all new elements are inserted at
- * the tail of the queue. Other kinds of queues may use
- * different placement rules. Every Queue implementation
+ * the tail of the queue. Other kinds of queues may use
+ * different placement rules. Every {@code Queue} implementation
* must specify its ordering properties.
*
* The {@link #offer offer} method inserts an element if possible,
- * otherwise returning false. This differs from the {@link
+ * otherwise returning {@code false}. This differs from the {@link
* java.util.Collection#add Collection.add} method, which can fail to
* add an element only by throwing an unchecked exception. The
- * offer method is designed for use when failure is a normal,
+ * {@code offer} method is designed for use when failure is a normal,
* rather than exceptional occurrence, for example, in fixed-capacity
* (or "bounded") queues.
*
@@ -95,32 +96,32 @@
* return the head of the queue.
* Exactly which element is removed from the queue is a
* function of the queue's ordering policy, which differs from
- * implementation to implementation. The remove() and
- * poll() methods differ only in their behavior when the
- * queue is empty: the remove() method throws an exception,
- * while the poll() method returns null.
+ * implementation to implementation. The {@code remove()} and
+ * {@code poll()} methods differ only in their behavior when the
+ * queue is empty: the {@code remove()} method throws an exception,
+ * while the {@code poll()} method returns {@code null}.
*
* The {@link #element()} and {@link #peek()} methods return, but do
* not remove, the head of the queue.
*
- * The Queue interface does not define the blocking queue
+ * The {@code Queue} interface does not define the blocking queue
* methods, which are common in concurrent programming. These methods,
* which wait for elements to appear or for space to become available, are
* defined in the {@link java.util.concurrent.BlockingQueue} interface, which
* extends this interface.
*
- * Queue implementations generally do not allow insertion
- * of null elements, although some implementations, such as
- * {@link LinkedList}, do not prohibit insertion of null.
- * Even in the implementations that permit it, null should
- * not be inserted into a Queue, as null is also
- * used as a special return value by the poll method to
+ * {@code Queue} implementations generally do not allow insertion
+ * of {@code null} elements, although some implementations, such as
+ * {@link LinkedList}, do not prohibit insertion of {@code null}.
+ * Even in the implementations that permit it, {@code null} should
+ * not be inserted into a {@code Queue}, as {@code null} is also
+ * used as a special return value by the {@code poll} method to
* indicate that the queue contains no elements.
*
- * Queue implementations generally do not define
- * element-based versions of methods equals and
- * hashCode but instead inherit the identity based versions
- * from class Object, because element-based equality is not
+ * {@code Queue} implementations generally do not define
+ * element-based versions of methods {@code equals} and
+ * {@code hashCode} but instead inherit the identity based versions
+ * from class {@code Object}, because element-based equality is not
* always well-defined for queues with the same elements but different
* ordering properties.
*
@@ -145,11 +146,11 @@
/**
* Inserts the specified element into this queue if it is possible to do so
* immediately without violating capacity restrictions, returning
- * true upon success and throwing an IllegalStateException
+ * {@code true} upon success and throwing an {@code IllegalStateException}
* if no space is currently available.
*
* @param e the element to add
- * @return true (as specified by {@link Collection#add})
+ * @return {@code true} (as specified by {@link Collection#add})
* @throws IllegalStateException if the element cannot be added at this
* time due to capacity restrictions
* @throws ClassCastException if the class of the specified element
@@ -169,8 +170,8 @@
* by throwing an exception.
*
* @param e the element to add
- * @return true if the element was added to this queue, else
- * false
+ * @return {@code true} if the element was added to this queue, else
+ * {@code false}
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null and
@@ -192,9 +193,9 @@
/**
* Retrieves and removes the head of this queue,
- * or returns null if this queue is empty.
+ * or returns {@code null} if this queue is empty.
*
- * @return the head of this queue, or null if this queue is empty
+ * @return the head of this queue, or {@code null} if this queue is empty
*/
E poll();
@@ -210,9 +211,9 @@
/**
* Retrieves, but does not remove, the head of this queue,
- * or returns null if this queue is empty.
+ * or returns {@code null} if this queue is empty.
*
- * @return the head of this queue, or null if this queue is empty
+ * @return the head of this queue, or {@code null} if this queue is empty
*/
E peek();
}
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/StringJoiner.java
--- a/jdk/src/share/classes/java/util/StringJoiner.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/StringJoiner.java Tue Aug 13 15:49:37 2013 -0700
@@ -49,16 +49,17 @@
*
* A {@code StringJoiner} may be employed to create formatted output from a
* {@link java.util.stream.Stream} using
- * {@link java.util.stream.Collectors#toStringJoiner}. For example:
+ * {@link java.util.stream.Collectors#joining(CharSequence)}. For example:
*
* {@code
* List numbers = Arrays.asList(1, 2, 3, 4);
* String commaSeparatedNumbers = numbers.stream()
* .map(i -> i.toString())
- * .collect(Collectors.toStringJoiner(", ")).toString();
+ * .collect(Collectors.joining(", "));
* }
*
- * @see java.util.stream.Collectors#toStringJoiner
+ * @see java.util.stream.Collectors#joining(CharSequence)
+ * @see java.util.stream.Collectors#joining(CharSequence, CharSequence, CharSequence)
* @since 1.8
*/
public final class StringJoiner {
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/Vector.java
--- a/jdk/src/share/classes/java/util/Vector.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/Vector.java Tue Aug 13 15:49:37 2013 -0700
@@ -1164,12 +1164,13 @@
if (i >= size) {
return;
}
- final Object[] elementData = Vector.this.elementData;
+ @SuppressWarnings("unchecked")
+ final E[] elementData = (E[]) Vector.this.elementData;
if (i >= elementData.length) {
throw new ConcurrentModificationException();
}
while (i != size && modCount == expectedModCount) {
- action.accept((E) elementData[i++]);
+ action.accept(elementData[i++]);
}
// update once at end of iteration to reduce heap write traffic
cursor = i;
@@ -1311,8 +1312,8 @@
modCount++;
}
+ @SuppressWarnings("unchecked")
@Override
- @SuppressWarnings("unchecked")
public synchronized void sort(Comparator super E> c) {
final int expectedModCount = modCount;
Arrays.sort((E[]) elementData, 0, elementCount, c);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/WeakHashMap.java
--- a/jdk/src/share/classes/java/util/WeakHashMap.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/WeakHashMap.java Tue Aug 13 15:49:37 2013 -0700
@@ -1038,6 +1038,7 @@
}
}
+ @SuppressWarnings("unchecked")
@Override
public void forEach(BiConsumer super K, ? super V> action) {
Objects.requireNonNull(action);
@@ -1059,6 +1060,7 @@
}
}
+ @SuppressWarnings("unchecked")
@Override
public void replaceAll(BiFunction super K, ? super V, ? extends V> function) {
Objects.requireNonNull(function);
diff -r 424d84a2276f -r 9dc631273af7 jdk/src/share/classes/java/util/concurrent/CompletableFuture.java
--- a/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java Tue Aug 13 15:41:55 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/CompletableFuture.java Tue Aug 13 15:49:37 2013 -0700
@@ -48,13 +48,16 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.CancellationException;
+import java.util.concurrent.CompletionException;
+import java.util.concurrent.CompletionStage;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.LockSupport;
/**
* A {@link Future} that may be explicitly completed (setting its
- * value and status), and may include dependent functions and actions
- * that trigger upon its completion.
+ * value and status), and may be used as a {@link CompletionStage},
+ * supporting dependent functions and actions that trigger upon its
+ * completion.
*
* When two or more threads attempt to
* {@link #complete complete},
@@ -62,64 +65,50 @@
* {@link #cancel cancel}
* a CompletableFuture, only one of them succeeds.
*
- * Methods are available for adding dependents based on
- * user-provided Functions, Consumers, or Runnables. The appropriate
- * form to use depends on whether actions require arguments and/or
- * produce results. Completion of a dependent action will trigger the
- * completion of another CompletableFuture. Actions may also be
- * triggered after either or both the current and another
- * CompletableFuture complete. Multiple CompletableFutures may also
- * be grouped as one using {@link #anyOf(CompletableFuture...)} and
- * {@link #allOf(CompletableFuture...)}.
+ * In addition to these and related methods for directly
+ * manipulating status and results, CompletableFuture implements
+ * interface {@link CompletionStage} with the following policies:
*
- * CompletableFutures themselves do not execute asynchronously.
- * However, actions supplied for dependent completions of another
- * CompletableFuture may do so, depending on whether they are provided
- * via one of the async methods (that is, methods with names
- * of the form xxxAsync). The async
- * methods provide a way to commence asynchronous processing of an
- * action using either a given {@link Executor} or by default the
- * {@link ForkJoinPool#commonPool()}. To simplify monitoring,
+ * - Actions supplied for dependent completions of
+ * non-async methods may be performed by the thread that
+ * completes the current CompletableFuture, or by any other caller of
+ * a completion method.
+ *
+ * - All async methods without an explicit Executor
+ * argument are performed using the {@link ForkJoinPool#commonPool()}
+ * (unless it does not support a parallelism level of at least two, in
+ * which case, a new Thread is used). To simplify monitoring,
* debugging, and tracking, all generated asynchronous tasks are
- * instances of the marker interface {@link AsynchronousCompletionTask}.
+ * instances of the marker interface {@link
+ * AsynchronousCompletionTask}.
*
- * Actions supplied for dependent completions of non-async
- * methods may be performed by the thread that completes the current
- * CompletableFuture, or by any other caller of these methods. There
- * are no guarantees about the order of processing completions unless
- * constrained by these methods.
+ * - All CompletionStage methods are implemented independently of
+ * other public methods, so the behavior of one method is not impacted
+ * by overrides of others in subclasses.
*
- * Since (unlike {@link FutureTask}) this class has no direct
- * control over the computation that causes it to be completed,
- * cancellation is treated as just another form of exceptional completion.
- * Method {@link #cancel cancel} has the same effect as
- * {@code completeExceptionally(new CancellationException())}.
+ * CompletableFuture also implements {@link Future} with the following
+ * policies:
*
- * Upon exceptional completion (including cancellation), or when a
- * completion entails an additional computation which terminates
- * abruptly with an (unchecked) exception or error, then all of their
- * dependent completions (and their dependents in turn) generally act
- * as {@code completeExceptionally} with a {@link CompletionException}
- * holding that exception as its cause. However, the {@link
- * #exceptionally exceptionally} and {@link #handle handle}
- * completions are able to handle exceptional completions of
- * the CompletableFutures they depend on.
+ * - Since (unlike {@link FutureTask}) this class has no direct
+ * control over the computation that causes it to be completed,
+ * cancellation is treated as just another form of exceptional
+ * completion. Method {@link #cancel cancel} has the same effect as
+ * {@code completeExceptionally(new CancellationException())}. Method
+ * {@link #isCompletedExceptionally} can be used to determine if a
+ * CompletableFuture completed in any exceptional fashion.
*
- * In case of exceptional completion with a CompletionException,
+ * - In case of exceptional completion with a CompletionException,
* methods {@link #get()} and {@link #get(long, TimeUnit)} throw an
* {@link ExecutionException} with the same cause as held in the
- * corresponding CompletionException. However, in these cases,
- * methods {@link #join()} and {@link #getNow} throw the
- * CompletionException, which simplifies usage.
- *
- *
Arguments used to pass a completion result (that is, for parameters
- * of type {@code T}) may be null, but passing a null value for any other
- * parameter will result in a {@link NullPointerException} being thrown.
+ * corresponding CompletionException. To simplify usage in most
+ * contexts, this class also defines methods {@link #join()} and
+ * {@link #getNow} that instead throw the CompletionException directly
+ * in these cases.
*
* @author Doug Lea
* @since 1.8
*/
-public class CompletableFuture implements Future {
+public class CompletableFuture implements Future, CompletionStage {
/*
* Overview:
@@ -438,6 +427,19 @@
public final void run() { exec(); }
}
+ /**
+ * Starts the given async task using the given executor, unless
+ * the executor is ForkJoinPool.commonPool and it has been
+ * disabled, in which case starts a new thread.
+ */
+ static void execAsync(Executor e, Async r) {
+ if (e == ForkJoinPool.commonPool() &&
+ ForkJoinPool.getCommonPoolParallelism() <= 1)
+ new Thread(r).start();
+ else
+ e.execute(r);
+ }
+
static final class AsyncRun extends Async {
final Runnable fn;
final CompletableFuture dst;
@@ -538,13 +540,13 @@
static final class AsyncAccept extends Async {
final T arg;
final Consumer super T> fn;
- final CompletableFuture dst;
+ final CompletableFuture> dst;
AsyncAccept(T arg, Consumer super T> fn,
- CompletableFuture dst) {
+ CompletableFuture> dst) {
this.arg = arg; this.fn = fn; this.dst = dst;
}
public final boolean exec() {
- CompletableFuture d; Throwable ex;
+ CompletableFuture> d; Throwable ex;
if ((d = this.dst) != null && d.result == null) {
try {
fn.accept(arg);
@@ -563,14 +565,14 @@
final T arg1;
final U arg2;
final BiConsumer super T,? super U> fn;
- final CompletableFuture dst;
+ final CompletableFuture> dst;
AsyncAcceptBoth(T arg1, U arg2,
BiConsumer super T,? super U> fn,
- CompletableFuture dst) {
+ CompletableFuture> dst) {
this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
}
public final boolean exec() {
- CompletableFuture d; Throwable ex;
+ CompletableFuture> d; Throwable ex;
if ((d = this.dst) != null && d.result == null) {
try {
fn.accept(arg1, arg2);
@@ -587,10 +589,10 @@
static final class AsyncCompose extends Async {
final T arg;
- final Function super T, CompletableFuture> fn;
+ final Function super T, ? extends CompletionStage> fn;
final CompletableFuture dst;
AsyncCompose(T arg,
- Function super T, CompletableFuture> fn,
+ Function super T, ? extends CompletionStage> fn,
CompletableFuture dst) {
this.arg = arg; this.fn = fn; this.dst = dst;
}
@@ -598,7 +600,8 @@
CompletableFuture d, fr; U u; Throwable ex;
if ((d = this.dst) != null && d.result == null) {
try {
- fr = fn.apply(arg);
+ CompletionStage cs = fn.apply(arg);
+ fr = (cs == null) ? null : cs.toCompletableFuture();
ex = (fr == null) ? new NullPointerException() : null;
} catch (Throwable rex) {
ex = rex;
@@ -626,6 +629,33 @@
private static final long serialVersionUID = 5232453952276885070L;
}
+ static final class AsyncWhenComplete extends Async {
+ final T arg1;
+ final Throwable arg2;
+ final BiConsumer super T,? super Throwable> fn;
+ final CompletableFuture dst;
+ AsyncWhenComplete(T arg1, Throwable arg2,
+ BiConsumer super T,? super Throwable> fn,
+ CompletableFuture dst) {
+ this.arg1 = arg1; this.arg2 = arg2; this.fn = fn; this.dst = dst;
+ }
+ public final boolean exec() {
+ CompletableFuture d;
+ if ((d = this.dst) != null && d.result == null) {
+ Throwable ex = arg2;
+ try {
+ fn.accept(arg1, ex);
+ } catch (Throwable rex) {
+ if (ex == null)
+ ex = rex;
+ }
+ d.internalComplete(arg1, ex);
+ }
+ return true;
+ }
+ private static final long serialVersionUID = 5232453952276885070L;
+ }
+
/* ------------- Completions -------------- */
/**
@@ -680,7 +710,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncApply(t, fn, dst));
+ execAsync(e, new AsyncApply(t, fn, dst));
else
u = fn.apply(t);
} catch (Throwable rex) {
@@ -697,11 +727,11 @@
static final class ThenAccept extends Completion {
final CompletableFuture extends T> src;
final Consumer super T> fn;
- final CompletableFuture dst;
+ final CompletableFuture> dst;
final Executor executor;
ThenAccept(CompletableFuture extends T> src,
Consumer super T> fn,
- CompletableFuture dst,
+ CompletableFuture> dst,
Executor executor) {
this.src = src; this.fn = fn; this.dst = dst;
this.executor = executor;
@@ -709,7 +739,7 @@
public final void run() {
final CompletableFuture extends T> a;
final Consumer super T> fn;
- final CompletableFuture dst;
+ final CompletableFuture> dst;
Object r; T t; Throwable ex;
if ((dst = this.dst) != null &&
(fn = this.fn) != null &&
@@ -729,7 +759,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncAccept(t, fn, dst));
+ execAsync(e, new AsyncAccept(t, fn, dst));
else
fn.accept(t);
} catch (Throwable rex) {
@@ -773,7 +803,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncRun(fn, dst));
+ execAsync(e, new AsyncRun(fn, dst));
else
fn.run();
} catch (Throwable rex) {
@@ -839,7 +869,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncCombine(t, u, fn, dst));
+ execAsync(e, new AsyncCombine(t, u, fn, dst));
else
v = fn.apply(t, u);
} catch (Throwable rex) {
@@ -904,7 +934,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncAcceptBoth(t, u, fn, dst));
+ execAsync(e, new AsyncAcceptBoth(t, u, fn, dst));
else
fn.accept(t, u);
} catch (Throwable rex) {
@@ -956,7 +986,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncRun(fn, dst));
+ execAsync(e, new AsyncRun(fn, dst));
else
fn.run();
} catch (Throwable rex) {
@@ -1042,7 +1072,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncApply(t, fn, dst));
+ execAsync(e, new AsyncApply(t, fn, dst));
else
u = fn.apply(t);
} catch (Throwable rex) {
@@ -1095,7 +1125,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncAccept(t, fn, dst));
+ execAsync(e, new AsyncAccept(t, fn, dst));
else
fn.accept(t);
} catch (Throwable rex) {
@@ -1143,7 +1173,7 @@
if (ex == null) {
try {
if (e != null)
- e.execute(new AsyncRun(fn, dst));
+ execAsync(e, new AsyncRun(fn, dst));
else
fn.run();
} catch (Throwable rex) {
@@ -1226,6 +1256,54 @@
private static final long serialVersionUID = 5232453952276885070L;
}
+ static final class WhenCompleteCompletion extends Completion {
+ final CompletableFuture extends T> src;
+ final BiConsumer super T, ? super Throwable> fn;
+ final CompletableFuture dst;
+ final Executor executor;
+ WhenCompleteCompletion(CompletableFuture extends T> src,
+ BiConsumer super T, ? super Throwable> fn,
+ CompletableFuture dst,
+ Executor executor) {
+ this.src = src; this.fn = fn; this.dst = dst;
+ this.executor = executor;
+ }
+ public final void run() {
+ final CompletableFuture extends T> a;
+ final BiConsumer super T, ? super Throwable> fn;
+ final CompletableFuture dst;
+ Object r; T t; Throwable ex;
+ if ((dst = this.dst) != null &&
+ (fn = this.fn) != null &&
+ (a = this.src) != null &&
+ (r = a.result) != null &&
+ compareAndSet(0, 1)) {
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ Executor e = executor;
+ Throwable dx = null;
+ try {
+ if (e != null)
+ execAsync(e, new AsyncWhenComplete(t, ex, fn, dst));
+ else
+ fn.accept(t, ex);
+ } catch (Throwable rex) {
+ dx = rex;
+ }
+ if (e == null || dx != null)
+ dst.internalComplete(t, ex != null ? ex : dx);
+ }
+ }
+ private static final long serialVersionUID = 5232453952276885070L;
+ }
+
static final class ThenCopy extends Completion {
final CompletableFuture> src;
final CompletableFuture dst;
@@ -1286,10 +1364,13 @@
final CompletableFuture extends T> src;
final BiFunction super T, Throwable, ? extends U> fn;
final CompletableFuture dst;
+ final Executor executor;
HandleCompletion(CompletableFuture extends T> src,
BiFunction super T, Throwable, ? extends U> fn,
- CompletableFuture dst) {
+ CompletableFuture dst,
+ Executor executor) {
this.src = src; this.fn = fn; this.dst = dst;
+ this.executor = executor;
}
public final void run() {
final CompletableFuture extends T> a;
@@ -1310,13 +1391,19 @@
@SuppressWarnings("unchecked") T tr = (T) r;
t = tr;
}
- U u = null; Throwable dx = null;
+ Executor e = executor;
+ U u = null;
+ Throwable dx = null;
try {
- u = fn.apply(t, ex);
+ if (e != null)
+ execAsync(e, new AsyncCombine(t, ex, fn, dst));
+ else
+ u = fn.apply(t, ex);
} catch (Throwable rex) {
dx = rex;
}
- dst.internalComplete(u, dx);
+ if (e == null || dx != null)
+ dst.internalComplete(u, dx);
}
}
private static final long serialVersionUID = 5232453952276885070L;
@@ -1324,11 +1411,11 @@
static final class ThenCompose extends Completion {
final CompletableFuture extends T> src;
- final Function super T, CompletableFuture> fn;
+ final Function super T, ? extends CompletionStage> fn;
final CompletableFuture dst;
final Executor executor;
ThenCompose(CompletableFuture extends T> src,
- Function super T, CompletableFuture> fn,
+ Function super T, ? extends CompletionStage> fn,
CompletableFuture dst,
Executor executor) {
this.src = src; this.fn = fn; this.dst = dst;
@@ -1336,7 +1423,7 @@
}
public final void run() {
final CompletableFuture extends T> a;
- final Function super T, CompletableFuture> fn;
+ final Function super T, ? extends CompletionStage> fn;
final CompletableFuture dst;
Object r; T t; Throwable ex; Executor e;
if ((dst = this.dst) != null &&
@@ -1358,10 +1445,12 @@
boolean complete = false;
if (ex == null) {
if ((e = executor) != null)
- e.execute(new AsyncCompose(t, fn, dst));
+ execAsync(e, new AsyncCompose(t, fn, dst));
else {
try {
- if ((c = fn.apply(t)) == null)
+ CompletionStage cs = fn.apply(t);
+ c = (cs == null) ? null : cs.toCompletableFuture();
+ if (c == null)
ex = new NullPointerException();
} catch (Throwable rex) {
ex = rex;
@@ -1401,6 +1490,619 @@
private static final long serialVersionUID = 5232453952276885070L;
}
+ // Implementations of stage methods with (plain, async, Executor) forms
+
+ private CompletableFuture doThenApply
+ (Function super T,? extends U> fn,
+ Executor e) {
+ if (fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ ThenApply d = null;
+ Object r;
+ if ((r = result) == null) {
+ CompletionNode p = new CompletionNode
+ (d = new ThenApply(this, fn, dst, e));
+ while ((r = result) == null) {
+ if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ break;
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ U u = null;
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncApply(t, fn, dst));
+ else
+ u = fn.apply(t);
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(u, ex);
+ }
+ helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doThenAccept(Consumer super T> fn,
+ Executor e) {
+ if (fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ ThenAccept d = null;
+ Object r;
+ if ((r = result) == null) {
+ CompletionNode p = new CompletionNode
+ (d = new ThenAccept(this, fn, dst, e));
+ while ((r = result) == null) {
+ if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ break;
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncAccept(t, fn, dst));
+ else
+ fn.accept(t);
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doThenRun(Runnable action,
+ Executor e) {
+ if (action == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ ThenRun d = null;
+ Object r;
+ if ((r = result) == null) {
+ CompletionNode p = new CompletionNode
+ (d = new ThenRun(this, action, dst, e));
+ while ((r = result) == null) {
+ if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ break;
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ Throwable ex;
+ if (r instanceof AltResult)
+ ex = ((AltResult)r).ex;
+ else
+ ex = null;
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncRun(action, dst));
+ else
+ action.run();
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doThenCombine
+ (CompletableFuture extends U> other,
+ BiFunction super T,? super U,? extends V> fn,
+ Executor e) {
+ if (other == null || fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ ThenCombine d = null;
+ Object r, s = null;
+ if ((r = result) == null || (s = other.result) == null) {
+ d = new ThenCombine(this, other, fn, dst, e);
+ CompletionNode q = null, p = new CompletionNode(d);
+ while ((r == null && (r = result) == null) ||
+ (s == null && (s = other.result) == null)) {
+ if (q != null) {
+ if (s != null ||
+ UNSAFE.compareAndSwapObject
+ (other, COMPLETIONS, q.next = other.completions, q))
+ break;
+ }
+ else if (r != null ||
+ UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p)) {
+ if (s != null)
+ break;
+ q = new CompletionNode(d);
+ }
+ }
+ }
+ if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; U u; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ if (ex != null)
+ u = null;
+ else if (s instanceof AltResult) {
+ ex = ((AltResult)s).ex;
+ u = null;
+ }
+ else {
+ @SuppressWarnings("unchecked") U us = (U) s;
+ u = us;
+ }
+ V v = null;
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncCombine(t, u, fn, dst));
+ else
+ v = fn.apply(t, u);
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(v, ex);
+ }
+ helpPostComplete();
+ other.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doThenAcceptBoth
+ (CompletableFuture extends U> other,
+ BiConsumer super T,? super U> fn,
+ Executor e) {
+ if (other == null || fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ ThenAcceptBoth d = null;
+ Object r, s = null;
+ if ((r = result) == null || (s = other.result) == null) {
+ d = new ThenAcceptBoth(this, other, fn, dst, e);
+ CompletionNode q = null, p = new CompletionNode(d);
+ while ((r == null && (r = result) == null) ||
+ (s == null && (s = other.result) == null)) {
+ if (q != null) {
+ if (s != null ||
+ UNSAFE.compareAndSwapObject
+ (other, COMPLETIONS, q.next = other.completions, q))
+ break;
+ }
+ else if (r != null ||
+ UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p)) {
+ if (s != null)
+ break;
+ q = new CompletionNode(d);
+ }
+ }
+ }
+ if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; U u; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ if (ex != null)
+ u = null;
+ else if (s instanceof AltResult) {
+ ex = ((AltResult)s).ex;
+ u = null;
+ }
+ else {
+ @SuppressWarnings("unchecked") U us = (U) s;
+ u = us;
+ }
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncAcceptBoth(t, u, fn, dst));
+ else
+ fn.accept(t, u);
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ other.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doRunAfterBoth(CompletableFuture> other,
+ Runnable action,
+ Executor e) {
+ if (other == null || action == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ RunAfterBoth d = null;
+ Object r, s = null;
+ if ((r = result) == null || (s = other.result) == null) {
+ d = new RunAfterBoth(this, other, action, dst, e);
+ CompletionNode q = null, p = new CompletionNode(d);
+ while ((r == null && (r = result) == null) ||
+ (s == null && (s = other.result) == null)) {
+ if (q != null) {
+ if (s != null ||
+ UNSAFE.compareAndSwapObject
+ (other, COMPLETIONS, q.next = other.completions, q))
+ break;
+ }
+ else if (r != null ||
+ UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p)) {
+ if (s != null)
+ break;
+ q = new CompletionNode(d);
+ }
+ }
+ }
+ if (r != null && s != null && (d == null || d.compareAndSet(0, 1))) {
+ Throwable ex;
+ if (r instanceof AltResult)
+ ex = ((AltResult)r).ex;
+ else
+ ex = null;
+ if (ex == null && (s instanceof AltResult))
+ ex = ((AltResult)s).ex;
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncRun(action, dst));
+ else
+ action.run();
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ other.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doApplyToEither
+ (CompletableFuture extends T> other,
+ Function super T, U> fn,
+ Executor e) {
+ if (other == null || fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ ApplyToEither d = null;
+ Object r;
+ if ((r = result) == null && (r = other.result) == null) {
+ d = new ApplyToEither(this, other, fn, dst, e);
+ CompletionNode q = null, p = new CompletionNode(d);
+ while ((r = result) == null && (r = other.result) == null) {
+ if (q != null) {
+ if (UNSAFE.compareAndSwapObject
+ (other, COMPLETIONS, q.next = other.completions, q))
+ break;
+ }
+ else if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ q = new CompletionNode(d);
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ U u = null;
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncApply(t, fn, dst));
+ else
+ u = fn.apply(t);
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(u, ex);
+ }
+ helpPostComplete();
+ other.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doAcceptEither
+ (CompletableFuture extends T> other,
+ Consumer super T> fn,
+ Executor e) {
+ if (other == null || fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ AcceptEither d = null;
+ Object r;
+ if ((r = result) == null && (r = other.result) == null) {
+ d = new AcceptEither(this, other, fn, dst, e);
+ CompletionNode q = null, p = new CompletionNode(d);
+ while ((r = result) == null && (r = other.result) == null) {
+ if (q != null) {
+ if (UNSAFE.compareAndSwapObject
+ (other, COMPLETIONS, q.next = other.completions, q))
+ break;
+ }
+ else if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ q = new CompletionNode(d);
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncAccept(t, fn, dst));
+ else
+ fn.accept(t);
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ other.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doRunAfterEither
+ (CompletableFuture> other,
+ Runnable action,
+ Executor e) {
+ if (other == null || action == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ RunAfterEither d = null;
+ Object r;
+ if ((r = result) == null && (r = other.result) == null) {
+ d = new RunAfterEither(this, other, action, dst, e);
+ CompletionNode q = null, p = new CompletionNode(d);
+ while ((r = result) == null && (r = other.result) == null) {
+ if (q != null) {
+ if (UNSAFE.compareAndSwapObject
+ (other, COMPLETIONS, q.next = other.completions, q))
+ break;
+ }
+ else if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ q = new CompletionNode(d);
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ Throwable ex;
+ if (r instanceof AltResult)
+ ex = ((AltResult)r).ex;
+ else
+ ex = null;
+ if (ex == null) {
+ try {
+ if (e != null)
+ execAsync(e, new AsyncRun(action, dst));
+ else
+ action.run();
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ other.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doThenCompose
+ (Function super T, ? extends CompletionStage> fn,
+ Executor e) {
+ if (fn == null) throw new NullPointerException();
+ CompletableFuture dst = null;
+ ThenCompose d = null;
+ Object r;
+ if ((r = result) == null) {
+ dst = new CompletableFuture();
+ CompletionNode p = new CompletionNode
+ (d = new ThenCompose(this, fn, dst, e));
+ while ((r = result) == null) {
+ if (UNSAFE.compareAndSwapObject
+ (this, COMPLETIONS, p.next = completions, p))
+ break;
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ if (ex == null) {
+ if (e != null) {
+ if (dst == null)
+ dst = new CompletableFuture();
+ execAsync(e, new AsyncCompose(t, fn, dst));
+ }
+ else {
+ try {
+ CompletionStage cs = fn.apply(t);
+ if (cs == null ||
+ (dst = cs.toCompletableFuture()) == null)
+ ex = new NullPointerException();
+ } catch (Throwable rex) {
+ ex = rex;
+ }
+ }
+ }
+ if (dst == null)
+ dst = new CompletableFuture();
+ if (e == null || ex != null)
+ dst.internalComplete(null, ex);
+ }
+ helpPostComplete();
+ dst.helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doWhenComplete
+ (BiConsumer super T, ? super Throwable> fn,
+ Executor e) {
+ if (fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ WhenCompleteCompletion d = null;
+ Object r;
+ if ((r = result) == null) {
+ CompletionNode p =
+ new CompletionNode(d = new WhenCompleteCompletion
+ (this, fn, dst, e));
+ while ((r = result) == null) {
+ if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
+ p.next = completions, p))
+ break;
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ Throwable dx = null;
+ try {
+ if (e != null)
+ execAsync(e, new AsyncWhenComplete(t, ex, fn, dst));
+ else
+ fn.accept(t, ex);
+ } catch (Throwable rex) {
+ dx = rex;
+ }
+ if (e == null || dx != null)
+ dst.internalComplete(t, ex != null ? ex : dx);
+ }
+ helpPostComplete();
+ return dst;
+ }
+
+ private CompletableFuture doHandle
+ (BiFunction super T, Throwable, ? extends U> fn,
+ Executor e) {
+ if (fn == null) throw new NullPointerException();
+ CompletableFuture dst = new CompletableFuture();
+ HandleCompletion d = null;
+ Object r;
+ if ((r = result) == null) {
+ CompletionNode p =
+ new CompletionNode(d = new HandleCompletion
+ (this, fn, dst, e));
+ while ((r = result) == null) {
+ if (UNSAFE.compareAndSwapObject(this, COMPLETIONS,
+ p.next = completions, p))
+ break;
+ }
+ }
+ if (r != null && (d == null || d.compareAndSet(0, 1))) {
+ T t; Throwable ex;
+ if (r instanceof AltResult) {
+ ex = ((AltResult)r).ex;
+ t = null;
+ }
+ else {
+ ex = null;
+ @SuppressWarnings("unchecked") T tr = (T) r;
+ t = tr;
+ }
+ U u = null;
+ Throwable dx = null;
+ try {
+ if (e != null)
+ execAsync(e, new AsyncCombine(t, ex, fn, dst));
+ else {
+ u = fn.apply(t, ex);
+ dx = null;
+ }
+ } catch (Throwable rex) {
+ dx = rex;
+ u = null;
+ }
+ if (e == null || dx != null)
+ dst.internalComplete(u, dx);
+ }
+ helpPostComplete();
+ return dst;
+ }
+
+
// public methods
/**
@@ -1416,13 +2118,13 @@
*
* @param supplier a function returning the value to be used
* to complete the returned CompletableFuture
+ * @param the function's return type
* @return the new CompletableFuture
*/
public static CompletableFuture supplyAsync(Supplier supplier) {
if (supplier == null) throw new NullPointerException();
CompletableFuture f = new CompletableFuture();
- ForkJoinPool.commonPool().
- execute((ForkJoinTask>)new AsyncSupply(supplier, f));
+ execAsync(ForkJoinPool.commonPool(), new AsyncSupply(supplier, f));
return f;
}
@@ -1434,6 +2136,7 @@
* @param supplier a function returning the value to be used
* to complete the returned CompletableFuture
* @param executor the executor to use for asynchronous execution
+ * @param the function's return type
* @return the new CompletableFuture
*/
public static CompletableFuture supplyAsync(Supplier supplier,
@@ -1441,7 +2144,7 @@
if (executor == null || supplier == null)
throw new NullPointerException();
CompletableFuture f = new CompletableFuture();
- executor.execute(new AsyncSupply(supplier, f));
+ execAsync(executor, new AsyncSupply(supplier, f));
return f;
}
@@ -1457,8 +2160,7 @@
public static CompletableFuture runAsync(Runnable runnable) {
if (runnable == null) throw new NullPointerException();
CompletableFuture f = new CompletableFuture();
- ForkJoinPool.commonPool().
- execute((ForkJoinTask>)new AsyncRun(runnable, f));
+ execAsync(ForkJoinPool.commonPool(), new AsyncRun(runnable, f));
return f;
}
@@ -1477,7 +2179,7 @@
if (executor == null || runnable == null)
throw new NullPointerException();
CompletableFuture f = new CompletableFuture();
- executor.execute(new AsyncRun(runnable, f));
+ execAsync(executor, new AsyncRun(runnable, f));
return f;
}
@@ -1486,6 +2188,7 @@
* the given value.
*
* @param value the value
+ * @param the type of the value
* @return the completed CompletableFuture
*/
public static CompletableFuture completedFuture(U value) {
@@ -1657,60 +2360,18 @@
return triggered;
}
- /**
- * Returns a new CompletableFuture that is completed
- * when this CompletableFuture completes, with the result of the
- * given function of this CompletableFuture's result.
- *
- * If this CompletableFuture completes exceptionally, or the
- * supplied function throws an exception, then the returned
- * CompletableFuture completes exceptionally with a
- * CompletionException holding the exception as its cause.
- *
- * @param fn the function to use to compute the value of
- * the returned CompletableFuture
- * @return the new CompletableFuture
- */
- public CompletableFuture thenApply(Function super T,? extends U> fn) {
+ // CompletionStage methods
+
+ public CompletableFuture thenApply
+ (Function super T,? extends U> fn) {
return doThenApply(fn, null);
}
- /**
- * Returns a new CompletableFuture that is asynchronously completed
- * when this CompletableFuture completes, with the result of the
- * given function of this CompletableFuture's result from a
- * task running in the {@link ForkJoinPool#commonPool()}.
- *
- * If this CompletableFuture completes exceptionally, or the
- * supplied function throws an exception, then the returned
- * CompletableFuture completes exceptionally with a
- * CompletionException holding the exception as its cause.
- *
- * @param fn the function to use to compute the value of
- * the returned CompletableFuture
- * @return the new CompletableFuture
- */
public CompletableFuture thenApplyAsync
(Function super T,? extends U> fn) {
return doThenApply(fn, ForkJoinPool.commonPool());
}
- /**
- * Returns a new CompletableFuture that is asynchronously completed
- * when this CompletableFuture completes, with the result of the
- * given function of this CompletableFuture's result from a
- * task running in the given executor.
- *
- * If this CompletableFuture completes exceptionally, or the
- * supplied function throws an exception, then the returned
- * CompletableFuture completes exceptionally with a
- * CompletionException holding the exception as its cause.
- *
- * @param fn the function to use to compute the value of
- * the returned CompletableFuture
- * @param executor the executor to use for asynchronous execution
- * @return the new CompletableFuture
- */
public CompletableFuture thenApplyAsync
(Function super T,? extends U> fn,
Executor executor) {
@@ -1718,1149 +2379,228 @@
return doThenApply(fn, executor);
}
- private CompletableFuture doThenApply
- (Function super T,? extends U> fn,
- Executor e) {
- if (fn == null) throw new NullPointerException();
- CompletableFuture dst = new CompletableFuture();
- ThenApply d = null;
- Object r;
- if ((r = result) == null) {
- CompletionNode p = new CompletionNode
- (d = new ThenApply(this, fn, dst, e));
- while ((r = result) == null) {
- if (UNSAFE.compareAndSwapObject
- (this, COMPLETIONS, p.next = completions, p))
- break;
- }
- }
- if (r != null && (d == null || d.compareAndSet(0, 1))) {
- T t; Throwable ex;
- if (r instanceof AltResult) {
- ex = ((AltResult)r).ex;
- t = null;
- }
- else {
- ex = null;
- @SuppressWarnings("unchecked") T tr = (T) r;
- t = tr;
- }
- U u = null;
- if (ex == null) {
- try {
- if (e != null)
- e.execute(new AsyncApply(t, fn, dst));
- else
- u = fn.apply(t);
- } catch (Throwable rex) {
- ex = rex;
- }
- }
- if (e == null || ex != null)
- dst.internalComplete(u, ex);
- }
- helpPostComplete();
- return dst;
+ public CompletableFuture thenAccept
+ (Consumer super T> action) {
+ return doThenAccept(action, null);
}
- /**
- * Returns a new CompletableFuture that is completed
- * when this CompletableFuture completes, after performing the given
- * action with this CompletableFuture's result.
- *
- * If this CompletableFuture completes exceptionally, or the
- * supplied action throws an exception, then the returned
- * CompletableFuture completes exceptionally with a
- * CompletionException holding the exception as its cause.
- *
- * @param block the action to perform before completing the
- * returned CompletableFuture
- * @return the new CompletableFuture
- */
- public CompletableFuture thenAccept(Consumer super T> block) {
- return doThenAccept(block, null);
+ public CompletableFuture thenAcceptAsync
+ (Consumer super T> action) {
+ return doThenAccept(action, ForkJoinPool.commonPool());
}
- /**
- * Returns a new CompletableFuture that is asynchronously completed
- * when this CompletableFuture completes, after performing the given
- * action with this CompletableFuture's result from a task running
- * in the {@link ForkJoinPool#commonPool()}.
- *
- * If this CompletableFuture completes exceptionally, or the
- * supplied action throws an exception, then the returned
- * CompletableFuture completes exceptionally with a
- * CompletionException holding the exception as its cause.
- *
- * @param block the action to perform before completing the
- * returned CompletableFuture
- * @return the new CompletableFuture
- */
- public CompletableFuture thenAcceptAsync(Consumer super T> block) {
- return doThenAccept(block, ForkJoinPool.commonPool());
- }
-
- /**
- * Returns a new CompletableFuture that is asynchronously completed
- * when this CompletableFuture completes, after performing the given
- * action with this CompletableFuture's result from a task running
- * in the given executor.
- *
- * If this CompletableFuture completes exceptionally, or the
- * supplied action throws an exception, then the returned
- * CompletableFuture completes exceptionally with a
- * CompletionException holding the exception as its cause.
- *
- * @param block the action to perform before completing the
- * returned CompletableFuture
- * @param executor the executor to use for asynchronous execution
- * @return the new CompletableFuture
- */
- public CompletableFuture thenAcceptAsync(Consumer super T> block,
- Executor executor) {
+ public CompletableFuture thenAcceptAsync
+ (Consumer super T> action,
+ Executor executor) {
if (executor == null) throw new NullPointerException();
- return doThenAccept(block, executor);
+ return doThenAccept(action, executor);
}
- private CompletableFuture doThenAccept(Consumer super T> fn,
- Executor e) {
- if (fn == null) throw new NullPointerException();
- CompletableFuture |