提交 a09d112e 编写于 作者: L lana

Merge

...@@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler { ...@@ -618,6 +618,11 @@ public final class TzdbZoneRulesCompiler {
// remove ROC, which is not supported in j.u.tz // remove ROC, which is not supported in j.u.tz
builtZones.remove("ROC"); builtZones.remove("ROC");
links.remove("ROC"); links.remove("ROC");
// remove EST, HST and MST. They are supported via
// the short-id mapping
builtZones.remove("EST");
builtZones.remove("HST");
builtZones.remove("MST");
} }
/** /**
......
...@@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,- ...@@ -27,7 +27,7 @@ DISABLE_WARNINGS := -Xlint:all,-deprecation,-unchecked,-rawtypes,-cast,-serial,-
# To build with all warnings enabled, do the following: # To build with all warnings enabled, do the following:
# make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000" # make JAVAC_WARNINGS="-Xlint:all -Xmaxwarns 10000"
JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,classfile,dep-ann,divzero,varargs -Werror JAVAC_WARNINGS := -Xlint:-unchecked,-deprecation,-overrides,auxiliaryclass,classfile,dep-ann,divzero,empty,try,varargs -Werror
# Any java code executed during a JDK build to build other parts of the JDK must be # Any java code executed during a JDK build to build other parts of the JDK must be
# executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this # executed by the bootstrap JDK (probably with -Xbootclasspath/p: ) and for this
......
...@@ -267,7 +267,8 @@ SUNWprivate_1.1 { ...@@ -267,7 +267,8 @@ SUNWprivate_1.1 {
Java_sun_misc_GC_maxObjectInspectionAge; Java_sun_misc_GC_maxObjectInspectionAge;
Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
Java_sun_reflect_NativeMethodAccessorImpl_invoke0; Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
Java_sun_reflect_Reflection_getCallerClass; Java_sun_reflect_Reflection_getCallerClass__;
Java_sun_reflect_Reflection_getCallerClass__I;
Java_sun_reflect_Reflection_getClassAccessFlags; Java_sun_reflect_Reflection_getClassAccessFlags;
Java_sun_misc_Version_getJdkVersionInfo; Java_sun_misc_Version_getJdkVersionInfo;
Java_sun_misc_Version_getJdkSpecialVersion; Java_sun_misc_Version_getJdkSpecialVersion;
......
...@@ -27,7 +27,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; ...@@ -27,7 +27,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0; text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass; text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_Object_getClass; text: .text%Java_java_lang_Object_getClass;
text: .text%Java_sun_reflect_Reflection_getClassAccessFlags; text: .text%Java_sun_reflect_Reflection_getClassAccessFlags;
......
...@@ -26,7 +26,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; ...@@ -26,7 +26,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0; text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass; text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern; text: .text%Java_java_lang_String_intern;
text: .text%Java_java_lang_Float_floatToIntBits; text: .text%Java_java_lang_Float_floatToIntBits;
......
...@@ -28,7 +28,8 @@ text: .text%Java_java_io_FileInputStream_initIDs; ...@@ -28,7 +28,8 @@ text: .text%Java_java_io_FileInputStream_initIDs;
text: .text%Java_java_io_FileDescriptor_initIDs; text: .text%Java_java_io_FileDescriptor_initIDs;
text: .text%Java_java_io_FileOutputStream_initIDs; text: .text%Java_java_io_FileOutputStream_initIDs;
text: .text%Java_java_lang_System_setIn0; text: .text%Java_java_lang_System_setIn0;
text: .text%Java_sun_reflect_Reflection_getCallerClass; text: .text%Java_sun_reflect_Reflection_getCallerClass__;
text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
text: .text%Java_java_lang_Class_forName0; text: .text%Java_java_lang_Class_forName0;
text: .text%Java_java_lang_String_intern; text: .text%Java_java_lang_String_intern;
text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; text: .text%Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0;
......
...@@ -47,7 +47,7 @@ name(PacketInputStream *in, PacketOutputStream *out) ...@@ -47,7 +47,7 @@ name(PacketInputStream *in, PacketOutputStream *out)
(void)memset(&info, 0, sizeof(info)); (void)memset(&info, 0, sizeof(info));
threadGroupInfo(group, &info); threadGroupInfo(group, &info);
(void)outStream_writeString(out, info.name); (void)outStream_writeString(out, info.name == NULL ? "" : info.name);
if ( info.name != NULL ) if ( info.name != NULL )
jvmtiDeallocate(info.name); jvmtiDeallocate(info.name);
......
...@@ -298,17 +298,15 @@ jdwpError ...@@ -298,17 +298,15 @@ jdwpError
outStream_writeString(PacketOutputStream *stream, char *string) outStream_writeString(PacketOutputStream *stream, char *string)
{ {
jdwpError error; jdwpError error;
jint length; jint length = string != NULL ? (int)strlen(string) : 0;
/* Options utf8=y/n controls if we want Standard UTF-8 or Modified */ /* Options utf8=y/n controls if we want Standard UTF-8 or Modified */
if ( gdata->modifiedUtf8 ) { if ( gdata->modifiedUtf8 ) {
length = (int)strlen(string);
(void)outStream_writeInt(stream, length); (void)outStream_writeInt(stream, length);
error = writeBytes(stream, (jbyte *)string, length); error = writeBytes(stream, (jbyte *)string, length);
} else { } else {
jint new_length; jint new_length;
length = (int)strlen(string);
new_length = (gdata->npt->utf8mToUtf8sLength) new_length = (gdata->npt->utf8mToUtf8sLength)
(gdata->npt->utf, (jbyte*)string, length); (gdata->npt->utf, (jbyte*)string, length);
if ( new_length == length ) { if ( new_length == length ) {
......
...@@ -41,7 +41,7 @@ FileChooser.saveDialogTitle.textAndMnemonic=Speichern ...@@ -41,7 +41,7 @@ FileChooser.saveDialogTitle.textAndMnemonic=Speichern
FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen FileChooser.openDialogTitle.textAndMnemonic=\u00D6ffnen
FileChooser.pathLabel.textAndMnemonic=Aus&wahl: FileChooser.pathLabel.textAndMnemonic=Aus&wahl:
FileChooser.filterLabel.textAndMnemonic=Filter: FileChooser.filterLabel.textAndMnemonic=Filter:
FileChooser.foldersLabel.textAndMnemonic=Or&dner FileChooser.foldersLabel.textAndMnemonic=O&rdner
FileChooser.filesLabel.textAndMnemonic=&Dateien FileChooser.filesLabel.textAndMnemonic=&Dateien
FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen. FileChooser.cancelButtonToolTip.textAndMnemonic=Dialogfeld f\u00FCr Dateiauswahl schlie\u00DFen.
......
...@@ -130,7 +130,7 @@ public class SnmpString extends SnmpValue { ...@@ -130,7 +130,7 @@ public class SnmpString extends SnmpValue {
* @return The value. * @return The value.
*/ */
public byte[] byteValue() { public byte[] byteValue() {
return value ; return value.clone() ;
} }
/** /**
......
...@@ -476,8 +476,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable { ...@@ -476,8 +476,7 @@ public abstract class SnmpMib extends SnmpMibAgent implements Serializable {
rootOid[i++]= val.longValue(); rootOid[i++]= val.longValue();
} }
} }
return rootOid; return rootOid.clone();
} }
// -------------------------------------------------------------------- // --------------------------------------------------------------------
......
...@@ -1248,7 +1248,7 @@ public abstract class CommunicatorServer ...@@ -1248,7 +1248,7 @@ public abstract class CommunicatorServer
"of this CommunicatorServer instance has changed."); "of this CommunicatorServer instance has changed.");
} }
return notifInfos; return notifInfos.clone();
} }
/** /**
......
...@@ -275,7 +275,6 @@ class ByteArrayInputStream extends InputStream { ...@@ -275,7 +275,6 @@ class ByteArrayInputStream extends InputStream {
* Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in * Closing a <tt>ByteArrayInputStream</tt> has no effect. The methods in
* this class can be called after the stream has been closed without * this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>. * generating an <tt>IOException</tt>.
* <p>
*/ */
public void close() throws IOException { public void close() throws IOException {
} }
......
...@@ -263,8 +263,6 @@ public class ByteArrayOutputStream extends OutputStream { ...@@ -263,8 +263,6 @@ public class ByteArrayOutputStream extends OutputStream {
* Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in * Closing a <tt>ByteArrayOutputStream</tt> has no effect. The methods in
* this class can be called after the stream has been closed without * this class can be called after the stream has been closed without
* generating an <tt>IOException</tt>. * generating an <tt>IOException</tt>.
* <p>
*
*/ */
public void close() throws IOException { public void close() throws IOException {
} }
......
...@@ -34,7 +34,6 @@ import java.io.IOException; ...@@ -34,7 +34,6 @@ import java.io.IOException;
* *
* @since 1.5 * @since 1.5
*/ */
@FunctionalInterface
public interface Closeable extends AutoCloseable { public interface Closeable extends AutoCloseable {
/** /**
......
...@@ -155,7 +155,7 @@ interface DataInput { ...@@ -155,7 +155,7 @@ interface DataInput {
* to the length of {@code b}. * to the length of {@code b}.
* <p> * <p>
* This method blocks until one of the * This method blocks until one of the
* following conditions occurs:<p> * following conditions occurs:
* <ul> * <ul>
* <li>{@code b.length} * <li>{@code b.length}
* bytes of input data are available, in which * bytes of input data are available, in which
...@@ -197,7 +197,7 @@ interface DataInput { ...@@ -197,7 +197,7 @@ interface DataInput {
* <p> * <p>
* This method * This method
* blocks until one of the following conditions * blocks until one of the following conditions
* occurs:<p> * occurs:
* <ul> * <ul>
* <li>{@code len} bytes * <li>{@code len} bytes
* of input data are available, in which case * of input data are available, in which case
...@@ -316,8 +316,8 @@ interface DataInput { ...@@ -316,8 +316,8 @@ interface DataInput {
* be the second byte. The value * be the second byte. The value
* returned * returned
* is: * is:
* <p><pre><code>(short)((a &lt;&lt; 8) | (b &amp; 0xff)) * <pre>{@code (short)((a << 8) | (b & 0xff))
* </code></pre> * }</pre>
* This method * This method
* is suitable for reading the bytes written * is suitable for reading the bytes written
* by the {@code writeShort} method of * by the {@code writeShort} method of
...@@ -337,8 +337,8 @@ interface DataInput { ...@@ -337,8 +337,8 @@ interface DataInput {
* be the first byte read and * be the first byte read and
* {@code b} * {@code b}
* be the second byte. The value returned is: * be the second byte. The value returned is:
* <p><pre><code>(((a &amp; 0xff) &lt;&lt; 8) | (b &amp; 0xff)) * <pre>{@code (((a & 0xff) << 8) | (b & 0xff))
* </code></pre> * }</pre>
* This method is suitable for reading the bytes * This method is suitable for reading the bytes
* written by the {@code writeShort} method * written by the {@code writeShort} method
* of interface {@code DataOutput} if * of interface {@code DataOutput} if
...@@ -359,8 +359,8 @@ interface DataInput { ...@@ -359,8 +359,8 @@ interface DataInput {
* be the first byte read and {@code b} * be the first byte read and {@code b}
* be the second byte. The value * be the second byte. The value
* returned is: * returned is:
* <p><pre><code>(char)((a &lt;&lt; 8) | (b &amp; 0xff)) * <pre>{@code (char)((a << 8) | (b & 0xff))
* </code></pre> * }</pre>
* This method * This method
* is suitable for reading bytes written by * is suitable for reading bytes written by
* the {@code writeChar} method of interface * the {@code writeChar} method of interface
...@@ -377,10 +377,10 @@ interface DataInput { ...@@ -377,10 +377,10 @@ interface DataInput {
* Reads four input bytes and returns an * Reads four input bytes and returns an
* {@code int} value. Let {@code a-d} * {@code int} value. Let {@code a-d}
* be the first through fourth bytes read. The value returned is: * be the first through fourth bytes read. The value returned is:
* <p><pre><code> * <pre>{@code
* (((a &amp; 0xff) &lt;&lt; 24) | ((b &amp; 0xff) &lt;&lt; 16) | * (((a & 0xff) << 24) | ((b & 0xff) << 16) |
* &#32;((c &amp; 0xff) &lt;&lt; 8) | (d &amp; 0xff)) * ((c & 0xff) << 8) | (d & 0xff))
* </code></pre> * }</pre>
* This method is suitable * This method is suitable
* for reading bytes written by the {@code writeInt} * for reading bytes written by the {@code writeInt}
* method of interface {@code DataOutput}. * method of interface {@code DataOutput}.
...@@ -397,16 +397,16 @@ interface DataInput { ...@@ -397,16 +397,16 @@ interface DataInput {
* a {@code long} value. Let {@code a-h} * a {@code long} value. Let {@code a-h}
* be the first through eighth bytes read. * be the first through eighth bytes read.
* The value returned is: * The value returned is:
* <p><pre><code> * <pre>{@code
* (((long)(a &amp; 0xff) &lt;&lt; 56) | * (((long)(a & 0xff) << 56) |
* ((long)(b &amp; 0xff) &lt;&lt; 48) | * ((long)(b & 0xff) << 48) |
* ((long)(c &amp; 0xff) &lt;&lt; 40) | * ((long)(c & 0xff) << 40) |
* ((long)(d &amp; 0xff) &lt;&lt; 32) | * ((long)(d & 0xff) << 32) |
* ((long)(e &amp; 0xff) &lt;&lt; 24) | * ((long)(e & 0xff) << 24) |
* ((long)(f &amp; 0xff) &lt;&lt; 16) | * ((long)(f & 0xff) << 16) |
* ((long)(g &amp; 0xff) &lt;&lt; 8) | * ((long)(g & 0xff) << 8) |
* ((long)(h &amp; 0xff))) * ((long)(h & 0xff)))
* </code></pre> * }</pre>
* <p> * <p>
* This method is suitable * This method is suitable
* for reading bytes written by the {@code writeLong} * for reading bytes written by the {@code writeLong}
...@@ -540,9 +540,9 @@ interface DataInput { ...@@ -540,9 +540,9 @@ interface DataInput {
* not match the bit pattern {@code 10xxxxxx}, * not match the bit pattern {@code 10xxxxxx},
* then a {@code UTFDataFormatException} * then a {@code UTFDataFormatException}
* is thrown. Otherwise, the group is converted * is thrown. Otherwise, the group is converted
* to the character:<p> * to the character:
* <pre><code>(char)(((a&amp; 0x1F) &lt;&lt; 6) | (b &amp; 0x3F)) * <pre>{@code (char)(((a & 0x1F) << 6) | (b & 0x3F))
* </code></pre> * }</pre>
* If the first byte of a group * If the first byte of a group
* matches the bit pattern {@code 1110xxxx}, * matches the bit pattern {@code 1110xxxx},
* then the group consists of that byte {@code a} * then the group consists of that byte {@code a}
...@@ -554,10 +554,10 @@ interface DataInput { ...@@ -554,10 +554,10 @@ interface DataInput {
* does not match the bit pattern {@code 10xxxxxx}, * does not match the bit pattern {@code 10xxxxxx},
* then a {@code UTFDataFormatException} * then a {@code UTFDataFormatException}
* is thrown. Otherwise, the group is converted * is thrown. Otherwise, the group is converted
* to the character:<p> * to the character:
* <pre><code> * <pre>{@code
* (char)(((a &amp; 0x0F) &lt;&lt; 12) | ((b &amp; 0x3F) &lt;&lt; 6) | (c &amp; 0x3F)) * (char)(((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F))
* </code></pre> * }</pre>
* If the first byte of a group matches the * If the first byte of a group matches the
* pattern {@code 1111xxxx} or the pattern * pattern {@code 1111xxxx} or the pattern
* {@code 10xxxxxx}, then a {@code UTFDataFormatException} * {@code 10xxxxxx}, then a {@code UTFDataFormatException}
......
...@@ -134,11 +134,11 @@ interface DataOutput { ...@@ -134,11 +134,11 @@ interface DataOutput {
* Writes two bytes to the output * Writes two bytes to the output
* stream to represent the value of the argument. * stream to represent the value of the argument.
* The byte values to be written, in the order * The byte values to be written, in the order
* shown, are: <p> * shown, are:
* <pre><code> * <pre>{@code
* (byte)(0xff &amp; (v &gt;&gt; 8)) * (byte)(0xff & (v >> 8))
* (byte)(0xff &amp; v) * (byte)(0xff & v)
* </code> </pre> <p> * }</pre> <p>
* The bytes written by this method may be * The bytes written by this method may be
* read by the <code>readShort</code> method * read by the <code>readShort</code> method
* of interface <code>DataInput</code> , which * of interface <code>DataInput</code> , which
...@@ -156,10 +156,10 @@ interface DataOutput { ...@@ -156,10 +156,10 @@ interface DataOutput {
* output stream. * output stream.
* The byte values to be written, in the order * The byte values to be written, in the order
* shown, are: * shown, are:
* <p><pre><code> * <pre>{@code
* (byte)(0xff &amp; (v &gt;&gt; 8)) * (byte)(0xff & (v >> 8))
* (byte)(0xff &amp; v) * (byte)(0xff & v)
* </code></pre><p> * }</pre><p>
* The bytes written by this method may be * The bytes written by this method may be
* read by the <code>readChar</code> method * read by the <code>readChar</code> method
* of interface <code>DataInput</code> , which * of interface <code>DataInput</code> , which
...@@ -176,12 +176,12 @@ interface DataOutput { ...@@ -176,12 +176,12 @@ interface DataOutput {
* comprised of four bytes, to the output stream. * comprised of four bytes, to the output stream.
* The byte values to be written, in the order * The byte values to be written, in the order
* shown, are: * shown, are:
* <p><pre><code> * <pre>{@code
* (byte)(0xff &amp; (v &gt;&gt; 24)) * (byte)(0xff & (v >> 24))
* (byte)(0xff &amp; (v &gt;&gt; 16)) * (byte)(0xff & (v >> 16))
* (byte)(0xff &amp; (v &gt;&gt; &#32; &#32;8)) * (byte)(0xff & (v >> 8))
* (byte)(0xff &amp; v) * (byte)(0xff & v)
* </code></pre><p> * }</pre><p>
* The bytes written by this method may be read * The bytes written by this method may be read
* by the <code>readInt</code> method of interface * by the <code>readInt</code> method of interface
* <code>DataInput</code> , which will then * <code>DataInput</code> , which will then
...@@ -197,16 +197,16 @@ interface DataOutput { ...@@ -197,16 +197,16 @@ interface DataOutput {
* comprised of eight bytes, to the output stream. * comprised of eight bytes, to the output stream.
* The byte values to be written, in the order * The byte values to be written, in the order
* shown, are: * shown, are:
* <p><pre><code> * <pre>{@code
* (byte)(0xff &amp; (v &gt;&gt; 56)) * (byte)(0xff & (v >> 56))
* (byte)(0xff &amp; (v &gt;&gt; 48)) * (byte)(0xff & (v >> 48))
* (byte)(0xff &amp; (v &gt;&gt; 40)) * (byte)(0xff & (v >> 40))
* (byte)(0xff &amp; (v &gt;&gt; 32)) * (byte)(0xff & (v >> 32))
* (byte)(0xff &amp; (v &gt;&gt; 24)) * (byte)(0xff & (v >> 24))
* (byte)(0xff &amp; (v &gt;&gt; 16)) * (byte)(0xff & (v >> 16))
* (byte)(0xff &amp; (v &gt;&gt; 8)) * (byte)(0xff & (v >> 8))
* (byte)(0xff &amp; v) * (byte)(0xff & v)
* </code></pre><p> * }</pre><p>
* The bytes written by this method may be * The bytes written by this method may be
* read by the <code>readLong</code> method * read by the <code>readLong</code> method
* of interface <code>DataInput</code> , which * of interface <code>DataInput</code> , which
...@@ -314,24 +314,24 @@ interface DataOutput { ...@@ -314,24 +314,24 @@ interface DataOutput {
* If a character <code>c</code> * If a character <code>c</code>
* is in the range <code>&#92;u0001</code> through * is in the range <code>&#92;u0001</code> through
* <code>&#92;u007f</code>, it is represented * <code>&#92;u007f</code>, it is represented
* by one byte:<p> * by one byte:
* <pre>(byte)c </pre> <p> * <pre>(byte)c </pre> <p>
* If a character <code>c</code> is <code>&#92;u0000</code> * If a character <code>c</code> is <code>&#92;u0000</code>
* or is in the range <code>&#92;u0080</code> * or is in the range <code>&#92;u0080</code>
* through <code>&#92;u07ff</code>, then it is * through <code>&#92;u07ff</code>, then it is
* represented by two bytes, to be written * represented by two bytes, to be written
* in the order shown:<p> <pre><code> * in the order shown: <pre>{@code
* (byte)(0xc0 | (0x1f &amp; (c &gt;&gt; 6))) * (byte)(0xc0 | (0x1f & (c >> 6)))
* (byte)(0x80 | (0x3f &amp; c)) * (byte)(0x80 | (0x3f & c))
* </code></pre> <p> If a character * }</pre> <p> If a character
* <code>c</code> is in the range <code>&#92;u0800</code> * <code>c</code> is in the range <code>&#92;u0800</code>
* through <code>uffff</code>, then it is * through <code>uffff</code>, then it is
* represented by three bytes, to be written * represented by three bytes, to be written
* in the order shown:<p> <pre><code> * in the order shown: <pre>{@code
* (byte)(0xe0 | (0x0f &amp; (c &gt;&gt; 12))) * (byte)(0xe0 | (0x0f & (c >> 12)))
* (byte)(0x80 | (0x3f &amp; (c &gt;&gt; 6))) * (byte)(0x80 | (0x3f & (c >> 6)))
* (byte)(0x80 | (0x3f &amp; c)) * (byte)(0x80 | (0x3f & c))
* </code></pre> <p> First, * }</pre> <p> First,
* the total number of bytes needed to represent * the total number of bytes needed to represent
* all the characters of <code>s</code> is * all the characters of <code>s</code> is
* calculated. If this number is larger than * calculated. If this number is larger than
......
...@@ -55,7 +55,7 @@ import sun.security.util.SecurityConstants; ...@@ -55,7 +55,7 @@ import sun.security.util.SecurityConstants;
* a list of one or more comma-separated keywords. The possible keywords are * a list of one or more comma-separated keywords. The possible keywords are
* "read", "write", "execute", "delete", and "readlink". Their meaning is * "read", "write", "execute", "delete", and "readlink". Their meaning is
* defined as follows: * defined as follows:
* <P> *
* <DL> * <DL>
* <DT> read <DD> read permission * <DT> read <DD> read permission
* <DT> write <DD> write permission * <DT> write <DD> write permission
...@@ -297,11 +297,11 @@ public final class FilePermission extends Permission implements Serializable { ...@@ -297,11 +297,11 @@ public final class FilePermission extends Permission implements Serializable {
/** /**
* Checks if this FilePermission object "implies" the specified permission. * Checks if this FilePermission object "implies" the specified permission.
* <P> * <P>
* More specifically, this method returns true if:<p> * More specifically, this method returns true if:
* <ul> * <ul>
* <li> <i>p</i> is an instanceof FilePermission,<p> * <li> <i>p</i> is an instanceof FilePermission,
* <li> <i>p</i>'s actions are a proper subset of this * <li> <i>p</i>'s actions are a proper subset of this
* object's actions, and <p> * object's actions, and
* <li> <i>p</i>'s pathname is implied by this object's * <li> <i>p</i>'s pathname is implied by this object's
* pathname. For example, "/tmp/*" implies "/tmp/foo", since * pathname. For example, "/tmp/*" implies "/tmp/foo", since
* "/tmp/*" encompasses all files in the "/tmp" directory, * "/tmp/*" encompasses all files in the "/tmp" directory,
......
...@@ -34,7 +34,6 @@ import java.io.IOException; ...@@ -34,7 +34,6 @@ import java.io.IOException;
* *
* @since 1.5 * @since 1.5
*/ */
@FunctionalInterface
public interface Flushable { public interface Flushable {
/** /**
......
...@@ -306,8 +306,7 @@ public abstract class InputStream implements Closeable { ...@@ -306,8 +306,7 @@ public abstract class InputStream implements Closeable {
* *
* <p> The general contract of <code>reset</code> is: * <p> The general contract of <code>reset</code> is:
* *
* <p><ul> * <ul>
*
* <li> If the method <code>markSupported</code> returns * <li> If the method <code>markSupported</code> returns
* <code>true</code>, then: * <code>true</code>, then:
* *
......
...@@ -109,7 +109,7 @@ import sun.reflect.misc.ReflectUtil; ...@@ -109,7 +109,7 @@ import sun.reflect.misc.ReflectUtil;
* *
* <p>Serializable classes that require special handling during the * <p>Serializable classes that require special handling during the
* serialization and deserialization process should implement the following * serialization and deserialization process should implement the following
* methods:<p> * methods:
* *
* <pre> * <pre>
* private void writeObject(java.io.ObjectOutputStream stream) * private void writeObject(java.io.ObjectOutputStream stream)
......
...@@ -172,15 +172,14 @@ public class PipedInputStream extends InputStream { ...@@ -172,15 +172,14 @@ public class PipedInputStream extends InputStream {
* unconnected piped output stream and <code>snk</code> * unconnected piped output stream and <code>snk</code>
* is an unconnected piped input stream, they * is an unconnected piped input stream, they
* may be connected by either the call: * may be connected by either the call:
* <p> *
* <pre><code>snk.connect(src)</code> </pre> * <pre><code>snk.connect(src)</code> </pre>
* <p> * <p>
* or the call: * or the call:
* <p> *
* <pre><code>src.connect(snk)</code> </pre> * <pre><code>src.connect(snk)</code> </pre>
* <p> * <p>
* The two * The two calls have the same effect.
* calls have the same effect.
* *
* @param src The piped output stream to connect to. * @param src The piped output stream to connect to.
* @exception IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
......
...@@ -145,15 +145,14 @@ public class PipedReader extends Reader { ...@@ -145,15 +145,14 @@ public class PipedReader extends Reader {
* unconnected piped writer and <code>snk</code> * unconnected piped writer and <code>snk</code>
* is an unconnected piped reader, they * is an unconnected piped reader, they
* may be connected by either the call: * may be connected by either the call:
* <p> *
* <pre><code>snk.connect(src)</code> </pre> * <pre><code>snk.connect(src)</code> </pre>
* <p> * <p>
* or the call: * or the call:
* <p> *
* <pre><code>src.connect(snk)</code> </pre> * <pre><code>src.connect(snk)</code> </pre>
* <p> * <p>
* The two * The two calls have the same effect.
* calls have the same effect.
* *
* @param src The piped writer to connect to. * @param src The piped writer to connect to.
* @exception IOException if an I/O error occurs. * @exception IOException if an I/O error occurs.
......
...@@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { ...@@ -784,7 +784,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* </pre></blockquote> * </pre></blockquote>
* <p> * <p>
* then the result is equal to: * then the result is equal to:
* <p><blockquote><pre> * <blockquote><pre>
* ((long)b1 &lt;&lt; 56) + ((long)b2 &lt;&lt; 48) * ((long)b1 &lt;&lt; 56) + ((long)b2 &lt;&lt; 48)
* + ((long)b3 &lt;&lt; 40) + ((long)b4 &lt;&lt; 32) * + ((long)b3 &lt;&lt; 40) + ((long)b4 &lt;&lt; 32)
* + ((long)b5 &lt;&lt; 24) + ((long)b6 &lt;&lt; 16) * + ((long)b5 &lt;&lt; 24) + ((long)b6 &lt;&lt; 16)
......
...@@ -55,7 +55,7 @@ package java.io; ...@@ -55,7 +55,7 @@ package java.io;
* *
* Classes that require special handling during the serialization and * Classes that require special handling during the serialization and
* deserialization process must implement special methods with these exact * deserialization process must implement special methods with these exact
* signatures: <p> * signatures:
* *
* <PRE> * <PRE>
* private void writeObject(java.io.ObjectOutputStream out) * private void writeObject(java.io.ObjectOutputStream out)
...@@ -101,7 +101,7 @@ package java.io; ...@@ -101,7 +101,7 @@ package java.io;
* *
* <p>Serializable classes that need to designate an alternative object to be * <p>Serializable classes that need to designate an alternative object to be
* used when writing an object to the stream should implement this * used when writing an object to the stream should implement this
* special method with the exact signature: <p> * special method with the exact signature:
* *
* <PRE> * <PRE>
* ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException; * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
...@@ -115,7 +115,7 @@ package java.io; ...@@ -115,7 +115,7 @@ package java.io;
* *
* Classes that need to designate a replacement when an instance of it * Classes that need to designate a replacement when an instance of it
* is read from the stream should implement this special method with the * is read from the stream should implement this special method with the
* exact signature.<p> * exact signature.
* *
* <PRE> * <PRE>
* ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException; * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
...@@ -133,7 +133,7 @@ package java.io; ...@@ -133,7 +133,7 @@ package java.io;
* deserialization will result in an {@link InvalidClassException}. A * deserialization will result in an {@link InvalidClassException}. A
* serializable class can declare its own serialVersionUID explicitly by * serializable class can declare its own serialVersionUID explicitly by
* declaring a field named <code>"serialVersionUID"</code> that must be static, * declaring a field named <code>"serialVersionUID"</code> that must be static,
* final, and of type <code>long</code>:<p> * final, and of type <code>long</code>:
* *
* <PRE> * <PRE>
* ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L; * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
......
...@@ -43,7 +43,6 @@ import java.util.StringTokenizer; ...@@ -43,7 +43,6 @@ import java.util.StringTokenizer;
* The following table lists all the possible SerializablePermission target names, * The following table lists all the possible SerializablePermission target names,
* and for each provides a description of what the permission allows * and for each provides a description of what the permission allows
* and a discussion of the risks of granting code the permission. * and a discussion of the risks of granting code the permission.
* <P>
* *
* <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks"> * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
* <tr> * <tr>
......
...@@ -330,9 +330,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -330,9 +330,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* characters to be copied is {@code srcEnd-srcBegin}. The * characters to be copied is {@code srcEnd-srcBegin}. The
* characters are copied into the subarray of {@code dst} starting * characters are copied into the subarray of {@code dst} starting
* at index {@code dstBegin} and ending at index: * at index {@code dstBegin} and ending at index:
* <p><blockquote><pre> * <pre>{@code
* dstbegin + (srcEnd-srcBegin) - 1 * dstbegin + (srcEnd-srcBegin) - 1
* </pre></blockquote> * }</pre>
* *
* @param srcBegin start copying at this offset. * @param srcBegin start copying at this offset.
* @param srcEnd stop copying at this offset. * @param srcEnd stop copying at this offset.
...@@ -859,16 +859,16 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -859,16 +859,16 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* *
* <p> An invocation of this method of the form * <p> An invocation of this method of the form
* *
* <blockquote><pre> * <pre>{@code
* sb.subSequence(begin,&nbsp;end)</pre></blockquote> * sb.subSequence(begin,&nbsp;end)}</pre>
* *
* behaves in exactly the same way as the invocation * behaves in exactly the same way as the invocation
* *
* <blockquote><pre> * <pre>{@code
* sb.substring(begin,&nbsp;end)</pre></blockquote> * sb.substring(begin,&nbsp;end)}</pre>
* *
* This method is provided so that this class can * This method is provided so that this class can
* implement the {@link CharSequence} interface. </p> * implement the {@link CharSequence} interface.
* *
* @param start the start index, inclusive. * @param start the start index, inclusive.
* @param end the end index, exclusive. * @param end the end index, exclusive.
...@@ -1287,9 +1287,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -1287,9 +1287,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Returns the index within this string of the first occurrence of the * Returns the index within this string of the first occurrence of the
* specified substring. The integer returned is the smallest value * specified substring. The integer returned is the smallest value
* <i>k</i> such that: * <i>k</i> such that:
* <blockquote><pre> * <pre>{@code
* this.toString().startsWith(str, <i>k</i>) * this.toString().startsWith(str, <i>k</i>)
* </pre></blockquote> * }</pre>
* is {@code true}. * is {@code true}.
* *
* @param str any string. * @param str any string.
...@@ -1306,10 +1306,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -1306,10 +1306,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Returns the index within this string of the first occurrence of the * Returns the index within this string of the first occurrence of the
* specified substring, starting at the specified index. The integer * specified substring, starting at the specified index. The integer
* returned is the smallest value {@code k} for which: * returned is the smallest value {@code k} for which:
* <blockquote><pre> * <pre>{@code
* k >= Math.min(fromIndex, this.length()) && * k >= Math.min(fromIndex, this.length()) &&
* this.toString().startsWith(str, k) * this.toString().startsWith(str, k)
* </pre></blockquote> * }</pre>
* If no such value of <i>k</i> exists, then -1 is returned. * If no such value of <i>k</i> exists, then -1 is returned.
* *
* @param str the substring for which to search. * @param str the substring for which to search.
...@@ -1326,9 +1326,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -1326,9 +1326,9 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* of the specified substring. The rightmost empty string "" is * of the specified substring. The rightmost empty string "" is
* considered to occur at the index value {@code this.length()}. * considered to occur at the index value {@code this.length()}.
* The returned index is the largest value <i>k</i> such that * The returned index is the largest value <i>k</i> such that
* <blockquote><pre> * <pre>{@code
* this.toString().startsWith(str, k) * this.toString().startsWith(str, k)
* </pre></blockquote> * }</pre>
* is true. * is true.
* *
* @param str the substring to search for. * @param str the substring to search for.
...@@ -1345,10 +1345,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { ...@@ -1345,10 +1345,10 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
* Returns the index within this string of the last occurrence of the * Returns the index within this string of the last occurrence of the
* specified substring. The integer returned is the largest value <i>k</i> * specified substring. The integer returned is the largest value <i>k</i>
* such that: * such that:
* <blockquote><pre> * <pre>{@code
* k <= Math.min(fromIndex, this.length()) && * k <= Math.min(fromIndex, this.length()) &&
* this.toString().startsWith(str, k) * this.toString().startsWith(str, k)
* </pre></blockquote> * }</pre>
* If no such value of <i>k</i> exists, then -1 is returned. * If no such value of <i>k</i> exists, then -1 is returned.
* *
* @param str the substring to search for. * @param str the substring to search for.
......
...@@ -29,7 +29,7 @@ package java.lang; ...@@ -29,7 +29,7 @@ package java.lang;
* Thrown to indicate that an attempt has been made to store the * Thrown to indicate that an attempt has been made to store the
* wrong type of object into an array of objects. For example, the * wrong type of object into an array of objects. For example, the
* following code generates an <code>ArrayStoreException</code>: * following code generates an <code>ArrayStoreException</code>:
* <p><blockquote><pre> * <blockquote><pre>
* Object x[] = new String[3]; * Object x[] = new String[3];
* x[0] = new Integer(0); * x[0] = new Integer(0);
* </pre></blockquote> * </pre></blockquote>
......
...@@ -48,7 +48,6 @@ package java.lang; ...@@ -48,7 +48,6 @@ package java.lang;
* @author Josh Bloch * @author Josh Bloch
* @since 1.7 * @since 1.7
*/ */
@FunctionalInterface
public interface AutoCloseable { public interface AutoCloseable {
/** /**
* Closes this resource, relinquishing any underlying resources. * Closes this resource, relinquishing any underlying resources.
......
...@@ -244,7 +244,7 @@ public final class Byte extends Number implements Comparable<Byte> { ...@@ -244,7 +244,7 @@ public final class Byte extends Number implements Comparable<Byte> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p> *
* <dt><i>Sign:</i> * <dt><i>Sign:</i>
* <dd>{@code -} * <dd>{@code -}
* <dd>{@code +} * <dd>{@code +}
......
...@@ -5394,7 +5394,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5394,7 +5394,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* Other_Lowercase as defined by the Unicode Standard. * Other_Lowercase as defined by the Unicode Standard.
* <p> * <p>
* The following are examples of lowercase characters: * The following are examples of lowercase characters:
* <p><blockquote><pre> * <blockquote><pre>
* a b c d e f g h i j k l m n o p q r s t u v w x y z * a b c d e f g h i j k l m n o p q r s t u v w x y z
* '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6' * '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6'
* '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE' * '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE'
...@@ -5430,7 +5430,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5430,7 +5430,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* Other_Lowercase as defined by the Unicode Standard. * Other_Lowercase as defined by the Unicode Standard.
* <p> * <p>
* The following are examples of lowercase characters: * The following are examples of lowercase characters:
* <p><blockquote><pre> * <blockquote><pre>
* a b c d e f g h i j k l m n o p q r s t u v w x y z * a b c d e f g h i j k l m n o p q r s t u v w x y z
* '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6' * '&#92;u00DF' '&#92;u00E0' '&#92;u00E1' '&#92;u00E2' '&#92;u00E3' '&#92;u00E4' '&#92;u00E5' '&#92;u00E6'
* '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE' * '&#92;u00E7' '&#92;u00E8' '&#92;u00E9' '&#92;u00EA' '&#92;u00EB' '&#92;u00EC' '&#92;u00ED' '&#92;u00EE'
...@@ -5461,14 +5461,14 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5461,14 +5461,14 @@ class Character implements java.io.Serializable, Comparable<Character> {
* or it has contributory property Other_Uppercase as defined by the Unicode Standard. * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
* <p> * <p>
* The following are examples of uppercase characters: * The following are examples of uppercase characters:
* <p><blockquote><pre> * <blockquote><pre>
* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
* '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7' * '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7'
* '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF' * '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF'
* '&#92;u00D0' '&#92;u00D1' '&#92;u00D2' '&#92;u00D3' '&#92;u00D4' '&#92;u00D5' '&#92;u00D6' '&#92;u00D8' * '&#92;u00D0' '&#92;u00D1' '&#92;u00D2' '&#92;u00D3' '&#92;u00D4' '&#92;u00D5' '&#92;u00D6' '&#92;u00D8'
* '&#92;u00D9' '&#92;u00DA' '&#92;u00DB' '&#92;u00DC' '&#92;u00DD' '&#92;u00DE' * '&#92;u00D9' '&#92;u00DA' '&#92;u00DB' '&#92;u00DC' '&#92;u00DD' '&#92;u00DE'
* </pre></blockquote> * </pre></blockquote>
* <p> Many other Unicode characters are uppercase too.<p> * <p> Many other Unicode characters are uppercase too.
* *
* <p><b>Note:</b> This method cannot handle <a * <p><b>Note:</b> This method cannot handle <a
* href="#supplementary"> supplementary characters</a>. To support * href="#supplementary"> supplementary characters</a>. To support
...@@ -5496,7 +5496,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5496,7 +5496,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* or it has contributory property Other_Uppercase as defined by the Unicode Standard. * or it has contributory property Other_Uppercase as defined by the Unicode Standard.
* <p> * <p>
* The following are examples of uppercase characters: * The following are examples of uppercase characters:
* <p><blockquote><pre> * <blockquote><pre>
* A B C D E F G H I J K L M N O P Q R S T U V W X Y Z * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
* '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7' * '&#92;u00C0' '&#92;u00C1' '&#92;u00C2' '&#92;u00C3' '&#92;u00C4' '&#92;u00C5' '&#92;u00C6' '&#92;u00C7'
* '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF' * '&#92;u00C8' '&#92;u00C9' '&#92;u00CA' '&#92;u00CB' '&#92;u00CC' '&#92;u00CD' '&#92;u00CE' '&#92;u00CF'
...@@ -5540,7 +5540,7 @@ class Character implements java.io.Serializable, Comparable<Character> { ...@@ -5540,7 +5540,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J} * <li>{@code LATIN CAPITAL LETTER N WITH SMALL LETTER J}
* <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z} * <li>{@code LATIN CAPITAL LETTER D WITH SMALL LETTER Z}
* </ul> * </ul>
* <p> Many other Unicode characters are titlecase too.<p> * <p> Many other Unicode characters are titlecase too.
* *
* <p><b>Note:</b> This method cannot handle <a * <p><b>Note:</b> This method cannot handle <a
* href="#supplementary"> supplementary characters</a>. To support * href="#supplementary"> supplementary characters</a>. To support
......
...@@ -91,7 +91,7 @@ import sun.reflect.misc.ReflectUtil; ...@@ -91,7 +91,7 @@ import sun.reflect.misc.ReflectUtil;
* <p> The following example uses a {@code Class} object to print the * <p> The following example uses a {@code Class} object to print the
* class name of an object: * class name of an object:
* *
* <p> <blockquote><pre> * <blockquote><pre>
* void printClassName(Object obj) { * void printClassName(Object obj) {
* System.out.println("The class of " + obj + * System.out.println("The class of " + obj +
* " is " + obj.getClass().getName()); * " is " + obj.getClass().getName());
...@@ -103,7 +103,7 @@ import sun.reflect.misc.ReflectUtil; ...@@ -103,7 +103,7 @@ import sun.reflect.misc.ReflectUtil;
* <cite>The Java&trade; Language Specification</cite>. * <cite>The Java&trade; Language Specification</cite>.
* For example: * For example:
* *
* <p> <blockquote> * <blockquote>
* {@code System.out.println("The name of class Foo is: "+Foo.class.getName());} * {@code System.out.println("The name of class Foo is: "+Foo.class.getName());}
* </blockquote> * </blockquote>
* *
...@@ -1571,6 +1571,10 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1571,6 +1571,10 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this {@code Class} object represents a primitive type or void, * <p> If this {@code Class} object represents a primitive type or void,
* then the returned array has length 0. * then the returned array has length 0.
* *
* <p> Static methods declared in superinterfaces of the class or interface
* represented by this {@code Class} object are not considered members of
* the class or interface.
*
* <p> The elements in the returned array are not sorted and are not in any * <p> The elements in the returned array are not sorted and are not in any
* particular order. * particular order.
* *
...@@ -1729,6 +1733,10 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1729,6 +1733,10 @@ public final class Class<T> implements java.io.Serializable,
* <p> If this {@code Class} object represents an array type, then this * <p> If this {@code Class} object represents an array type, then this
* method does not find the {@code clone()} method. * method does not find the {@code clone()} method.
* *
* <p> Static methods declared in superinterfaces of the class or interface
* represented by this {@code Class} object are not considered members of
* the class or interface.
*
* @param name the name of the method * @param name the name of the method
* @param parameterTypes the list of parameters * @param parameterTypes the list of parameters
* @return the {@code Method} object that matches the specified * @return the {@code Method} object that matches the specified
...@@ -1752,7 +1760,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -1752,7 +1760,7 @@ public final class Class<T> implements java.io.Serializable,
public Method getMethod(String name, Class<?>... parameterTypes) public Method getMethod(String name, Class<?>... parameterTypes)
throws NoSuchMethodException, SecurityException { throws NoSuchMethodException, SecurityException {
checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true); checkMemberAccess(Member.PUBLIC, Reflection.getCallerClass(), true);
Method method = getMethod0(name, parameterTypes); Method method = getMethod0(name, parameterTypes, true);
if (method == null) { if (method == null) {
throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes)); throw new NoSuchMethodException(getName() + "." + name + argumentTypesToString(parameterTypes));
} }
...@@ -2727,6 +2735,14 @@ public final class Class<T> implements java.io.Serializable, ...@@ -2727,6 +2735,14 @@ public final class Class<T> implements java.io.Serializable,
} }
} }
void addAllNonStatic(Method[] methods) {
for (Method candidate : methods) {
if (!Modifier.isStatic(candidate.getModifiers())) {
add(candidate);
}
}
}
int length() { int length() {
return length; return length;
} }
...@@ -2797,7 +2813,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -2797,7 +2813,7 @@ public final class Class<T> implements java.io.Serializable,
MethodArray inheritedMethods = new MethodArray(); MethodArray inheritedMethods = new MethodArray();
Class<?>[] interfaces = getInterfaces(); Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) { for (int i = 0; i < interfaces.length; i++) {
inheritedMethods.addAll(interfaces[i].privateGetPublicMethods()); inheritedMethods.addAllNonStatic(interfaces[i].privateGetPublicMethods());
} }
if (!isInterface()) { if (!isInterface()) {
Class<?> c = getSuperclass(); Class<?> c = getSuperclass();
...@@ -2900,7 +2916,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -2900,7 +2916,7 @@ public final class Class<T> implements java.io.Serializable,
} }
private Method getMethod0(String name, Class<?>[] parameterTypes) { private Method getMethod0(String name, Class<?>[] parameterTypes, boolean includeStaticMethods) {
// Note: the intent is that the search algorithm this routine // Note: the intent is that the search algorithm this routine
// uses be equivalent to the ordering imposed by // uses be equivalent to the ordering imposed by
// privateGetPublicMethods(). It fetches only the declared // privateGetPublicMethods(). It fetches only the declared
...@@ -2913,25 +2929,23 @@ public final class Class<T> implements java.io.Serializable, ...@@ -2913,25 +2929,23 @@ public final class Class<T> implements java.io.Serializable,
if ((res = searchMethods(privateGetDeclaredMethods(true), if ((res = searchMethods(privateGetDeclaredMethods(true),
name, name,
parameterTypes)) != null) { parameterTypes)) != null) {
if (includeStaticMethods || !Modifier.isStatic(res.getModifiers()))
return res; return res;
} }
// Search superclass's methods // Search superclass's methods
if (!isInterface()) { if (!isInterface()) {
Class<? super T> c = getSuperclass(); Class<? super T> c = getSuperclass();
if (c != null) { if (c != null) {
if ((res = c.getMethod0(name, parameterTypes)) != null) { if ((res = c.getMethod0(name, parameterTypes, true)) != null) {
return res; return res;
} }
} }
} }
// Search superinterfaces' methods // Search superinterfaces' methods
Class<?>[] interfaces = getInterfaces(); Class<?>[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++) { for (Class<?> c : interfaces)
Class<?> c = interfaces[i]; if ((res = c.getMethod0(name, parameterTypes, false)) != null)
if ((res = c.getMethod0(name, parameterTypes)) != null) {
return res; return res;
}
}
// Not found // Not found
return null; return null;
} }
...@@ -3300,7 +3314,10 @@ public final class Class<T> implements java.io.Serializable, ...@@ -3300,7 +3314,10 @@ public final class Class<T> implements java.io.Serializable,
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationClass) { public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationClass) {
Objects.requireNonNull(annotationClass); Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(annotationData().annotations, annotationClass); AnnotationData annotationData = annotationData();
return AnnotationSupport.getAssociatedAnnotations(annotationData.declaredAnnotations,
this,
annotationClass);
} }
/** /**
...@@ -3330,7 +3347,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -3330,7 +3347,8 @@ public final class Class<T> implements java.io.Serializable,
public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationClass) { public <A extends Annotation> A[] getDeclaredAnnotationsByType(Class<A> annotationClass) {
Objects.requireNonNull(annotationClass); Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(annotationData().declaredAnnotations, annotationClass); return AnnotationSupport.getDirectlyAndIndirectlyPresent(annotationData().declaredAnnotations,
annotationClass);
} }
/** /**
...@@ -3424,6 +3442,10 @@ public final class Class<T> implements java.io.Serializable, ...@@ -3424,6 +3442,10 @@ public final class Class<T> implements java.io.Serializable,
return annotationType; return annotationType;
} }
Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap() {
return annotationData().declaredAnnotations;
}
/* Backing store of user-defined values pertaining to this class. /* Backing store of user-defined values pertaining to this class.
* Maintained by the ClassValue class. * Maintained by the ClassValue class.
*/ */
......
...@@ -29,7 +29,7 @@ package java.lang; ...@@ -29,7 +29,7 @@ package java.lang;
* Thrown to indicate that the code has attempted to cast an object * Thrown to indicate that the code has attempted to cast an object
* to a subclass of which it is not an instance. For example, the * to a subclass of which it is not an instance. For example, the
* following code generates a <code>ClassCastException</code>: * following code generates a <code>ClassCastException</code>:
* <p><blockquote><pre> * <blockquote><pre>
* Object x = new Integer(0); * Object x = new Integer(0);
* System.out.println((String)x); * System.out.println((String)x);
* </pre></blockquote> * </pre></blockquote>
......
...@@ -362,7 +362,7 @@ public abstract class ClassLoader { ...@@ -362,7 +362,7 @@ public abstract class ClassLoader {
* default implementation of this method searches for classes in the * default implementation of this method searches for classes in the
* following order: * following order:
* *
* <p><ol> * <ol>
* *
* <li><p> Invoke {@link #findLoadedClass(String)} to check if the class * <li><p> Invoke {@link #findLoadedClass(String)} to check if the class
* has already been loaded. </p></li> * has already been loaded. </p></li>
...@@ -488,7 +488,7 @@ public abstract class ClassLoader { ...@@ -488,7 +488,7 @@ public abstract class ClassLoader {
final SecurityManager sm = System.getSecurityManager(); final SecurityManager sm = System.getSecurityManager();
if (sm != null) { if (sm != null) {
if (ReflectUtil.isNonPublicProxyClass(cls)) { if (ReflectUtil.isNonPublicProxyClass(cls)) {
for (Class intf: cls.getInterfaces()) { for (Class<?> intf: cls.getInterfaces()) {
checkPackageAccess(intf, pd); checkPackageAccess(intf, pd);
} }
return; return;
......
...@@ -692,7 +692,7 @@ public abstract class ClassValue<T> { ...@@ -692,7 +692,7 @@ public abstract class ClassValue<T> {
/** Remove all stale entries, everywhere. */ /** Remove all stale entries, everywhere. */
private void removeStaleEntries() { private void removeStaleEntries() {
Entry[] cache = getCache(); Entry<?>[] cache = getCache();
removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1); removeStaleEntries(cache, 0, cache.length + PROBE_LIMIT - 1);
} }
......
...@@ -93,7 +93,6 @@ import java.util.*; ...@@ -93,7 +93,6 @@ import java.util.*;
* @see java.util.Comparator * @see java.util.Comparator
* @since 1.2 * @since 1.2
*/ */
@FunctionalInterface
public interface Comparable<T> { public interface Comparable<T> {
/** /**
* Compares this object with the specified object for order. Returns a * Compares this object with the specified object for order. Returns a
......
...@@ -74,7 +74,6 @@ final class ConditionalSpecialCasing { ...@@ -74,7 +74,6 @@ final class ConditionalSpecialCasing {
new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE new Entry(0x00CC, new char[]{0x0069, 0x0307, 0x0300}, new char[]{0x00CC}, "lt", 0), // # LATIN CAPITAL LETTER I WITH GRAVE
new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE new Entry(0x00CD, new char[]{0x0069, 0x0307, 0x0301}, new char[]{0x00CD}, "lt", 0), // # LATIN CAPITAL LETTER I WITH ACUTE
new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE new Entry(0x0128, new char[]{0x0069, 0x0307, 0x0303}, new char[]{0x0128}, "lt", 0), // # LATIN CAPITAL LETTER I WITH TILDE
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "lt", 0), // # LATIN CAPITAL LETTER I WITH DOT ABOVE
//# ================================================================================ //# ================================================================================
//# Turkish and Azeri //# Turkish and Azeri
...@@ -85,10 +84,7 @@ final class ConditionalSpecialCasing { ...@@ -85,10 +84,7 @@ final class ConditionalSpecialCasing {
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "tr", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I new Entry(0x0049, new char[]{0x0131}, new char[]{0x0049}, "az", NOT_BEFORE_DOT), // # LATIN CAPITAL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "tr", 0), // # LATIN SMALL LETTER I
new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0), // # LATIN SMALL LETTER I new Entry(0x0069, new char[]{0x0069}, new char[]{0x0130}, "az", 0) // # LATIN SMALL LETTER I
//# ================================================================================
//# Other
new Entry(0x0130, new char[]{0x0069, 0x0307}, new char[]{0x0130}, "en", 0), // # LATIN CAPITALLETTER I WITH DOT ABOVE
}; };
// A hash table that contains the above entries // A hash table that contains the above entries
......
...@@ -361,15 +361,11 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -361,15 +361,11 @@ public final class Double extends Number implements Comparable<Double> {
* <dd><i>SignedInteger</i> * <dd><i>SignedInteger</i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>HexFloatingPointLiteral</i>: * <dt><i>HexFloatingPointLiteral</i>:
* <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i> * <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>HexSignificand:</i> * <dt><i>HexSignificand:</i>
* <dd><i>HexNumeral</i> * <dd><i>HexNumeral</i>
...@@ -380,15 +376,11 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -380,15 +376,11 @@ public final class Double extends Number implements Comparable<Double> {
* </i>{@code .} <i>HexDigits</i> * </i>{@code .} <i>HexDigits</i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>BinaryExponent:</i> * <dt><i>BinaryExponent:</i>
* <dd><i>BinaryExponentIndicator SignedInteger</i> * <dd><i>BinaryExponentIndicator SignedInteger</i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>BinaryExponentIndicator:</i> * <dt><i>BinaryExponentIndicator:</i>
* <dd>{@code p} * <dd>{@code p}
......
...@@ -321,15 +321,11 @@ public final class Float extends Number implements Comparable<Float> { ...@@ -321,15 +321,11 @@ public final class Float extends Number implements Comparable<Float> {
* <dd><i>SignedInteger</i> * <dd><i>SignedInteger</i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>HexFloatingPointLiteral</i>: * <dt><i>HexFloatingPointLiteral</i>:
* <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i> * <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>HexSignificand:</i> * <dt><i>HexSignificand:</i>
* <dd><i>HexNumeral</i> * <dd><i>HexNumeral</i>
...@@ -340,15 +336,11 @@ public final class Float extends Number implements Comparable<Float> { ...@@ -340,15 +336,11 @@ public final class Float extends Number implements Comparable<Float> {
* </i>{@code .} <i>HexDigits</i> * </i>{@code .} <i>HexDigits</i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>BinaryExponent:</i> * <dt><i>BinaryExponent:</i>
* <dd><i>BinaryExponentIndicator SignedInteger</i> * <dd><i>BinaryExponentIndicator SignedInteger</i>
* </dl> * </dl>
* *
* <p>
*
* <dl> * <dl>
* <dt><i>BinaryExponentIndicator:</i> * <dt><i>BinaryExponentIndicator:</i>
* <dd>{@code p} * <dd>{@code p}
......
...@@ -1123,7 +1123,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1123,7 +1123,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p> *
* <dt><i>Sign:</i> * <dt><i>Sign:</i>
* <dd>{@code -} * <dd>{@code -}
* <dd>{@code +} * <dd>{@code +}
......
...@@ -42,7 +42,6 @@ import java.util.function.Consumer; ...@@ -42,7 +42,6 @@ import java.util.function.Consumer;
* @since 1.5 * @since 1.5
* @jls 14.14.2 The enhanced for statement * @jls 14.14.2 The enhanced for statement
*/ */
@FunctionalInterface
public interface Iterable<T> { public interface Iterable<T> {
/** /**
* Returns an iterator over elements of type {@code T}. * Returns an iterator over elements of type {@code T}.
...@@ -52,10 +51,12 @@ public interface Iterable<T> { ...@@ -52,10 +51,12 @@ public interface Iterable<T> {
Iterator<T> iterator(); Iterator<T> iterator();
/** /**
* Performs the given action on the contents of the {@code Iterable}, in the * Performs the given action for each element of the {@code Iterable}
* order elements occur when iterating, until all elements have been * until all elements have been processed or the action throws an
* processed or the action throws an exception. Errors or runtime * exception. Unless otherwise specified by the implementing class,
* exceptions thrown by the action are relayed to the caller. * actions are performed in the order of iteration (if an iteration order
* is specified). Exceptions thrown by the action are relayed to the
* caller.
* *
* @implSpec * @implSpec
* <p>The default implementation behaves as if: * <p>The default implementation behaves as if:
...@@ -100,4 +101,3 @@ public interface Iterable<T> { ...@@ -100,4 +101,3 @@ public interface Iterable<T> {
return Spliterators.spliteratorUnknownSize(iterator(), 0); return Spliterators.spliteratorUnknownSize(iterator(), 0);
} }
} }
...@@ -853,7 +853,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -853,7 +853,7 @@ public final class Long extends Number implements Comparable<Long> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p> *
* <dt><i>Sign:</i> * <dt><i>Sign:</i>
* <dd>{@code -} * <dd>{@code -}
* <dd>{@code +} * <dd>{@code +}
......
...@@ -34,7 +34,6 @@ import java.io.IOException; ...@@ -34,7 +34,6 @@ import java.io.IOException;
* *
* @since 1.5 * @since 1.5
*/ */
@FunctionalInterface
public interface Readable { public interface Readable {
/** /**
......
...@@ -47,7 +47,6 @@ import java.util.StringTokenizer; ...@@ -47,7 +47,6 @@ import java.util.StringTokenizer;
* The following table lists all the possible RuntimePermission target names, * The following table lists all the possible RuntimePermission target names,
* and for each provides a description of what the permission allows * and for each provides a description of what the permission allows
* and a discussion of the risks of granting code the permission. * and a discussion of the risks of granting code the permission.
* <P>
* *
* <table border=1 cellpadding=5 summary="permission target name, * <table border=1 cellpadding=5 summary="permission target name,
* what the target allows,and associated risks"> * what the target allows,and associated risks">
......
...@@ -56,7 +56,7 @@ import sun.security.util.SecurityConstants; ...@@ -56,7 +56,7 @@ import sun.security.util.SecurityConstants;
* are called by various methods in the Java libraries before those * are called by various methods in the Java libraries before those
* methods perform certain potentially sensitive operations. The * methods perform certain potentially sensitive operations. The
* invocation of such a <code>check</code> method typically looks like this: * invocation of such a <code>check</code> method typically looks like this:
* <p><blockquote><pre> * <blockquote><pre>
* SecurityManager security = System.getSecurityManager(); * SecurityManager security = System.getSecurityManager();
* if (security != null) { * if (security != null) {
* security.check<i>XXX</i>(argument, &nbsp;.&nbsp;.&nbsp;.&nbsp;); * security.check<i>XXX</i>(argument, &nbsp;.&nbsp;.&nbsp;.&nbsp;);
...@@ -323,7 +323,7 @@ class SecurityManager { ...@@ -323,7 +323,7 @@ class SecurityManager {
* by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
* <p> * <p>
* This method will return * This method will return
* <code>null</code> in the following three cases:<p> * <code>null</code> in the following three cases:
* <ol> * <ol>
* <li>All methods on the execution stack are from classes * <li>All methods on the execution stack are from classes
* defined using the system class loader or one of its ancestors. * defined using the system class loader or one of its ancestors.
...@@ -370,7 +370,7 @@ class SecurityManager { ...@@ -370,7 +370,7 @@ class SecurityManager {
* by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
* <p> * <p>
* This method will return * This method will return
* <code>null</code> in the following three cases:<p> * <code>null</code> in the following three cases:
* <ol> * <ol>
* <li>All methods on the execution stack are from classes * <li>All methods on the execution stack are from classes
* defined using the system class loader or one of its ancestors. * defined using the system class loader or one of its ancestors.
...@@ -429,7 +429,7 @@ class SecurityManager { ...@@ -429,7 +429,7 @@ class SecurityManager {
* by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. * by {@link ClassLoader#getSystemClassLoader}) or one of its ancestors.
* <p> * <p>
* This method will return * This method will return
* -1 in the following three cases:<p> * -1 in the following three cases:
* <ol> * <ol>
* <li>All methods on the execution stack are from classes * <li>All methods on the execution stack are from classes
* defined using the system class loader or one of its ancestors. * defined using the system class loader or one of its ancestors.
...@@ -1281,7 +1281,6 @@ class SecurityManager { ...@@ -1281,7 +1281,6 @@ class SecurityManager {
* This method calls <code>checkPermission</code> with the * This method calls <code>checkPermission</code> with the
* <code>PropertyPermission(key, "read")</code> permission. * <code>PropertyPermission(key, "read")</code> permission.
* <p> * <p>
* <p>
* If you override this method, then you should make a call to * If you override this method, then you should make a call to
* <code>super.checkPropertyAccess</code> * <code>super.checkPropertyAccess</code>
* at the point the overridden method would normally throw an * at the point the overridden method would normally throw an
...@@ -1714,7 +1713,7 @@ class SecurityManager { ...@@ -1714,7 +1713,7 @@ class SecurityManager {
throw new NullPointerException("class can't be null"); throw new NullPointerException("class can't be null");
} }
if (which != Member.PUBLIC) { if (which != Member.PUBLIC) {
Class stack[] = getClassContext(); Class<?> stack[] = getClassContext();
/* /*
* stack depth of 4 should be the caller of one of the * stack depth of 4 should be the caller of one of the
* methods in java.lang.Class that invoke checkMember * methods in java.lang.Class that invoke checkMember
......
...@@ -249,7 +249,7 @@ public final class Short extends Number implements Comparable<Short> { ...@@ -249,7 +249,7 @@ public final class Short extends Number implements Comparable<Short> {
* <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0X} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code #} <i>HexDigits</i>
* <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i> * <dd><i>Sign<sub>opt</sub></i> {@code 0} <i>OctalDigits</i>
* <p> *
* <dt><i>Sign:</i> * <dt><i>Sign:</i>
* <dd>{@code -} * <dd>{@code -}
* <dd>{@code +} * <dd>{@code +}
......
...@@ -47,16 +47,16 @@ import java.util.regex.PatternSyntaxException; ...@@ -47,16 +47,16 @@ import java.util.regex.PatternSyntaxException;
* Strings are constant; their values cannot be changed after they * Strings are constant; their values cannot be changed after they
* are created. String buffers support mutable strings. * are created. String buffers support mutable strings.
* Because String objects are immutable they can be shared. For example: * Because String objects are immutable they can be shared. For example:
* <p><blockquote><pre> * <blockquote><pre>
* String str = "abc"; * String str = "abc";
* </pre></blockquote><p> * </pre></blockquote><p>
* is equivalent to: * is equivalent to:
* <p><blockquote><pre> * <blockquote><pre>
* char data[] = {'a', 'b', 'c'}; * char data[] = {'a', 'b', 'c'};
* String str = new String(data); * String str = new String(data);
* </pre></blockquote><p> * </pre></blockquote><p>
* Here are some more examples of how strings can be used: * Here are some more examples of how strings can be used:
* <p><blockquote><pre> * <blockquote><pre>
* System.out.println("abc"); * System.out.println("abc");
* String cde = "cde"; * String cde = "cde";
* System.out.println("abc" + cde); * System.out.println("abc" + cde);
...@@ -786,7 +786,7 @@ public final class String ...@@ -786,7 +786,7 @@ public final class String
* {@code srcEnd-srcBegin}). The characters are copied into the * {@code srcEnd-srcBegin}). The characters are copied into the
* subarray of {@code dst} starting at index {@code dstBegin} * subarray of {@code dst} starting at index {@code dstBegin}
* and ending at index: * and ending at index:
* <p><blockquote><pre> * <blockquote><pre>
* dstbegin + (srcEnd-srcBegin) - 1 * dstbegin + (srcEnd-srcBegin) - 1
* </pre></blockquote> * </pre></blockquote>
* *
...@@ -2598,21 +2598,14 @@ public final class String ...@@ -2598,21 +2598,14 @@ public final class String
} }
if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA if (localeDependent || srcChar == '\u03A3') { // GREEK CAPITAL LETTER SIGMA
lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale); lowerChar = ConditionalSpecialCasing.toLowerCaseEx(this, i, locale);
} else if (srcChar == '\u0130') { // LATIN CAPITAL LETTER I DOT
lowerChar = Character.ERROR;
} else { } else {
lowerChar = Character.toLowerCase(srcChar); lowerChar = Character.toLowerCase(srcChar);
} }
if ((lowerChar == Character.ERROR) if ((lowerChar == Character.ERROR)
|| (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) { || (lowerChar >= Character.MIN_SUPPLEMENTARY_CODE_POINT)) {
if (lowerChar == Character.ERROR) { if (lowerChar == Character.ERROR) {
if (!localeDependent && srcChar == '\u0130') {
lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, Locale.ENGLISH);
} else {
lowerCharArray = lowerCharArray =
ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale); ConditionalSpecialCasing.toLowerCaseCharArray(this, i, locale);
}
} else if (srcCount == 2) { } else if (srcCount == 2) {
resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount; resultOffset += Character.toChars(lowerChar, result, i + resultOffset) - srcCount;
continue; continue;
...@@ -2669,7 +2662,7 @@ public final class String ...@@ -2669,7 +2662,7 @@ public final class String
* {@code String} may be a different length than the original {@code String}. * {@code String} may be a different length than the original {@code String}.
* <p> * <p>
* Examples of locale-sensitive and 1:M case mappings are in the following table. * Examples of locale-sensitive and 1:M case mappings are in the following table.
* <p> *
* <table border="1" summary="Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description."> * <table border="1" summary="Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.">
* <tr> * <tr>
* <th>Language Code of Locale</th> * <th>Language Code of Locale</th>
......
...@@ -26,10 +26,12 @@ package java.lang; ...@@ -26,10 +26,12 @@ package java.lang;
import java.io.*; import java.io.*;
import java.lang.reflect.Executable; import java.lang.reflect.Executable;
import java.lang.annotation.Annotation;
import java.security.AccessControlContext; import java.security.AccessControlContext;
import java.util.Properties; import java.util.Properties;
import java.util.PropertyPermission; import java.util.PropertyPermission;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Map;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.AllPermission; import java.security.AllPermission;
...@@ -1227,6 +1229,9 @@ public final class System { ...@@ -1227,6 +1229,9 @@ public final class System {
public AnnotationType getAnnotationType(Class<?> klass) { public AnnotationType getAnnotationType(Class<?> klass) {
return klass.getAnnotationType(); return klass.getAnnotationType();
} }
public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass) {
return klass.getDeclaredAnnotationMap();
}
public byte[] getRawClassAnnotations(Class<?> klass) { public byte[] getRawClassAnnotations(Class<?> klass) {
return klass.getRawAnnotations(); return klass.getRawAnnotations();
} }
......
...@@ -76,7 +76,7 @@ import sun.security.util.SecurityConstants; ...@@ -76,7 +76,7 @@ import sun.security.util.SecurityConstants;
* <code>Thread</code>. An instance of the subclass can then be * <code>Thread</code>. An instance of the subclass can then be
* allocated and started. For example, a thread that computes primes * allocated and started. For example, a thread that computes primes
* larger than a stated value could be written as follows: * larger than a stated value could be written as follows:
* <p><hr><blockquote><pre> * <hr><blockquote><pre>
* class PrimeThread extends Thread { * class PrimeThread extends Thread {
* long minPrime; * long minPrime;
* PrimeThread(long minPrime) { * PrimeThread(long minPrime) {
...@@ -91,7 +91,7 @@ import sun.security.util.SecurityConstants; ...@@ -91,7 +91,7 @@ import sun.security.util.SecurityConstants;
* </pre></blockquote><hr> * </pre></blockquote><hr>
* <p> * <p>
* The following code would then create a thread and start it running: * The following code would then create a thread and start it running:
* <p><blockquote><pre> * <blockquote><pre>
* PrimeThread p = new PrimeThread(143); * PrimeThread p = new PrimeThread(143);
* p.start(); * p.start();
* </pre></blockquote> * </pre></blockquote>
...@@ -102,7 +102,7 @@ import sun.security.util.SecurityConstants; ...@@ -102,7 +102,7 @@ import sun.security.util.SecurityConstants;
* then be allocated, passed as an argument when creating * then be allocated, passed as an argument when creating
* <code>Thread</code>, and started. The same example in this other * <code>Thread</code>, and started. The same example in this other
* style looks like the following: * style looks like the following:
* <p><hr><blockquote><pre> * <hr><blockquote><pre>
* class PrimeRun implements Runnable { * class PrimeRun implements Runnable {
* long minPrime; * long minPrime;
* PrimeRun(long minPrime) { * PrimeRun(long minPrime) {
...@@ -117,7 +117,7 @@ import sun.security.util.SecurityConstants; ...@@ -117,7 +117,7 @@ import sun.security.util.SecurityConstants;
* </pre></blockquote><hr> * </pre></blockquote><hr>
* <p> * <p>
* The following code would then create a thread and start it running: * The following code would then create a thread and start it running:
* <p><blockquote><pre> * <blockquote><pre>
* PrimeRun p = new PrimeRun(143); * PrimeRun p = new PrimeRun(143);
* new Thread(p).start(); * new Thread(p).start();
* </pre></blockquote> * </pre></blockquote>
......
...@@ -101,7 +101,6 @@ import static sun.invoke.util.Wrapper.isWrapperType; ...@@ -101,7 +101,6 @@ import static sun.invoke.util.Wrapper.isWrapperType;
* should implement. * should implement.
* @param additionalBridges Method types for additional signatures to be * @param additionalBridges Method types for additional signatures to be
* bridged to the implementation method * bridged to the implementation method
* @throws ReflectiveOperationException
* @throws LambdaConversionException If any of the meta-factory protocol * @throws LambdaConversionException If any of the meta-factory protocol
* invariants are violated * invariants are violated
*/ */
...@@ -114,7 +113,7 @@ import static sun.invoke.util.Wrapper.isWrapperType; ...@@ -114,7 +113,7 @@ import static sun.invoke.util.Wrapper.isWrapperType;
boolean isSerializable, boolean isSerializable,
Class<?>[] markerInterfaces, Class<?>[] markerInterfaces,
MethodType[] additionalBridges) MethodType[] additionalBridges)
throws ReflectiveOperationException, LambdaConversionException { throws LambdaConversionException {
this.targetClass = caller.lookupClass(); this.targetClass = caller.lookupClass();
this.invokedType = invokedType; this.invokedType = invokedType;
...@@ -160,7 +159,7 @@ import static sun.invoke.util.Wrapper.isWrapperType; ...@@ -160,7 +159,7 @@ import static sun.invoke.util.Wrapper.isWrapperType;
* @throws ReflectiveOperationException * @throws ReflectiveOperationException
*/ */
abstract CallSite buildCallSite() abstract CallSite buildCallSite()
throws ReflectiveOperationException, LambdaConversionException; throws LambdaConversionException;
/** /**
* Check the meta-factory arguments for errors * Check the meta-factory arguments for errors
......
...@@ -441,8 +441,13 @@ class MethodHandleNatives { ...@@ -441,8 +441,13 @@ class MethodHandleNatives {
assert(refKindIsValid(refKind)); assert(refKindIsValid(refKind));
return lookup.linkMethodHandleConstant((byte) refKind, defc, name, type); return lookup.linkMethodHandleConstant((byte) refKind, defc, name, type);
} catch (IllegalAccessException ex) { } catch (IllegalAccessException ex) {
Throwable cause = ex.getCause();
if (cause instanceof AbstractMethodError) {
throw (AbstractMethodError) cause;
} else {
Error err = new IllegalAccessError(ex.getMessage()); Error err = new IllegalAccessError(ex.getMessage());
throw initCauseFrom(err, ex); throw initCauseFrom(err, ex);
}
} catch (NoSuchMethodException ex) { } catch (NoSuchMethodException ex) {
Error err = new NoSuchMethodError(ex.getMessage()); Error err = new NoSuchMethodError(ex.getMessage());
throw initCauseFrom(err, ex); throw initCauseFrom(err, ex);
......
...@@ -1716,6 +1716,13 @@ return mh1; ...@@ -1716,6 +1716,13 @@ return mh1;
checkSymbolicClass(defc); checkSymbolicClass(defc);
return mh; return mh;
} }
// Treat MethodHandle.invoke and invokeExact specially.
if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
mh = findVirtualForMH(member.getName(), member.getMethodType());
if (mh != null) {
return mh;
}
}
MemberName resolved = resolveOrFail(refKind, member); MemberName resolved = resolveOrFail(refKind, member);
mh = getDirectMethodForConstant(refKind, defc, resolved); mh = getDirectMethodForConstant(refKind, defc, resolved);
if (mh instanceof DirectMethodHandle if (mh instanceof DirectMethodHandle
...@@ -1768,12 +1775,6 @@ return mh1; ...@@ -1768,12 +1775,6 @@ return mh1;
if (MethodHandleNatives.refKindIsField(refKind)) { if (MethodHandleNatives.refKindIsField(refKind)) {
return getDirectFieldNoSecurityManager(refKind, defc, member); return getDirectFieldNoSecurityManager(refKind, defc, member);
} else if (MethodHandleNatives.refKindIsMethod(refKind)) { } else if (MethodHandleNatives.refKindIsMethod(refKind)) {
if (defc == MethodHandle.class && refKind == REF_invokeVirtual) {
MethodHandle mh = findVirtualForMH(member.getName(), member.getMethodType());
if (mh != null) {
return mh;
}
}
return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass); return getDirectMethodNoSecurityManager(refKind, defc, member, lookupClass);
} else if (refKind == REF_newInvokeSpecial) { } else if (refKind == REF_newInvokeSpecial) {
return getDirectConstructorNoSecurityManager(defc, member); return getDirectConstructorNoSecurityManager(defc, member);
......
...@@ -32,9 +32,26 @@ import java.security.PrivilegedExceptionAction; ...@@ -32,9 +32,26 @@ import java.security.PrivilegedExceptionAction;
import java.util.Objects; import java.util.Objects;
/** /**
* Serialized form of a lambda expression. The properties of this class represent the information that is present * Serialized form of a lambda expression. The properties of this class
* at the lambda factory site, including the identity of the primary functional interface method, the identity of the * represent the information that is present at the lambda factory site, including
* implementation method, and any variables captured from the local environment at the time of lambda capture. * static metafactory arguments such as the identity of the primary functional
* interface method and the identity of the implementation method, as well as
* dynamic metafactory arguments such as values captured from the lexical scope
* at the time of lambda capture.
*
* <p>Implementors of serializable lambdas, such as compilers or language
* runtime libraries, are expected to ensure that instances deserialize properly.
* One means to do so is to ensure that the {@code writeReplace} method returns
* an instance of {@code SerializedLambda}, rather than allowing default
* serialization to proceed.
*
* <p>{@code SerializedLambda} has a {@code readResolve} method that looks for
* a (possibly private) static method called
* {@code $deserializeLambda$(SerializedLambda)} in the capturing class, invokes
* that with itself as the first argument, and returns the result. Lambda classes
* implementing {@code $deserializeLambda$} are responsible for validating
* that the properties of the {@code SerializedLambda} are consistent with a
* lambda actually captured by that class.
* *
* @see LambdaMetafactory * @see LambdaMetafactory
*/ */
......
...@@ -28,6 +28,7 @@ package java.lang.invoke; ...@@ -28,6 +28,7 @@ package java.lang.invoke;
import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.org.objectweb.asm.Type; import jdk.internal.org.objectweb.asm.Type;
import sun.invoke.util.BytecodeDescriptor;
import sun.invoke.util.Wrapper; import sun.invoke.util.Wrapper;
import static sun.invoke.util.Wrapper.*; import static sun.invoke.util.Wrapper.*;
...@@ -204,27 +205,27 @@ class TypeConvertingMethodAdapter extends MethodVisitor { ...@@ -204,27 +205,27 @@ class TypeConvertingMethodAdapter extends MethodVisitor {
} }
/** /**
* Convert an argument of type 'argType' to be passed to 'targetType' assuring that it is 'functionalType'. * Convert an argument of type 'arg' to be passed to 'target' assuring that it is 'functional'.
* Insert the needed conversion instructions in the method code. * Insert the needed conversion instructions in the method code.
* @param argType * @param arg
* @param targetType * @param target
* @param functionalType * @param functional
*/ */
void convertType(String dArg, String dTarget, String dFunctional) { void convertType(Class<?> arg, Class<?> target, Class<?> functional) {
if (dArg.equals(dTarget)) { if (arg.equals(target)) {
return; return;
} }
Wrapper wArg = toWrapper(dArg); if (arg == Void.TYPE || target == Void.TYPE) {
Wrapper wTarget = toWrapper(dTarget);
if (wArg == VOID || wTarget == VOID) {
return; return;
} }
if (isPrimitive(wArg)) { if (arg.isPrimitive()) {
if (isPrimitive(wTarget)) { Wrapper wArg = Wrapper.forPrimitiveType(arg);
if (target.isPrimitive()) {
// Both primitives: widening // Both primitives: widening
widen(wArg, wTarget); widen(wArg, Wrapper.forPrimitiveType(target));
} else { } else {
// Primitive argument to reference target // Primitive argument to reference target
String dTarget = BytecodeDescriptor.unparse(target);
Wrapper wPrimTarget = wrapperOrNullFromDescriptor(dTarget); Wrapper wPrimTarget = wrapperOrNullFromDescriptor(dTarget);
if (wPrimTarget != null) { if (wPrimTarget != null) {
// The target is a boxed primitive type, widen to get there before boxing // The target is a boxed primitive type, widen to get there before boxing
...@@ -237,16 +238,18 @@ class TypeConvertingMethodAdapter extends MethodVisitor { ...@@ -237,16 +238,18 @@ class TypeConvertingMethodAdapter extends MethodVisitor {
} }
} }
} else { } else {
String dArg = BytecodeDescriptor.unparse(arg);
String dSrc; String dSrc;
Wrapper wFunctional = toWrapper(dFunctional); if (functional.isPrimitive()) {
if (isPrimitive(wFunctional)) {
dSrc = dArg; dSrc = dArg;
} else { } else {
// Cast to convert to possibly more specific type, and generate CCE for invalid arg // Cast to convert to possibly more specific type, and generate CCE for invalid arg
dSrc = dFunctional; dSrc = BytecodeDescriptor.unparse(functional);
cast(dArg, dFunctional); cast(dArg, dSrc);
} }
if (isPrimitive(wTarget)) { String dTarget = BytecodeDescriptor.unparse(target);
if (target.isPrimitive()) {
Wrapper wTarget = toWrapper(dTarget);
// Reference argument to primitive target // Reference argument to primitive target
Wrapper wps = wrapperOrNullFromDescriptor(dSrc); Wrapper wps = wrapperOrNullFromDescriptor(dSrc);
if (wps != null) { if (wps != null) {
......
...@@ -60,7 +60,7 @@ import sun.management.ManagementFactoryHelper; ...@@ -60,7 +60,7 @@ import sun.management.ManagementFactoryHelper;
* one or more <i>platform MXBeans</i> representing * one or more <i>platform MXBeans</i> representing
* the management interface of a component of the Java virtual * the management interface of a component of the Java virtual
* machine. * machine.
* <p> *
* <h3><a name="MXBean">Platform MXBeans</a></h3> * <h3><a name="MXBean">Platform MXBeans</a></h3>
* <p> * <p>
* A platform MXBean is a <i>managed bean</i> that * A platform MXBean is a <i>managed bean</i> that
......
...@@ -33,10 +33,8 @@ package java.lang.management; ...@@ -33,10 +33,8 @@ package java.lang.management;
* The following table * The following table
* provides a summary description of what the permission allows, * provides a summary description of what the permission allows,
* and discusses the risks of granting code the permission. * and discusses the risks of granting code the permission.
* <P>
* *
* <table border=1 cellpadding=5 summary="Table shows permission target name, wh * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
at the permission allows, and associated risks">
* <tr> * <tr>
* <th>Permission Target Name</th> * <th>Permission Target Name</th>
* <th>What the Permission Allows</th> * <th>What the Permission Allows</th>
......
...@@ -79,7 +79,7 @@ import sun.management.MemoryUsageCompositeData; ...@@ -79,7 +79,7 @@ import sun.management.MemoryUsageCompositeData;
* </table> * </table>
* *
* Below is a picture showing an example of a memory pool: * Below is a picture showing an example of a memory pool:
* <p> *
* <pre> * <pre>
* +----------------------------------------------+ * +----------------------------------------------+
* +//////////////// | + * +//////////////// | +
...@@ -250,7 +250,7 @@ public class MemoryUsage { ...@@ -250,7 +250,7 @@ public class MemoryUsage {
* Returns a <tt>MemoryUsage</tt> object represented by the * Returns a <tt>MemoryUsage</tt> object represented by the
* given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> * given <tt>CompositeData</tt>. The given <tt>CompositeData</tt>
* must contain the following attributes: * must contain the following attributes:
* <p> *
* <blockquote> * <blockquote>
* <table border summary="The attributes and the types the given CompositeData contains"> * <table border summary="The attributes and the types the given CompositeData contains">
* <tr> * <tr>
......
...@@ -82,7 +82,7 @@ Java virtual machine and the runtime in the following ways: ...@@ -82,7 +82,7 @@ Java virtual machine and the runtime in the following ways:
<b>1. Direct access to an MXBean interface</b> <b>1. Direct access to an MXBean interface</b>
<p> <p>
<ul> <ul>
<li>Get an MXBean instance locally in the running Java virtual machine:<p> <li>Get an MXBean instance locally in the running Java virtual machine:
<pre> <pre>
RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean();
...@@ -103,7 +103,7 @@ Java virtual machine and the runtime in the following ways: ...@@ -103,7 +103,7 @@ Java virtual machine and the runtime in the following ways:
<p> <p>
</li> </li>
<li>Construct an MXBean proxy instance that forwards the <li>Construct an MXBean proxy instance that forwards the
method calls to a given MBeanServer:<p> method calls to a given MBeanServer:
<pre> <pre>
MBeanServerConnection mbs; MBeanServerConnection mbs;
......
...@@ -27,6 +27,15 @@ package java.lang.reflect; ...@@ -27,6 +27,15 @@ package java.lang.reflect;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.lang.annotation.AnnotationFormatError; import java.lang.annotation.AnnotationFormatError;
import java.lang.annotation.Repeatable;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import sun.reflect.annotation.AnnotationSupport;
import sun.reflect.annotation.AnnotationType;
/** /**
* Represents an annotated element of the program currently running in this * Represents an annotated element of the program currently running in this
...@@ -222,6 +231,18 @@ public interface AnnotatedElement { ...@@ -222,6 +231,18 @@ public interface AnnotatedElement {
* The caller of this method is free to modify the returned array; it will * The caller of this method is free to modify the returned array; it will
* have no effect on the arrays returned to other callers. * have no effect on the arrays returned to other callers.
* *
* @implSpec The default implementation first calls {@link
* #getDeclaredAnnotationsByType(Class)} passing {@code
* annotationClass} as the argument. If the returned array has
* length greater than zero, the array is returned. If the returned
* array is zero-length and this {@code AnnotatedElement} is a
* class and the argument type is an inheritable annotation type,
* and the superclass of this {@code AnnotatedElement} is non-null,
* then the returned result is the result of calling {@link
* #getAnnotationsByType(Class)} on the superclass with {@code
* annotationClass} as the argument. Otherwise, a zero-length
* array is returned.
*
* @param <T> the type of the annotation to query for and return if present * @param <T> the type of the annotation to query for and return if present
* @param annotationClass the Class object corresponding to the * @param annotationClass the Class object corresponding to the
* annotation type * annotation type
...@@ -230,7 +251,29 @@ public interface AnnotatedElement { ...@@ -230,7 +251,29 @@ public interface AnnotatedElement {
* @throws NullPointerException if the given annotation class is null * @throws NullPointerException if the given annotation class is null
* @since 1.8 * @since 1.8
*/ */
<T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass); default <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
/*
* Definition of associated: directly or indirectly present OR
* neither directly nor indirectly present AND the element is
* a Class, the annotation type is inheritable, and the
* annotation type is associated with the superclass of the
* element.
*/
T[] result = getDeclaredAnnotationsByType(annotationClass);
if (result.length == 0 && // Neither directly nor indirectly present
this instanceof Class && // the element is a class
AnnotationType.getInstance(annotationClass).isInherited()) { // Inheritable
Class<?> superClass = ((Class<?>) this).getSuperclass();
if (superClass != null) {
// Determine if the annotation is associated with the
// superclass
result = superClass.getAnnotationsByType(annotationClass);
}
}
return result;
}
/** /**
* Returns this element's annotation for the specified type if * Returns this element's annotation for the specified type if
...@@ -239,6 +282,11 @@ public interface AnnotatedElement { ...@@ -239,6 +282,11 @@ public interface AnnotatedElement {
* This method ignores inherited annotations. (Returns null if no * This method ignores inherited annotations. (Returns null if no
* annotations are directly present on this element.) * annotations are directly present on this element.)
* *
* @implSpec The default implementation first performs a null check
* and then loops over the results of {@link
* #getDeclaredAnnotations} returning the first annotation whose
* annotation type matches the argument type.
*
* @param <T> the type of the annotation to query for and return if directly present * @param <T> the type of the annotation to query for and return if directly present
* @param annotationClass the Class object corresponding to the * @param annotationClass the Class object corresponding to the
* annotation type * annotation type
...@@ -247,7 +295,18 @@ public interface AnnotatedElement { ...@@ -247,7 +295,18 @@ public interface AnnotatedElement {
* @throws NullPointerException if the given annotation class is null * @throws NullPointerException if the given annotation class is null
* @since 1.8 * @since 1.8
*/ */
<T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass); default <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
// Loop over all directly-present annotations looking for a matching one
for (Annotation annotation : getDeclaredAnnotations()) {
if (annotationClass.equals(annotation.annotationType())) {
// More robust to do a dynamic cast at runtime instead
// of compile-time only.
return annotationClass.cast(annotation);
}
}
return null;
}
/** /**
* Returns this element's annotation(s) for the specified type if * Returns this element's annotation(s) for the specified type if
...@@ -268,6 +327,22 @@ public interface AnnotatedElement { ...@@ -268,6 +327,22 @@ public interface AnnotatedElement {
* The caller of this method is free to modify the returned array; it will * The caller of this method is free to modify the returned array; it will
* have no effect on the arrays returned to other callers. * have no effect on the arrays returned to other callers.
* *
* @implSpec The default implementation may call {@link
* #getDeclaredAnnotation(Class)} one or more times to find a
* directly present annotation and, if the annotation type is
* repeatable, to find a container annotation. If annotations of
* the annotation type {@code annotationClass} are found to be both
* directly and indirectly present, then {@link
* #getDeclaredAnnotations()} will get called to determine the
* order of the elements in the returned array.
*
* <p>Alternatively, the default implementation may call {@link
* #getDeclaredAnnotations()} a single time and the returned array
* examined for both directly and indirectly present
* annotations. The results of calling {@link
* #getDeclaredAnnotations()} are assumed to be consistent with the
* results of calling {@link #getDeclaredAnnotation(Class)}.
*
* @param <T> the type of the annotation to query for and return * @param <T> the type of the annotation to query for and return
* if directly or indirectly present * if directly or indirectly present
* @param annotationClass the Class object corresponding to the * @param annotationClass the Class object corresponding to the
...@@ -277,7 +352,16 @@ public interface AnnotatedElement { ...@@ -277,7 +352,16 @@ public interface AnnotatedElement {
* @throws NullPointerException if the given annotation class is null * @throws NullPointerException if the given annotation class is null
* @since 1.8 * @since 1.8
*/ */
<T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass); default <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass);
return AnnotationSupport.
getDirectlyAndIndirectlyPresent(Arrays.stream(getDeclaredAnnotations()).
collect(Collectors.toMap(Annotation::annotationType,
Function.identity(),
((first,second) -> first),
LinkedHashMap::new)),
annotationClass);
}
/** /**
* Returns annotations that are <em>directly present</em> on this element. * Returns annotations that are <em>directly present</em> on this element.
......
...@@ -28,6 +28,8 @@ package java.lang.reflect; ...@@ -28,6 +28,8 @@ package java.lang.reflect;
import sun.reflect.CallerSensitive; import sun.reflect.CallerSensitive;
import sun.reflect.ConstructorAccessor; import sun.reflect.ConstructorAccessor;
import sun.reflect.Reflection; import sun.reflect.Reflection;
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.annotation.TypeAnnotationParser;
import sun.reflect.generics.repository.ConstructorRepository; import sun.reflect.generics.repository.ConstructorRepository;
import sun.reflect.generics.factory.CoreReflectionFactory; import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory; import sun.reflect.generics.factory.GenericsFactory;
...@@ -534,4 +536,22 @@ public final class Constructor<T> extends Executable { ...@@ -534,4 +536,22 @@ public final class Constructor<T> extends Executable {
public AnnotatedType getAnnotatedReturnType() { public AnnotatedType getAnnotatedReturnType() {
return getAnnotatedReturnType0(getDeclaringClass()); return getAnnotatedReturnType0(getDeclaringClass());
} }
/**
* {@inheritDoc}
* @since 1.8
*/
@Override
public AnnotatedType getAnnotatedReceiverType() {
if (getDeclaringClass().getEnclosingClass() == null)
return super.getAnnotatedReceiverType();
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
sun.misc.SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
this,
getDeclaringClass(),
getDeclaringClass().getEnclosingClass(),
TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
}
} }
...@@ -383,7 +383,7 @@ public abstract class Executable extends AccessibleObject ...@@ -383,7 +383,7 @@ public abstract class Executable extends AccessibleObject
private transient volatile Parameter[] parameters; private transient volatile Parameter[] parameters;
private native Parameter[] getParameters0(); private native Parameter[] getParameters0();
private native byte[] getTypeAnnotationBytes0(); native byte[] getTypeAnnotationBytes0();
// Needed by reflectaccess // Needed by reflectaccess
byte[] getTypeAnnotationBytes() { byte[] getTypeAnnotationBytes() {
...@@ -527,7 +527,7 @@ public abstract class Executable extends AccessibleObject ...@@ -527,7 +527,7 @@ public abstract class Executable extends AccessibleObject
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) { public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass); Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
} }
/** /**
......
...@@ -1123,7 +1123,7 @@ class Field extends AccessibleObject implements Member { ...@@ -1123,7 +1123,7 @@ class Field extends AccessibleObject implements Member {
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) { public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass); Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
} }
/** /**
......
...@@ -295,7 +295,7 @@ public final class Parameter implements AnnotatedElement { ...@@ -295,7 +295,7 @@ public final class Parameter implements AnnotatedElement {
public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) { public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
Objects.requireNonNull(annotationClass); Objects.requireNonNull(annotationClass);
return AnnotationSupport.getMultipleAnnotations(declaredAnnotations(), annotationClass); return AnnotationSupport.getDirectlyAndIndirectlyPresent(declaredAnnotations(), annotationClass);
} }
/** /**
......
...@@ -31,7 +31,6 @@ package java.lang.reflect; ...@@ -31,7 +31,6 @@ package java.lang.reflect;
* The following table * The following table
* provides a summary description of what the permission allows, * provides a summary description of what the permission allows,
* and discusses the risks of granting code the permission. * and discusses the risks of granting code the permission.
* <P>
* *
* <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks"> * <table border=1 cellpadding=5 summary="Table shows permission target name, what the permission allows, and associated risks">
* <tr> * <tr>
......
...@@ -97,6 +97,21 @@ import sun.misc.FloatConsts; ...@@ -97,6 +97,21 @@ import sun.misc.FloatConsts;
* {@code NullPointerException} when passed * {@code NullPointerException} when passed
* a null object reference for any input parameter. * a null object reference for any input parameter.
* *
* BigInteger must support values in the range
* -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive)
* and may support values outside of that range.
*
* The range of probable prime values is limited and may be less than
* the full supported positive range of {@code BigInteger}.
* The range must be at least 1 to 2<sup>500000000</sup>.
*
* @implNote
* BigInteger constructors and operations throw {@code ArithmeticException} when
* the result is out of the supported range of
* -2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive) to
* +2<sup>{@code Integer.MAX_VALUE}</sup> (exclusive).
*
* @see BigDecimal * @see BigDecimal
* @author Josh Bloch * @author Josh Bloch
* @author Michael McCloskey * @author Michael McCloskey
...@@ -182,6 +197,18 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -182,6 +197,18 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*/ */
final static long LONG_MASK = 0xffffffffL; final static long LONG_MASK = 0xffffffffL;
/**
* This constant limits {@code mag.length} of BigIntegers to the supported
* range.
*/
private static final int MAX_MAG_LENGTH = Integer.MAX_VALUE / Integer.SIZE + 1; // (1 << 26)
/**
* Bit lengths larger than this constant can cause overflow in searchLen
* calculation and in BitSieve.singleSearch method.
*/
private static final int PRIME_SEARCH_BIT_LENGTH_LIMIT = 500000000;
/** /**
* The threshold value for using Karatsuba multiplication. If the number * The threshold value for using Karatsuba multiplication. If the number
* of ints in both mag arrays are greater than this number, then * of ints in both mag arrays are greater than this number, then
...@@ -256,6 +283,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -256,6 +283,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
mag = stripLeadingZeroBytes(val); mag = stripLeadingZeroBytes(val);
signum = (mag.length == 0 ? 0 : 1); signum = (mag.length == 0 ? 0 : 1);
} }
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
/** /**
...@@ -275,6 +305,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -275,6 +305,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
mag = trustedStripLeadingZeroInts(val); mag = trustedStripLeadingZeroInts(val);
signum = (mag.length == 0 ? 0 : 1); signum = (mag.length == 0 ? 0 : 1);
} }
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
/** /**
...@@ -306,6 +339,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -306,6 +339,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
throw(new NumberFormatException("signum-magnitude mismatch")); throw(new NumberFormatException("signum-magnitude mismatch"));
this.signum = signum; this.signum = signum;
} }
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
/** /**
...@@ -327,6 +363,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -327,6 +363,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
throw(new NumberFormatException("signum-magnitude mismatch")); throw(new NumberFormatException("signum-magnitude mismatch"));
this.signum = signum; this.signum = signum;
} }
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
/** /**
...@@ -359,17 +398,20 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -359,17 +398,20 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
int sign = 1; int sign = 1;
int index1 = val.lastIndexOf('-'); int index1 = val.lastIndexOf('-');
int index2 = val.lastIndexOf('+'); int index2 = val.lastIndexOf('+');
if ((index1 + index2) <= -1) { if (index1 >= 0) {
// No leading sign character or at most one leading sign character if (index1 != 0 || index2 >= 0) {
if (index1 == 0 || index2 == 0) { throw new NumberFormatException("Illegal embedded sign character");
cursor = 1;
if (len == 1)
throw new NumberFormatException("Zero length BigInteger");
} }
if (index1 == 0)
sign = -1; sign = -1;
} else cursor = 1;
} else if (index2 >= 0) {
if (index2 != 0) {
throw new NumberFormatException("Illegal embedded sign character"); throw new NumberFormatException("Illegal embedded sign character");
}
cursor = 1;
}
if (cursor == len)
throw new NumberFormatException("Zero length BigInteger");
// Skip leading zeros and compute number of digits in magnitude // Skip leading zeros and compute number of digits in magnitude
while (cursor < len && while (cursor < len &&
...@@ -388,8 +430,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -388,8 +430,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// Pre-allocate array of expected size. May be too large but can // Pre-allocate array of expected size. May be too large but can
// never be too small. Typically exact. // never be too small. Typically exact.
int numBits = (int)(((numDigits * bitsPerDigit[radix]) >>> 10) + 1); long numBits = ((numDigits * bitsPerDigit[radix]) >>> 10) + 1;
int numWords = (numBits + 31) >>> 5; if (numBits + 31 >= (1L << 32)) {
reportOverflow();
}
int numWords = (int) (numBits + 31) >>> 5;
int[] magnitude = new int[numWords]; int[] magnitude = new int[numWords];
// Process first (potentially short) digit group // Process first (potentially short) digit group
...@@ -413,6 +458,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -413,6 +458,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
} }
// Required for cases where the array was overallocated. // Required for cases where the array was overallocated.
mag = trustedStripLeadingZeroInts(magnitude); mag = trustedStripLeadingZeroInts(magnitude);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
/* /*
...@@ -439,8 +487,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -439,8 +487,11 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
if (len < 10) { if (len < 10) {
numWords = 1; numWords = 1;
} else { } else {
int numBits = (int)(((numDigits * bitsPerDigit[10]) >>> 10) + 1); long numBits = ((numDigits * bitsPerDigit[10]) >>> 10) + 1;
numWords = (numBits + 31) >>> 5; if (numBits + 31 >= (1L << 32)) {
reportOverflow();
}
numWords = (int) (numBits + 31) >>> 5;
} }
int[] magnitude = new int[numWords]; int[] magnitude = new int[numWords];
...@@ -456,6 +507,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -456,6 +507,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
destructiveMulAdd(magnitude, intRadix[10], groupVal); destructiveMulAdd(magnitude, intRadix[10], groupVal);
} }
mag = trustedStripLeadingZeroInts(magnitude); mag = trustedStripLeadingZeroInts(magnitude);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
// Create an integer with the digits between the two indexes // Create an integer with the digits between the two indexes
...@@ -575,7 +629,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -575,7 +629,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* this constructor is proportional to the value of this parameter. * this constructor is proportional to the value of this parameter.
* @param rnd source of random bits used to select candidates to be * @param rnd source of random bits used to select candidates to be
* tested for primality. * tested for primality.
* @throws ArithmeticException {@code bitLength < 2}. * @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large.
* @see #bitLength() * @see #bitLength()
*/ */
public BigInteger(int bitLength, int certainty, Random rnd) { public BigInteger(int bitLength, int certainty, Random rnd) {
...@@ -607,7 +661,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -607,7 +661,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @param rnd source of random bits used to select candidates to be * @param rnd source of random bits used to select candidates to be
* tested for primality. * tested for primality.
* @return a BigInteger of {@code bitLength} bits that is probably prime * @return a BigInteger of {@code bitLength} bits that is probably prime
* @throws ArithmeticException {@code bitLength < 2}. * @throws ArithmeticException {@code bitLength < 2} or {@code bitLength} is too large.
* @see #bitLength() * @see #bitLength()
* @since 1.4 * @since 1.4
*/ */
...@@ -677,7 +731,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -677,7 +731,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
p.mag[p.mag.length-1] &= 0xfffffffe; p.mag[p.mag.length-1] &= 0xfffffffe;
// Use a sieve length likely to contain the next prime number // Use a sieve length likely to contain the next prime number
int searchLen = (bitLength / 20) * 64; int searchLen = getPrimeSearchLen(bitLength);
BitSieve searchSieve = new BitSieve(p, searchLen); BitSieve searchSieve = new BitSieve(p, searchLen);
BigInteger candidate = searchSieve.retrieve(p, certainty, rnd); BigInteger candidate = searchSieve.retrieve(p, certainty, rnd);
...@@ -701,7 +755,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -701,7 +755,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* *
* @return the first integer greater than this {@code BigInteger} that * @return the first integer greater than this {@code BigInteger} that
* is probably prime. * is probably prime.
* @throws ArithmeticException {@code this < 0}. * @throws ArithmeticException {@code this < 0} or {@code this} is too large.
* @since 1.5 * @since 1.5
*/ */
public BigInteger nextProbablePrime() { public BigInteger nextProbablePrime() {
...@@ -750,7 +804,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -750,7 +804,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
result = result.subtract(ONE); result = result.subtract(ONE);
// Looking for the next large prime // Looking for the next large prime
int searchLen = (result.bitLength() / 20) * 64; int searchLen = getPrimeSearchLen(result.bitLength());
while (true) { while (true) {
BitSieve searchSieve = new BitSieve(result, searchLen); BitSieve searchSieve = new BitSieve(result, searchLen);
...@@ -762,6 +816,13 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -762,6 +816,13 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
} }
} }
private static int getPrimeSearchLen(int bitLength) {
if (bitLength > PRIME_SEARCH_BIT_LENGTH_LIMIT + 1) {
throw new ArithmeticException("Prime search implementation restriction on bitLength");
}
return bitLength / 20 * 64;
}
/** /**
* Returns {@code true} if this BigInteger is probably prime, * Returns {@code true} if this BigInteger is probably prime,
* {@code false} if it's definitely composite. * {@code false} if it's definitely composite.
...@@ -965,6 +1026,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -965,6 +1026,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
BigInteger(int[] magnitude, int signum) { BigInteger(int[] magnitude, int signum) {
this.signum = (magnitude.length == 0 ? 0 : signum); this.signum = (magnitude.length == 0 ? 0 : signum);
this.mag = magnitude; this.mag = magnitude;
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
} }
/** /**
...@@ -974,6 +1038,25 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -974,6 +1038,25 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
private BigInteger(byte[] magnitude, int signum) { private BigInteger(byte[] magnitude, int signum) {
this.signum = (magnitude.length == 0 ? 0 : signum); this.signum = (magnitude.length == 0 ? 0 : signum);
this.mag = stripLeadingZeroBytes(magnitude); this.mag = stripLeadingZeroBytes(magnitude);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
}
/**
* Throws an {@code ArithmeticException} if the {@code BigInteger} would be
* out of the supported range.
*
* @throws ArithmeticException if {@code this} exceeds the supported range.
*/
private void checkRange() {
if (mag.length > MAX_MAG_LENGTH || mag.length == MAX_MAG_LENGTH && mag[0] < 0) {
reportOverflow();
}
}
private static void reportOverflow() {
throw new ArithmeticException("BigInteger would overflow supported range");
} }
//Static Factory Methods //Static Factory Methods
...@@ -2073,6 +2156,10 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -2073,6 +2156,10 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// The remaining part can then be exponentiated faster. The // The remaining part can then be exponentiated faster. The
// powers of two will be multiplied back at the end. // powers of two will be multiplied back at the end.
int powersOfTwo = partToSquare.getLowestSetBit(); int powersOfTwo = partToSquare.getLowestSetBit();
long bitsToShift = (long)powersOfTwo * exponent;
if (bitsToShift > Integer.MAX_VALUE) {
reportOverflow();
}
int remainingBits; int remainingBits;
...@@ -2126,11 +2213,10 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -2126,11 +2213,10 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// Multiply back the powers of two (quickly, by shifting left) // Multiply back the powers of two (quickly, by shifting left)
if (powersOfTwo > 0) { if (powersOfTwo > 0) {
int bitsToShift = powersOfTwo*exponent;
if (bitsToShift + scaleFactor <= 62) { // Fits in long? if (bitsToShift + scaleFactor <= 62) { // Fits in long?
return valueOf((result << bitsToShift) * newSign); return valueOf((result << bitsToShift) * newSign);
} else { } else {
return valueOf(result*newSign).shiftLeft(bitsToShift); return valueOf(result*newSign).shiftLeft((int) bitsToShift);
} }
} }
else { else {
...@@ -2375,8 +2461,17 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -2375,8 +2461,17 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
BigInteger y1 = m2.modInverse(m1); BigInteger y1 = m2.modInverse(m1);
BigInteger y2 = m1.modInverse(m2); BigInteger y2 = m1.modInverse(m2);
result = a1.multiply(m2).multiply(y1).add if (m.mag.length < MAX_MAG_LENGTH / 2) {
(a2.multiply(m1).multiply(y2)).mod(m); result = a1.multiply(m2).multiply(y1).add(a2.multiply(m1).multiply(y2)).mod(m);
} else {
MutableBigInteger t1 = new MutableBigInteger();
new MutableBigInteger(a1.multiply(m2)).multiply(new MutableBigInteger(y1), t1);
MutableBigInteger t2 = new MutableBigInteger();
new MutableBigInteger(a2.multiply(m1)).multiply(new MutableBigInteger(y2), t2);
t1.add(t2);
MutableBigInteger q = new MutableBigInteger();
result = t1.divide(new MutableBigInteger(m), q).toBigInteger();
}
} }
return (invertResult ? result.modInverse(m) : result); return (invertResult ? result.modInverse(m) : result);
...@@ -2797,27 +2892,31 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -2797,27 +2892,31 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* *
* @param n shift distance, in bits. * @param n shift distance, in bits.
* @return {@code this << n} * @return {@code this << n}
* @throws ArithmeticException if the shift distance is {@code
* Integer.MIN_VALUE}.
* @see #shiftRight * @see #shiftRight
*/ */
public BigInteger shiftLeft(int n) { public BigInteger shiftLeft(int n) {
if (signum == 0) if (signum == 0)
return ZERO; return ZERO;
if (n == 0) if (n > 0) {
return new BigInteger(shiftLeft(mag, n), signum);
} else if (n == 0) {
return this; return this;
if (n < 0) {
if (n == Integer.MIN_VALUE) {
throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
} else { } else {
return shiftRight(-n); // Possible int overflow in (-n) is not a trouble,
} // because shiftRightImpl considers its argument unsigned
return shiftRightImpl(-n);
} }
int[] newMag = shiftLeft(mag, n);
return new BigInteger(newMag, signum);
} }
/**
* Returns a magnitude array whose value is {@code (mag << n)}.
* The shift distance, {@code n}, is considered unnsigned.
* (Computes <tt>this * 2<sup>n</sup></tt>.)
*
* @param mag magnitude, the most-significant int ({@code mag[0]}) must be non-zero.
* @param n unsigned shift distance, in bits.
* @return {@code mag << n}
*/
private static int[] shiftLeft(int[] mag, int n) { private static int[] shiftLeft(int[] mag, int n) {
int nInts = n >>> 5; int nInts = n >>> 5;
int nBits = n & 0x1f; int nBits = n & 0x1f;
...@@ -2853,21 +2952,31 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -2853,21 +2952,31 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* *
* @param n shift distance, in bits. * @param n shift distance, in bits.
* @return {@code this >> n} * @return {@code this >> n}
* @throws ArithmeticException if the shift distance is {@code
* Integer.MIN_VALUE}.
* @see #shiftLeft * @see #shiftLeft
*/ */
public BigInteger shiftRight(int n) { public BigInteger shiftRight(int n) {
if (n == 0) if (signum == 0)
return ZERO;
if (n > 0) {
return shiftRightImpl(n);
} else if (n == 0) {
return this; return this;
if (n < 0) {
if (n == Integer.MIN_VALUE) {
throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
} else { } else {
return shiftLeft(-n); // Possible int overflow in {@code -n} is not a trouble,
// because shiftLeft considers its argument unsigned
return new BigInteger(shiftLeft(mag, -n), signum);
} }
} }
/**
* Returns a BigInteger whose value is {@code (this >> n)}. The shift
* distance, {@code n}, is considered unsigned.
* (Computes <tt>floor(this * 2<sup>-n</sup>)</tt>.)
*
* @param n unsigned shift distance, in bits.
* @return {@code this >> n}
*/
private BigInteger shiftRightImpl(int n) {
int nInts = n >>> 5; int nInts = n >>> 5;
int nBits = n & 0x1f; int nBits = n & 0x1f;
int magLen = mag.length; int magLen = mag.length;
...@@ -3899,7 +4008,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -3899,7 +4008,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
; ;
int extraByte = (k == byteLength) ? 1 : 0; int extraByte = (k == byteLength) ? 1 : 0;
int intLength = ((byteLength - keep + extraByte) + 3)/4; int intLength = ((byteLength - keep + extraByte) + 3) >>> 2;
int result[] = new int[intLength]; int result[] = new int[intLength];
/* Copy one's complement of input into output, leaving extra /* Copy one's complement of input into output, leaving extra
...@@ -4135,7 +4244,8 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -4135,7 +4244,8 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
message = "BigInteger: Signum not present in stream"; message = "BigInteger: Signum not present in stream";
throw new java.io.StreamCorruptedException(message); throw new java.io.StreamCorruptedException(message);
} }
if ((magnitude.length == 0) != (sign == 0)) { int[] mag = stripLeadingZeroBytes(magnitude);
if ((mag.length == 0) != (sign == 0)) {
String message = "BigInteger: signum-magnitude mismatch"; String message = "BigInteger: signum-magnitude mismatch";
if (fields.defaulted("magnitude")) if (fields.defaulted("magnitude"))
message = "BigInteger: Magnitude not present in stream"; message = "BigInteger: Magnitude not present in stream";
...@@ -4146,7 +4256,14 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -4146,7 +4256,14 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
UnsafeHolder.putSign(this, sign); UnsafeHolder.putSign(this, sign);
// Calculate mag field from magnitude and discard magnitude // Calculate mag field from magnitude and discard magnitude
UnsafeHolder.putMag(this, stripLeadingZeroBytes(magnitude)); UnsafeHolder.putMag(this, mag);
if (mag.length >= MAX_MAG_LENGTH) {
try {
checkRange();
} catch (ArithmeticException e) {
throw new java.io.StreamCorruptedException("BigInteger: Out of the supported range");
}
}
} }
// Support for resetting final fields while deserializing // Support for resetting final fields while deserializing
......
...@@ -1257,14 +1257,14 @@ class MutableBigInteger { ...@@ -1257,14 +1257,14 @@ class MutableBigInteger {
int j = (s+m-1) / m; // step 2a: j = ceil(s/m) int j = (s+m-1) / m; // step 2a: j = ceil(s/m)
int n = j * m; // step 2b: block length in 32-bit units int n = j * m; // step 2b: block length in 32-bit units
int n32 = 32 * n; // block length in bits long n32 = 32L * n; // block length in bits
int sigma = Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n} int sigma = (int) Math.max(0, n32 - b.bitLength()); // step 3: sigma = max{T | (2^T)*B < beta^n}
MutableBigInteger bShifted = new MutableBigInteger(b); MutableBigInteger bShifted = new MutableBigInteger(b);
bShifted.safeLeftShift(sigma); // step 4a: shift b so its length is a multiple of n bShifted.safeLeftShift(sigma); // step 4a: shift b so its length is a multiple of n
safeLeftShift(sigma); // step 4b: shift this by the same amount safeLeftShift(sigma); // step 4b: shift this by the same amount
// step 5: t is the number of blocks needed to accommodate this plus one additional bit // step 5: t is the number of blocks needed to accommodate this plus one additional bit
int t = (bitLength()+n32) / n32; int t = (int) ((bitLength()+n32) / n32);
if (t < 2) { if (t < 2) {
t = 2; t = 2;
} }
...@@ -1421,10 +1421,10 @@ class MutableBigInteger { ...@@ -1421,10 +1421,10 @@ class MutableBigInteger {
} }
/** @see BigInteger#bitLength() */ /** @see BigInteger#bitLength() */
int bitLength() { long bitLength() {
if (intLen == 0) if (intLen == 0)
return 0; return 0;
return intLen*32 - Integer.numberOfLeadingZeros(value[offset]); return intLen*32L - Integer.numberOfLeadingZeros(value[offset]);
} }
/** /**
......
...@@ -196,7 +196,7 @@ class DatagramSocket implements java.io.Closeable { ...@@ -196,7 +196,7 @@ class DatagramSocket implements java.io.Closeable {
* socket address. * socket address.
* <p> * <p>
* If, if the address is {@code null}, creates an unbound socket. * If, if the address is {@code null}, creates an unbound socket.
* <p> *
* <p>If there is a security manager, * <p>If there is a security manager,
* its {@code checkListen} method is first called * its {@code checkListen} method is first called
* with the port from the socket address * with the port from the socket address
...@@ -1109,7 +1109,7 @@ class DatagramSocket implements java.io.Closeable { ...@@ -1109,7 +1109,7 @@ class DatagramSocket implements java.io.Closeable {
* represent the value of the TOS octet in IP packets sent by * represent the value of the TOS octet in IP packets sent by
* the socket. * the socket.
* RFC 1349 defines the TOS values as follows: * RFC 1349 defines the TOS values as follows:
* <p> *
* <UL> * <UL>
* <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI> * <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI>
* <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI> * <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI>
......
...@@ -761,7 +761,7 @@ public final class HttpCookie implements Cloneable { ...@@ -761,7 +761,7 @@ public final class HttpCookie implements Cloneable {
// from RFC 2068, token special case characters // from RFC 2068, token special case characters
// //
// private static final String tspecials = "()<>@,;:\\\"/[]?={} \t"; // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t";
private static final String tspecials = ",;"; private static final String tspecials = ",; "; // deliberately includes space
/* /*
* Tests a string and returns true if the string counts as a token. * Tests a string and returns true if the string counts as a token.
......
...@@ -133,7 +133,7 @@ import java.util.Arrays; ...@@ -133,7 +133,7 @@ import java.util.Arrays;
* representation. However, it will be converted into an IPv4 * representation. However, it will be converted into an IPv4
* address.</td></tr> * address.</td></tr>
* </table></blockquote> * </table></blockquote>
* <p> *
* <h4><A NAME="scoped">Textual representation of IPv6 scoped addresses</a></h4> * <h4><A NAME="scoped">Textual representation of IPv6 scoped addresses</a></h4>
* *
* <p> The textual representation of IPv6 addresses as described above can be * <p> The textual representation of IPv6 addresses as described above can be
...@@ -150,11 +150,11 @@ import java.util.Arrays; ...@@ -150,11 +150,11 @@ import java.util.Arrays;
* *
* <p> The general format for specifying the <i>scope_id</i> is the following: * <p> The general format for specifying the <i>scope_id</i> is the following:
* *
* <p><blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote> * <blockquote><i>IPv6-address</i>%<i>scope_id</i></blockquote>
* <p> The IPv6-address is a literal IPv6 address as described above. * <p> The IPv6-address is a literal IPv6 address as described above.
* The <i>scope_id</i> refers to an interface on the local system, and it can be * The <i>scope_id</i> refers to an interface on the local system, and it can be
* specified in two ways. * specified in two ways.
* <p><ol><li><i>As a numeric identifier.</i> This must be a positive integer * <ol><li><i>As a numeric identifier.</i> This must be a positive integer
* that identifies the particular interface and scope as understood by the * that identifies the particular interface and scope as understood by the
* system. Usually, the numeric values can be determined through administration * system. Usually, the numeric values can be determined through administration
* tools on the system. Each interface may have multiple values, one for each * tools on the system. Each interface may have multiple values, one for each
......
...@@ -140,7 +140,7 @@ class MulticastSocket extends DatagramSocket { ...@@ -140,7 +140,7 @@ class MulticastSocket extends DatagramSocket {
* Create a MulticastSocket bound to the specified socket address. * Create a MulticastSocket bound to the specified socket address.
* <p> * <p>
* Or, if the address is {@code null}, create an unbound socket. * Or, if the address is {@code null}, create an unbound socket.
* <p> *
* <p>If there is a security manager, * <p>If there is a security manager,
* its {@code checkListen} method is first called * its {@code checkListen} method is first called
* with the SocketAddress port as its argument to ensure the operation is allowed. * with the SocketAddress port as its argument to ensure the operation is allowed.
......
...@@ -46,7 +46,6 @@ import java.util.StringTokenizer; ...@@ -46,7 +46,6 @@ import java.util.StringTokenizer;
* The following table lists all the possible NetPermission target names, * The following table lists all the possible NetPermission target names,
* and for each provides a description of what the permission allows * and for each provides a description of what the permission allows
* and a discussion of the risks of granting code the permission. * and a discussion of the risks of granting code the permission.
* <P>
* *
* <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks"> * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
* <tr> * <tr>
......
...@@ -66,8 +66,8 @@ public class Proxy { ...@@ -66,8 +66,8 @@ public class Proxy {
* Used, for instance, to create sockets bypassing any other global * Used, for instance, to create sockets bypassing any other global
* proxy settings (like SOCKS): * proxy settings (like SOCKS):
* <P> * <P>
* {@code Socket s = new Socket(Proxy.NO_PROXY);}<br> * {@code Socket s = new Socket(Proxy.NO_PROXY);}
* <P> *
*/ */
public final static Proxy NO_PROXY = new Proxy(); public final static Proxy NO_PROXY = new Proxy();
......
...@@ -1230,13 +1230,13 @@ class Socket implements java.io.Closeable { ...@@ -1230,13 +1230,13 @@ class Socket implements java.io.Closeable {
* Generally, the window size can be modified at any time when a socket is * Generally, the window size can be modified at any time when a socket is
* connected. However, if a receive window larger than 64K is required then * connected. However, if a receive window larger than 64K is required then
* this must be requested <B>before</B> the socket is connected to the * this must be requested <B>before</B> the socket is connected to the
* remote peer. There are two cases to be aware of:<p> * remote peer. There are two cases to be aware of:
* <ol> * <ol>
* <li>For sockets accepted from a ServerSocket, this must be done by calling * <li>For sockets accepted from a ServerSocket, this must be done by calling
* {@link ServerSocket#setReceiveBufferSize(int)} before the ServerSocket * {@link ServerSocket#setReceiveBufferSize(int)} before the ServerSocket
* is bound to a local address.<p></li> * is bound to a local address.<p></li>
* <li>For client sockets, setReceiveBufferSize() must be called before * <li>For client sockets, setReceiveBufferSize() must be called before
* connecting the socket to its remote peer.<p></li></ol> * connecting the socket to its remote peer.</li></ol>
* @param size the size to which to set the receive buffer * @param size the size to which to set the receive buffer
* size. This value must be greater than 0. * size. This value must be greater than 0.
* *
...@@ -1329,7 +1329,7 @@ class Socket implements java.io.Closeable { ...@@ -1329,7 +1329,7 @@ class Socket implements java.io.Closeable {
* represent the value of the TOS octet in IP packets sent by * represent the value of the TOS octet in IP packets sent by
* the socket. * the socket.
* RFC 1349 defines the TOS values as follows: * RFC 1349 defines the TOS values as follows:
* <p> *
* <UL> * <UL>
* <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI> * <LI><CODE>IPTOS_LOWCOST (0x02)</CODE></LI>
* <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI> * <LI><CODE>IPTOS_RELIABILITY (0x04)</CODE></LI>
......
...@@ -134,7 +134,7 @@ public interface SocketOptions { ...@@ -134,7 +134,7 @@ public interface SocketOptions {
* previously written data. * previously written data.
*<P> *<P>
* Valid for TCP only: SocketImpl. * Valid for TCP only: SocketImpl.
* <P> *
* @see Socket#setTcpNoDelay * @see Socket#setTcpNoDelay
* @see Socket#getTcpNoDelay * @see Socket#getTcpNoDelay
*/ */
...@@ -155,7 +155,7 @@ public interface SocketOptions { ...@@ -155,7 +155,7 @@ public interface SocketOptions {
* This option <B>must</B> be specified in the constructor. * This option <B>must</B> be specified in the constructor.
* <P> * <P>
* Valid for: SocketImpl, DatagramSocketImpl * Valid for: SocketImpl, DatagramSocketImpl
* <P> *
* @see Socket#getLocalAddress * @see Socket#getLocalAddress
* @see DatagramSocket#getLocalAddress * @see DatagramSocket#getLocalAddress
*/ */
...@@ -186,7 +186,7 @@ public interface SocketOptions { ...@@ -186,7 +186,7 @@ public interface SocketOptions {
* want to use other than the system default. Takes/returns an InetAddress. * want to use other than the system default. Takes/returns an InetAddress.
* <P> * <P>
* Valid for Multicast: DatagramSocketImpl * Valid for Multicast: DatagramSocketImpl
* <P> *
* @see MulticastSocket#setInterface(InetAddress) * @see MulticastSocket#setInterface(InetAddress)
* @see MulticastSocket#getInterface() * @see MulticastSocket#getInterface()
*/ */
......
...@@ -779,27 +779,27 @@ public final class SocketPermission extends Permission ...@@ -779,27 +779,27 @@ public final class SocketPermission extends Permission
* specified permission. * specified permission.
* <P> * <P>
* More specifically, this method first ensures that all of the following * More specifically, this method first ensures that all of the following
* are true (and returns false if any of them are not):<p> * are true (and returns false if any of them are not):
* <ul> * <ul>
* <li> <i>p</i> is an instanceof SocketPermission,<p> * <li> <i>p</i> is an instanceof SocketPermission,
* <li> <i>p</i>'s actions are a proper subset of this * <li> <i>p</i>'s actions are a proper subset of this
* object's actions, and<p> * object's actions, and
* <li> <i>p</i>'s port range is included in this port range. Note: * <li> <i>p</i>'s port range is included in this port range. Note:
* port range is ignored when p only contains the action, 'resolve'.<p> * port range is ignored when p only contains the action, 'resolve'.
* </ul> * </ul>
* *
* Then {@code implies} checks each of the following, in order, * Then {@code implies} checks each of the following, in order,
* and for each returns true if the stated condition is true:<p> * and for each returns true if the stated condition is true:
* <ul> * <ul>
* <li> If this object was initialized with a single IP address and one of <i>p</i>'s * <li> If this object was initialized with a single IP address and one of <i>p</i>'s
* IP addresses is equal to this object's IP address.<p> * IP addresses is equal to this object's IP address.
* <li>If this object is a wildcard domain (such as *.sun.com), and * <li>If this object is a wildcard domain (such as *.sun.com), and
* <i>p</i>'s canonical name (the name without any preceding *) * <i>p</i>'s canonical name (the name without any preceding *)
* ends with this object's canonical host name. For example, *.sun.com * ends with this object's canonical host name. For example, *.sun.com
* implies *.eng.sun.com..<p> * implies *.eng.sun.com.
* <li>If this object was not initialized with a single IP address, and one of this * <li>If this object was not initialized with a single IP address, and one of this
* object's IP addresses equals one of <i>p</i>'s IP addresses.<p> * object's IP addresses equals one of <i>p</i>'s IP addresses.
* <li>If this canonical name equals <i>p</i>'s canonical name.<p> * <li>If this canonical name equals <i>p</i>'s canonical name.
* </ul> * </ul>
* *
* If none of the above are true, {@code implies} returns false. * If none of the above are true, {@code implies} returns false.
......
...@@ -389,20 +389,20 @@ import java.lang.NullPointerException; // for javadoc ...@@ -389,20 +389,20 @@ import java.lang.NullPointerException; // for javadoc
* colon following a host name but no port (as in * colon following a host name but no port (as in
* {@code http://java.sun.com:}&nbsp;), and that does not encode characters * {@code http://java.sun.com:}&nbsp;), and that does not encode characters
* except those that must be quoted, the following identities also hold: * except those that must be quoted, the following identities also hold:
* <p><pre> * <pre>
* new URI(<i>u</i>.getScheme(), * new URI(<i>u</i>.getScheme(),
* <i>u</i>.getSchemeSpecificPart(), * <i>u</i>.getSchemeSpecificPart(),
* <i>u</i>.getFragment()) * <i>u</i>.getFragment())
* .equals(<i>u</i>)</pre> * .equals(<i>u</i>)</pre>
* in all cases, * in all cases,
* <p><pre> * <pre>
* new URI(<i>u</i>.getScheme(), * new URI(<i>u</i>.getScheme(),
* <i>u</i>.getUserInfo(), <i>u</i>.getAuthority(), * <i>u</i>.getUserInfo(), <i>u</i>.getAuthority(),
* <i>u</i>.getPath(), <i>u</i>.getQuery(), * <i>u</i>.getPath(), <i>u</i>.getQuery(),
* <i>u</i>.getFragment()) * <i>u</i>.getFragment())
* .equals(<i>u</i>)</pre> * .equals(<i>u</i>)</pre>
* if <i>u</i> is hierarchical, and * if <i>u</i> is hierarchical, and
* <p><pre> * <pre>
* new URI(<i>u</i>.getScheme(), * new URI(<i>u</i>.getScheme(),
* <i>u</i>.getUserInfo(), <i>u</i>.getHost(), <i>u</i>.getPort(), * <i>u</i>.getUserInfo(), <i>u</i>.getHost(), <i>u</i>.getPort(),
* <i>u</i>.getPath(), <i>u</i>.getQuery(), * <i>u</i>.getPath(), <i>u</i>.getQuery(),
......
...@@ -25,21 +25,30 @@ ...@@ -25,21 +25,30 @@
package java.net; package java.net;
import java.io.*; import java.io.Closeable;
import java.util.*; import java.io.File;
import java.util.jar.Manifest; import java.io.FilePermission;
import java.util.jar.JarFile; import java.io.IOException;
import java.util.jar.Attributes; import java.io.InputStream;
import java.util.jar.Attributes.Name;
import java.security.CodeSigner;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.security.AccessController;
import java.security.AccessControlContext; import java.security.AccessControlContext;
import java.security.SecureClassLoader; import java.security.AccessController;
import java.security.CodeSigner;
import java.security.CodeSource; import java.security.CodeSource;
import java.security.Permission; import java.security.Permission;
import java.security.PermissionCollection; import java.security.PermissionCollection;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.security.SecureClassLoader;
import java.util.Enumeration;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import sun.misc.Resource; import sun.misc.Resource;
import sun.misc.URLClassPath; import sun.misc.URLClassPath;
import sun.net.www.ParseUtil; import sun.net.www.ParseUtil;
...@@ -84,6 +93,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -84,6 +93,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* {@code checkCreateClassLoader} method doesn't allow * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader. * creation of a class loader.
* @exception NullPointerException if {@code urls} is {@code null}.
* @see SecurityManager#checkCreateClassLoader * @see SecurityManager#checkCreateClassLoader
*/ */
public URLClassLoader(URL[] urls, ClassLoader parent) { public URLClassLoader(URL[] urls, ClassLoader parent) {
...@@ -127,6 +137,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -127,6 +137,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* {@code checkCreateClassLoader} method doesn't allow * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader. * creation of a class loader.
* @exception NullPointerException if {@code urls} is {@code null}.
* @see SecurityManager#checkCreateClassLoader * @see SecurityManager#checkCreateClassLoader
*/ */
public URLClassLoader(URL[] urls) { public URLClassLoader(URL[] urls) {
...@@ -169,6 +180,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -169,6 +180,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @exception SecurityException if a security manager exists and its * @exception SecurityException if a security manager exists and its
* {@code checkCreateClassLoader} method doesn't allow * {@code checkCreateClassLoader} method doesn't allow
* creation of a class loader. * creation of a class loader.
* @exception NullPointerException if {@code urls} is {@code null}.
* @see SecurityManager#checkCreateClassLoader * @see SecurityManager#checkCreateClassLoader
*/ */
public URLClassLoader(URL[] urls, ClassLoader parent, public URLClassLoader(URL[] urls, ClassLoader parent,
...@@ -260,13 +272,13 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -260,13 +272,13 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* and errors are not caught. Calling close on an already closed * and errors are not caught. Calling close on an already closed
* loader has no effect. * loader has no effect.
* <p> * <p>
* @throws IOException if closing any file opened by this class loader * @exception IOException if closing any file opened by this class loader
* resulted in an IOException. Any such exceptions are caught internally. * resulted in an IOException. Any such exceptions are caught internally.
* If only one is caught, then it is re-thrown. If more than one exception * If only one is caught, then it is re-thrown. If more than one exception
* is caught, then the second and following exceptions are added * is caught, then the second and following exceptions are added
* as suppressed exceptions of the first one caught, which is then re-thrown. * as suppressed exceptions of the first one caught, which is then re-thrown.
* *
* @throws SecurityException if a security manager is set, and it denies * @exception SecurityException if a security manager is set, and it denies
* {@link RuntimePermission}{@code ("closeClassLoader")} * {@link RuntimePermission}{@code ("closeClassLoader")}
* *
* @since 1.7 * @since 1.7
...@@ -339,6 +351,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -339,6 +351,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* @return the resulting class * @return the resulting class
* @exception ClassNotFoundException if the class could not be found, * @exception ClassNotFoundException if the class could not be found,
* or if the loader is closed. * or if the loader is closed.
* @exception NullPointerException if {@code name} is {@code null}.
*/ */
protected Class<?> findClass(final String name) protected Class<?> findClass(final String name)
throws ClassNotFoundException throws ClassNotFoundException
...@@ -621,6 +634,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -621,6 +634,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* If the protocol is not "file", then permission * If the protocol is not "file", then permission
* to connect to and accept connections from the URL's host is granted. * to connect to and accept connections from the URL's host is granted.
* @param codesource the codesource * @param codesource the codesource
* @exception NullPointerException if {@code codesource} is {@code null}.
* @return the permissions granted to the codesource * @return the permissions granted to the codesource
*/ */
protected PermissionCollection getPermissions(CodeSource codesource) protected PermissionCollection getPermissions(CodeSource codesource)
...@@ -700,6 +714,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -700,6 +714,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* *
* @param urls the URLs to search for classes and resources * @param urls the URLs to search for classes and resources
* @param parent the parent class loader for delegation * @param parent the parent class loader for delegation
* @exception NullPointerException if {@code urls} is {@code null}.
* @return the resulting class loader * @return the resulting class loader
*/ */
public static URLClassLoader newInstance(final URL[] urls, public static URLClassLoader newInstance(final URL[] urls,
...@@ -725,6 +740,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -725,6 +740,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* loading the class. * loading the class.
* *
* @param urls the URLs to search for classes and resources * @param urls the URLs to search for classes and resources
* @exception NullPointerException if {@code urls} is {@code null}.
* @return the resulting class loader * @return the resulting class loader
*/ */
public static URLClassLoader newInstance(final URL[] urls) { public static URLClassLoader newInstance(final URL[] urls) {
......
...@@ -45,7 +45,7 @@ import sun.net.www.MessageHeader; ...@@ -45,7 +45,7 @@ import sun.net.www.MessageHeader;
* application and a URL. Instances of this class can be used both to * application and a URL. Instances of this class can be used both to
* read from and to write to the resource referenced by the URL. In * read from and to write to the resource referenced by the URL. In
* general, creating a connection to a URL is a multistep process: * general, creating a connection to a URL is a multistep process:
* <p> *
* <center><table border=2 summary="Describes the process of creating a connection to a URL: openConnection() and connect() over time."> * <center><table border=2 summary="Describes the process of creating a connection to a URL: openConnection() and connect() over time.">
* <tr><th>{@code openConnection()}</th> * <tr><th>{@code openConnection()}</th>
* <th>{@code connect()}</th></tr> * <th>{@code connect()}</th></tr>
......
...@@ -43,7 +43,7 @@ import java.io.*; ...@@ -43,7 +43,7 @@ import java.io.*;
* as the start of a special escaped sequence. * as the start of a special escaped sequence.
* <p> * <p>
* The following rules are applied in the conversion: * The following rules are applied in the conversion:
* <p> *
* <ul> * <ul>
* <li>The alphanumeric characters &quot;{@code a}&quot; through * <li>The alphanumeric characters &quot;{@code a}&quot; through
* &quot;{@code z}&quot;, &quot;{@code A}&quot; through * &quot;{@code z}&quot;, &quot;{@code A}&quot; through
......
...@@ -49,7 +49,6 @@ import sun.security.action.GetPropertyAction; ...@@ -49,7 +49,6 @@ import sun.security.action.GetPropertyAction;
* <p> * <p>
* When encoding a String, the following rules apply: * When encoding a String, the following rules apply:
* *
* <p>
* <ul> * <ul>
* <li>The alphanumeric characters &quot;{@code a}&quot; through * <li>The alphanumeric characters &quot;{@code a}&quot; through
* &quot;{@code z}&quot;, &quot;{@code A}&quot; through * &quot;{@code z}&quot;, &quot;{@code A}&quot; through
......
...@@ -45,7 +45,7 @@ import java.security.Permission; ...@@ -45,7 +45,7 @@ import java.security.Permission;
* </pre> * </pre>
* <i>scheme</i> will typically be http or https, but is not restricted by this * <i>scheme</i> will typically be http or https, but is not restricted by this
* class. * class.
* <i>authority</i> is specified as:<p> * <i>authority</i> is specified as:
* <pre> * <pre>
* authority = hostrange [ : portrange ] * authority = hostrange [ : portrange ]
* portrange = portnumber | -portnumber | portnumber-[portnumber] | * * portrange = portnumber | -portnumber | portnumber-[portnumber] | *
...@@ -223,7 +223,7 @@ public final class URLPermission extends Permission { ...@@ -223,7 +223,7 @@ public final class URLPermission extends Permission {
* Checks if this URLPermission implies the given permission. * Checks if this URLPermission implies the given permission.
* Specifically, the following checks are done as if in the * Specifically, the following checks are done as if in the
* following sequence: * following sequence:
* <p><ul> * <ul>
* <li>if 'p' is not an instance of URLPermission return false</li> * <li>if 'p' is not an instance of URLPermission return false</li>
* <li>if any of p's methods are not in this's method list, and if * <li>if any of p's methods are not in this's method list, and if
* this's method list is not equal to "*", then return false.</li> * this's method list is not equal to "*", then return false.</li>
...@@ -242,7 +242,7 @@ public final class URLPermission extends Permission { ...@@ -242,7 +242,7 @@ public final class URLPermission extends Permission {
* <li>otherwise, return false</li> * <li>otherwise, return false</li>
* </ul> * </ul>
* <p>Some examples of how paths are matched are shown below: * <p>Some examples of how paths are matched are shown below:
* <p><table border> * <table border>
* <caption>Examples of Path Matching</caption> * <caption>Examples of Path Matching</caption>
* <tr><th>this's path</th><th>p's path</th><th>match</th></tr> * <tr><th>this's path</th><th>p's path</th><th>match</th></tr>
* <tr><td>/a/b</td><td>/a/b</td><td>yes</td></tr> * <tr><td>/a/b</td><td>/a/b</td><td>yes</td></tr>
...@@ -353,7 +353,7 @@ public final class URLPermission extends Permission { ...@@ -353,7 +353,7 @@ public final class URLPermission extends Permission {
return getActions().hashCode() return getActions().hashCode()
+ scheme.hashCode() + scheme.hashCode()
+ authority.hashCode() + authority.hashCode()
+ path == null ? 0 : path.hashCode(); + (path == null ? 0 : path.hashCode());
} }
......
...@@ -127,9 +127,9 @@ ...@@ -127,9 +127,9 @@
* resources, then convert it into a {@link java.net.URL} when it is time to * resources, then convert it into a {@link java.net.URL} when it is time to
* access the resource. From that URL, you can either get the * access the resource. From that URL, you can either get the
* {@link java.net.URLConnection} for fine control, or get directly the * {@link java.net.URLConnection} for fine control, or get directly the
* InputStream.<p> * InputStream.
* <p>Here is an example:</p> * <p>Here is an example:</p>
* <p><pre> * <pre>
* URI uri = new URI("http://java.sun.com/"); * URI uri = new URI("http://java.sun.com/");
* URL url = uri.toURL(); * URL url = uri.toURL();
* InputStream in = url.openStream(); * InputStream in = url.openStream();
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
* the {@code java.protocol.handler.pkgs} system property. For instance if * the {@code java.protocol.handler.pkgs} system property. For instance if
* it is set to {@code myapp.protocols}, then the URL code will try, in the * it is set to {@code myapp.protocols}, then the URL code will try, in the
* case of http, first to load {@code myapp.protocols.http.Handler}, then, * case of http, first to load {@code myapp.protocols.http.Handler}, then,
* if this fails, {@code http.Handler} from the default location.<p> * if this fails, {@code http.Handler} from the default location.
* <p>Note that the Handler class <b>has to</b> be a subclass of the abstract * <p>Note that the Handler class <b>has to</b> be a subclass of the abstract
* class {@link java.net.URLStreamHandler}.</p> * class {@link java.net.URLStreamHandler}.</p>
* <h2>Additional Specification</h2> * <h2>Additional Specification</h2>
......
...@@ -1129,7 +1129,7 @@ public abstract class $Type$Buffer ...@@ -1129,7 +1129,7 @@ public abstract class $Type$Buffer
* *
* <p> Two $type$ buffers are equal if, and only if, * <p> Two $type$ buffers are equal if, and only if,
* *
* <p><ol> * <ol>
* *
* <li><p> They have the same element type, </p></li> * <li><p> They have the same element type, </p></li>
* *
......
...@@ -355,7 +355,7 @@ public abstract class FileSystem ...@@ -355,7 +355,7 @@ public abstract class FileSystem
* *
* <p> The following rules are used to interpret glob patterns: * <p> The following rules are used to interpret glob patterns:
* *
* <p> <ul> * <ul>
* <li><p> The {@code *} character matches zero or more {@link Character * <li><p> The {@code *} character matches zero or more {@link Character
* characters} of a {@link Path#getName(int) name} component without * characters} of a {@link Path#getName(int) name} component without
* crossing directory boundaries. </p></li> * crossing directory boundaries. </p></li>
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -28,35 +28,38 @@ package java.rmi; ...@@ -28,35 +28,38 @@ package java.rmi;
import java.security.*; import java.security.*;
/** /**
* A subclass of {@link SecurityManager} used by RMI applications that use * {@code RMISecurityManager} implements a policy identical to the policy
* downloaded code. RMI's class loader will not download any classes from * implemented by {@link SecurityManager}. RMI applications
* remote locations if no security manager has been set. * should use the {@code SecurityManager} class or another appropriate
* <code>RMISecurityManager</code> does not apply to applets, which run * {@code SecurityManager} implementation instead of this class. RMI's class
* under the protection of their browser's security manager. * loader will download classes from remote locations only if a security
* manager has been set.
* *
* <code>RMISecurityManager</code> implements a policy that * @implNote
* is no different than the policy implemented by {@link SecurityManager}. * <p>Applets typically run in a container that already has a security
* Therefore an RMI application should use the <code>SecurityManager</code> * manager, so there is generally no need for applets to set a security
* class or another application-specific <code>SecurityManager</code> * manager. If you have a standalone application, you might need to set a
* implementation instead of this class. * {@code SecurityManager} in order to enable class downloading. This can be
* done by adding the following to your code. (It needs to be executed before
* RMI can download code from remote hosts, so it most likely needs to appear
* in the {@code main} method of your application.)
* *
* <p>To use a <code>SecurityManager</code> in your application, add * <pre>{@code
* the following statement to your code (it needs to be executed before RMI * if (System.getSecurityManager() == null) {
* can download code from remote hosts, so it most likely needs to appear
* in the <code>main</code> method of your application):
*
* <pre>
* System.setSecurityManager(new SecurityManager()); * System.setSecurityManager(new SecurityManager());
* </pre> * }
* }</pre>
* *
* @author Roger Riggs * @author Roger Riggs
* @author Peter Jones * @author Peter Jones
* @since JDK1.1 * @since JDK1.1
**/ * @deprecated Use {@link SecurityManager} instead.
*/
@Deprecated
public class RMISecurityManager extends SecurityManager { public class RMISecurityManager extends SecurityManager {
/** /**
* Constructs a new <code>RMISecurityManager</code>. * Constructs a new {@code RMISecurityManager}.
* @since JDK1.1 * @since JDK1.1
*/ */
public RMISecurityManager() { public RMISecurityManager() {
......
...@@ -74,7 +74,7 @@ import sun.security.action.GetIntegerAction; ...@@ -74,7 +74,7 @@ import sun.security.action.GetIntegerAction;
* <code>ActivationGroup</code> will override the system properties * <code>ActivationGroup</code> will override the system properties
* with the properties requested when its * with the properties requested when its
* <code>ActivationGroupDesc</code> was created, and will set a * <code>ActivationGroupDesc</code> was created, and will set a
* <code>java.rmi.RMISecurityManager</code> as the default system * {@link SecurityManager} as the default system
* security manager. If your application requires specific properties * security manager. If your application requires specific properties
* to be set when objects are activated in the group, the application * to be set when objects are activated in the group, the application
* should create a special <code>Properties</code> object containing * should create a special <code>Properties</code> object containing
...@@ -84,7 +84,7 @@ import sun.security.action.GetIntegerAction; ...@@ -84,7 +84,7 @@ import sun.security.action.GetIntegerAction;
* <code>ActivationDesc</code>s (before the default * <code>ActivationDesc</code>s (before the default
* <code>ActivationGroupDesc</code> is created). If your application * <code>ActivationGroupDesc</code> is created). If your application
* requires the use of a security manager other than * requires the use of a security manager other than
* <code>java.rmi.RMISecurityManager</code>, in the * {@link SecurityManager}, in the
* ActivativationGroupDescriptor properties list you can set * ActivativationGroupDescriptor properties list you can set
* <code>java.security.manager</code> property to the name of the security * <code>java.security.manager</code> property to the name of the security
* manager you would like to install. * manager you would like to install.
...@@ -154,21 +154,21 @@ public abstract class ActivationGroup ...@@ -154,21 +154,21 @@ public abstract class ActivationGroup
* active). If the object does not call * active). If the object does not call
* <code>Activatable.inactive</code> when it deactivates, the * <code>Activatable.inactive</code> when it deactivates, the
* object will never be garbage collected since the group keeps * object will never be garbage collected since the group keeps
* strong references to the objects it creates. <p> * strong references to the objects it creates.
* *
* <p>The group's <code>inactiveObject</code> method unexports the * <p>The group's <code>inactiveObject</code> method unexports the
* remote object from the RMI runtime so that the object can no * remote object from the RMI runtime so that the object can no
* longer receive incoming RMI calls. An object will only be unexported * longer receive incoming RMI calls. An object will only be unexported
* if the object has no pending or executing calls. * if the object has no pending or executing calls.
* The subclass of <code>ActivationGroup</code> must override this * The subclass of <code>ActivationGroup</code> must override this
* method and unexport the object. <p> * method and unexport the object.
* *
* <p>After removing the object from the RMI runtime, the group * <p>After removing the object from the RMI runtime, the group
* must inform its <code>ActivationMonitor</code> (via the monitor's * must inform its <code>ActivationMonitor</code> (via the monitor's
* <code>inactiveObject</code> method) that the remote object is * <code>inactiveObject</code> method) that the remote object is
* not currently active so that the remote object will be * not currently active so that the remote object will be
* re-activated by the activator upon a subsequent activation * re-activated by the activator upon a subsequent activation
* request.<p> * request.
* *
* <p>This method simply informs the group's monitor that the object * <p>This method simply informs the group's monitor that the object
* is inactive. It is up to the concrete subclass of ActivationGroup * is inactive. It is up to the concrete subclass of ActivationGroup
...@@ -235,7 +235,7 @@ public abstract class ActivationGroup ...@@ -235,7 +235,7 @@ public abstract class ActivationGroup
* <p>Note that if your application creates its own custom * <p>Note that if your application creates its own custom
* activation group, a security manager must be set for that * activation group, a security manager must be set for that
* group. Otherwise objects cannot be activated in the group. * group. Otherwise objects cannot be activated in the group.
* <code>java.rmi.RMISecurityManager</code> is set by default. * {@link SecurityManager} is set by default.
* *
* <p>If a security manager is already set in the group VM, this * <p>If a security manager is already set in the group VM, this
* method first calls the security manager's * method first calls the security manager's
......
...@@ -67,7 +67,7 @@ public final class VMID implements java.io.Serializable { ...@@ -67,7 +67,7 @@ public final class VMID implements java.io.Serializable {
* conditions: a) the conditions for uniqueness for objects of * conditions: a) the conditions for uniqueness for objects of
* the class <code>java.rmi.server.UID</code> are satisfied, and b) an * the class <code>java.rmi.server.UID</code> are satisfied, and b) an
* address can be obtained for this host that is unique and constant * address can be obtained for this host that is unique and constant
* for the lifetime of this object. <p> * for the lifetime of this object.
*/ */
public VMID() { public VMID() {
addr = randomBytes; addr = randomBytes;
......
...@@ -41,7 +41,15 @@ import java.net.*; ...@@ -41,7 +41,15 @@ import java.net.*;
* (due to a firewall), the runtime uses HTTP with the explicit port * (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 * 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 * communication, then HTTP to a cgi-bin script on the server is used
* to POST the RMI call. * to POST the RMI call. The HTTP tunneling mechanisms are disabled by
* default. This behavior is controlled by the {@code java.rmi.server.disableHttp}
* property, whose default value is {@code true}. Setting this property's
* value to {@code false} will enable the HTTP tunneling mechanisms.
*
* <p><strong>Deprecated: HTTP Tunneling.</strong> <em>The HTTP tunneling mechanisms
* described above, specifically HTTP with an explicit port and HTTP to a
* cgi-bin script, are deprecated. These HTTP tunneling mechanisms are
* subject to removal in a future release of the platform.</em>
* *
* <p>The default socket factory implementation creates server sockets that * <p>The default socket factory implementation creates server sockets that
* are bound to the wildcard address, which accepts requests from all network * are bound to the wildcard address, which accepts requests from all network
......
/* /*
* Copyright (c) 1996, 2004, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
package java.rmi.server; package java.rmi.server;
/** /**
* The <code>RemoteStub</code> class is the common superclass to client * The {@code RemoteStub} class is the common superclass of
* statically generated client
* stubs and provides the framework to support a wide range of remote * stubs and provides the framework to support a wide range of remote
* reference semantics. Stub objects are surrogates that support * reference semantics. Stub objects are surrogates that support
* exactly the same set of remote interfaces defined by the actual * exactly the same set of remote interfaces defined by the actual
...@@ -33,21 +34,26 @@ package java.rmi.server; ...@@ -33,21 +34,26 @@ package java.rmi.server;
* *
* @author Ann Wollrath * @author Ann Wollrath
* @since JDK1.1 * @since JDK1.1
*
* @deprecated Statically generated stubs are deprecated, since
* stubs are generated dynamically. See {@link UnicastRemoteObject}
* for information about dynamic stub generation.
*/ */
@Deprecated
abstract public class RemoteStub extends RemoteObject { abstract public class RemoteStub extends RemoteObject {
/** indicate compatibility with JDK 1.1.x version of class */ /** indicate compatibility with JDK 1.1.x version of class */
private static final long serialVersionUID = -1585587260594494182L; private static final long serialVersionUID = -1585587260594494182L;
/** /**
* Constructs a <code>RemoteStub</code>. * Constructs a {@code RemoteStub}.
*/ */
protected RemoteStub() { protected RemoteStub() {
super(); super();
} }
/** /**
* Constructs a <code>RemoteStub</code>, with the specified remote * Constructs a {@code RemoteStub} with the specified remote
* reference. * reference.
* *
* @param ref the remote reference * @param ref the remote reference
...@@ -58,14 +64,17 @@ abstract public class RemoteStub extends RemoteObject { ...@@ -58,14 +64,17 @@ abstract public class RemoteStub extends RemoteObject {
} }
/** /**
* Sets the remote reference inside the remote stub. * Throws {@link UnsupportedOperationException}.
* *
* @param stub the remote stub * @param stub the remote stub
* @param ref the remote reference * @param ref the remote reference
* @throws UnsupportedOperationException always
* @since JDK1.1 * @since JDK1.1
* @deprecated no replacement. The <code>setRef</code> method * @deprecated No replacement. The {@code setRef} method
* is not needed since <code>RemoteStub</code>s can be created with * was intended for setting the remote reference of a remote
* the <code>RemoteStub(RemoteRef)</code> constructor. * stub. This is unnecessary, since {@code RemoteStub}s can be created
* and initialized with a remote reference through use of
* the {@link #RemoteStub(RemoteRef)} constructor.
*/ */
@Deprecated @Deprecated
protected static void setRef(RemoteStub stub, RemoteRef ref) { protected static void setRef(RemoteStub stub, RemoteRef ref) {
......
/* /*
* Copyright (c) 1996, 1999, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -33,7 +33,9 @@ import java.rmi.*; ...@@ -33,7 +33,9 @@ import java.rmi.*;
* *
* @author Ann Wollrath * @author Ann Wollrath
* @since JDK1.1 * @since JDK1.1
* @deprecated No replacement. This interface is unused and is obsolete.
*/ */
@Deprecated
public interface ServerRef extends RemoteRef { public interface ServerRef extends RemoteRef {
/** indicate compatibility with JDK 1.1.x version of class. */ /** indicate compatibility with JDK 1.1.x version of class. */
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -30,7 +30,9 @@ package java.rmi.server; ...@@ -30,7 +30,9 @@ package java.rmi.server;
* *
* @author Ann Wollrath * @author Ann Wollrath
* @since JDK1.1 * @since JDK1.1
**/ * @deprecated This class is obsolete. Use {@link ExportException} instead.
*/
@Deprecated
public class SocketSecurityException extends ExportException { public class SocketSecurityException extends ExportException {
/* indicate compatibility with JDK 1.1.x version of class */ /* indicate compatibility with JDK 1.1.x version of class */
......
...@@ -30,52 +30,88 @@ import sun.rmi.server.UnicastServerRef2; ...@@ -30,52 +30,88 @@ import sun.rmi.server.UnicastServerRef2;
/** /**
* Used for exporting a remote object with JRMP and obtaining a stub * Used for exporting a remote object with JRMP and obtaining a stub
* that communicates to the remote object. * that communicates to the remote object. Stubs are either generated
* at runtime using dynamic proxy objects, or they are generated statically
* at build time, typically using the {@code rmic} tool.
* *
* <p>For the constructors and static <code>exportObject</code> methods * <p><strong>Deprecated: Static Stubs.</strong> <em>Support for statically
* below, the stub for a remote object being exported is obtained as * generated stubs is deprecated. This includes the API in this class that
* follows: * requires the use of static stubs, as well as the runtime support for
* loading static stubs. Generating stubs dynamically is preferred, using one
* of the five non-deprecated ways of exporting objects as listed below. Do
* not run {@code rmic} to generate static stub classes. It is unnecessary, and
* it is also deprecated.</em>
* *
* <p><ul> * <p>There are six ways to export remote objects:
*
* <ol>
*
* <li>Subclassing {@code UnicastRemoteObject} and calling the
* {@link #UnicastRemoteObject()} constructor.
*
* <li>Subclassing {@code UnicastRemoteObject} and calling the
* {@link #UnicastRemoteObject(int) UnicastRemoteObject(port)} constructor.
*
* <li>Subclassing {@code UnicastRemoteObject} and calling the
* {@link #UnicastRemoteObject(int, RMIClientSocketFactory, RMIServerSocketFactory)
* UnicastRemoteObject(port, csf, ssf)} constructor.
*
* <li>Calling the
* {@link #exportObject(Remote) exportObject(Remote)} method.
* <strong>Deprecated.</strong>
*
* <li>Calling the
* {@link #exportObject(Remote, int) exportObject(Remote, port)} method.
*
* <li>Calling the
* {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)
* exportObject(Remote, port, csf, ssf)} method.
*
* </ol>
*
* <p>The fourth technique, {@link #exportObject(Remote)},
* always uses statically generated stubs and is deprecated.
*
* <p>The other five techniques all use the following approach: if the
* {@code java.rmi.server.ignoreStubClasses} property is {@code true}
* (case insensitive) or if a static stub cannot be found, stubs are generated
* dynamically using {@link java.lang.reflect.Proxy Proxy} objects. Otherwise,
* static stubs are used.
*
* <p>The default value of the
* {@code java.rmi.server.ignoreStubClasses} property is {@code false}.
*
* <p>Statically generated stubs are typically pregenerated from the
* remote object's class using the {@code rmic} tool. A static stub is
* loaded and an instance of that stub class is constructed as described
* below.
* *
* <li>If the remote object is exported using the {@link
* #exportObject(Remote) UnicastRemoteObject.exportObject(Remote)} method,
* a stub class (typically pregenerated from the remote object's class
* using the <code>rmic</code> tool) is loaded and an instance of that stub
* class is constructed as follows.
* <ul> * <ul>
* *
* <li>A "root class" is determined as follows: if the remote object's * <li>A "root class" is determined as follows: if the remote object's
* class directly implements an interface that extends {@link Remote}, then * class directly implements an interface that extends {@link Remote}, then
* the remote object's class is the root class; otherwise, the root class is * the remote object's class is the root class; otherwise, the root class is
* the most derived superclass of the remote object's class that directly * the most derived superclass of the remote object's class that directly
* implements an interface that extends <code>Remote</code>. * implements an interface that extends {@code Remote}.
* *
* <li>The name of the stub class to load is determined by concatenating * <li>The name of the stub class to load is determined by concatenating
* the binary name of the root class with the suffix <code>"_Stub"</code>. * the binary name of the root class with the suffix {@code _Stub}.
* *
* <li>The stub class is loaded by name using the class loader of the root * <li>The stub class is loaded by name using the class loader of the root
* class. The stub class must extend {@link RemoteStub} and must have a * class. The stub class must extend {@link RemoteStub} and must have a
* public constructor that has one parameter, of type {@link RemoteRef}. * public constructor that has one parameter of type {@link RemoteRef}.
* *
* <li>Finally, an instance of the stub class is constructed with a * <li>Finally, an instance of the stub class is constructed with a
* {@link RemoteRef}. * {@link RemoteRef}.
* </ul>
* *
* <li>If the appropriate stub class could not be found, or the stub class * <li>If the appropriate stub class could not be found, or if the stub class
* could not be loaded, or a problem occurs creating the stub instance, a * could not be loaded, or if a problem occurs creating the stub instance, a
* {@link StubNotFoundException} is thrown. * {@link StubNotFoundException} is thrown.
* *
* <p> * </ul>
* <li>For all other means of exporting:
* <p><ul>
* *
* <li>If the remote object's stub class (as defined above) could not be * <p>Stubs are dynamically generated by constructing an instance of
* loaded or the system property * a {@link java.lang.reflect.Proxy Proxy} with the following characteristics:
* <code>java.rmi.server.ignoreStubClasses</code> is set to
* <code>"true"</code> (case insensitive), a {@link
* java.lang.reflect.Proxy} instance is constructed with the following
* properties:
* *
* <ul> * <ul>
* *
...@@ -91,29 +127,13 @@ import sun.rmi.server.UnicastServerRef2; ...@@ -91,29 +127,13 @@ import sun.rmi.server.UnicastServerRef2;
* *
* <li>If the proxy could not be created, a {@link StubNotFoundException} * <li>If the proxy could not be created, a {@link StubNotFoundException}
* will be thrown. * will be thrown.
* </ul>
* *
* <p>
* <li>Otherwise, an instance of the remote object's stub class (as
* described above) is used as the stub.
*
* </ul>
* </ul> * </ul>
* *
* <p>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 * @implNote
* <p>By default, server sockets created by the {@link RMISocketFactory} class * Depending upon which constructor or static method is used for exporting an
* object, {@link RMISocketFactory} may be used for creating sockets.
* By default, server sockets created by {@link RMISocketFactory}
* listen on all network interfaces. See the * listen on all network interfaces. See the
* {@link RMISocketFactory} class and the section * {@link RMISocketFactory} class and the section
* <a href="{@docRoot}/../platform/rmi/spec/rmi-server29.html">RMI Socket Factories</a> * <a href="{@docRoot}/../platform/rmi/spec/rmi-server29.html">RMI Socket Factories</a>
...@@ -148,6 +168,10 @@ public class UnicastRemoteObject extends RemoteServer { ...@@ -148,6 +168,10 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* Creates and exports a new UnicastRemoteObject object using an * Creates and exports a new UnicastRemoteObject object using an
* anonymous port. * anonymous port.
*
* <p>The object is exported with a server socket
* created using the {@link RMISocketFactory} class.
*
* @throws RemoteException if failed to export object * @throws RemoteException if failed to export object
* @since JDK1.1 * @since JDK1.1
*/ */
...@@ -159,6 +183,10 @@ public class UnicastRemoteObject extends RemoteServer { ...@@ -159,6 +183,10 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* Creates and exports a new UnicastRemoteObject object using the * Creates and exports a new UnicastRemoteObject object using the
* particular supplied port. * particular supplied port.
*
* <p>The object is exported with a server socket
* created using the {@link RMISocketFactory} class.
*
* @param port the port number on which the remote object receives calls * @param port the port number on which the remote object receives calls
* (if <code>port</code> is zero, an anonymous port is chosen) * (if <code>port</code> is zero, an anonymous port is chosen)
* @throws RemoteException if failed to export object * @throws RemoteException if failed to export object
...@@ -173,6 +201,11 @@ public class UnicastRemoteObject extends RemoteServer { ...@@ -173,6 +201,11 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* Creates and exports a new UnicastRemoteObject object using the * Creates and exports a new UnicastRemoteObject object using the
* particular supplied port and socket factories. * particular supplied port and socket factories.
*
* <p>Either socket factory may be {@code null}, in which case
* the corresponding client or server socket creation method of
* {@link RMISocketFactory} is used instead.
*
* @param port the port number on which the remote object receives calls * @param port the port number on which the remote object receives calls
* (if <code>port</code> is zero, an anonymous port is chosen) * (if <code>port</code> is zero, an anonymous port is chosen)
* @param csf the client-side socket factory for making calls to the * @param csf the client-side socket factory for making calls to the
...@@ -238,12 +271,23 @@ public class UnicastRemoteObject extends RemoteServer { ...@@ -238,12 +271,23 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* Exports the remote object to make it available to receive incoming * Exports the remote object to make it available to receive incoming
* calls using an anonymous port. * calls using an anonymous port. This method will always return a
* statically generated stub.
*
* <p>The object is exported with a server socket
* created using the {@link RMISocketFactory} class.
*
* @param obj the remote object to be exported * @param obj the remote object to be exported
* @return remote object stub * @return remote object stub
* @exception RemoteException if export fails * @exception RemoteException if export fails
* @since JDK1.1 * @since JDK1.1
* @deprecated This method is deprecated because it supports only static stubs.
* Use {@link #exportObject(Remote, int) exportObject(Remote, port)} or
* {@link #exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)
* exportObject(Remote, port, csf, ssf)}
* instead.
*/ */
@Deprecated
public static RemoteStub exportObject(Remote obj) public static RemoteStub exportObject(Remote obj)
throws RemoteException throws RemoteException
{ {
...@@ -260,6 +304,10 @@ public class UnicastRemoteObject extends RemoteServer { ...@@ -260,6 +304,10 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* Exports the remote object to make it available to receive incoming * Exports the remote object to make it available to receive incoming
* calls, using the particular supplied port. * calls, using the particular supplied port.
*
* <p>The object is exported with a server socket
* created using the {@link RMISocketFactory} class.
*
* @param obj the remote object to be exported * @param obj the remote object to be exported
* @param port the port to export the object on * @param port the port to export the object on
* @return remote object stub * @return remote object stub
...@@ -275,6 +323,11 @@ public class UnicastRemoteObject extends RemoteServer { ...@@ -275,6 +323,11 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* Exports the remote object to make it available to receive incoming * Exports the remote object to make it available to receive incoming
* calls, using a transport specified by the given socket factory. * calls, using a transport specified by the given socket factory.
*
* <p>Either socket factory may be {@code null}, in which case
* the corresponding client or server socket creation method of
* {@link RMISocketFactory} is used instead.
*
* @param obj the remote object to be exported * @param obj the remote object to be exported
* @param port the port to export the object on * @param port the port to export the object on
* @param csf the client-side socket factory for making calls to the * @param csf the client-side socket factory for making calls to the
......
<!-- <!--
Copyright (c) 1998, 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. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
...@@ -32,6 +32,27 @@ side of RMI. A group of classes are used by the stubs and skeletons ...@@ -32,6 +32,27 @@ side of RMI. A group of classes are used by the stubs and skeletons
generated by the rmic stub compiler. Another group of classes generated by the rmic stub compiler. Another group of classes
implements the RMI Transport protocol and HTTP tunneling. implements the RMI Transport protocol and HTTP tunneling.
<p><strong>Deprecated: HTTP Tunneling.</strong> <em>The HTTP tunneling
mechanism has been deprecated. See {@link java.rmi.server.RMISocketFactory} for
further information.</em>
<p><strong>Deprecated: Skeletons and Static Stubs.</strong>
<em>Skeletons and statically generated stubs are deprecated. This
includes the APIs in this package that require the use of skeletons
or static stubs, the runtime support for them, and the use of the
{@code rmic} stub compiler to generate them. Support for skeletons
and static stubs may be removed in a future release of the
platform. Skeletons are unnecessary, as server-side method dispatching
is handled directly by the RMI runtime. Statically generated stubs are
unnecessary, as stubs are generated dynamically using {@link
java.lang.reflect.Proxy Proxy} objects. See {@link
java.rmi.server.UnicastRemoteObject UnicastRemoteObject} for
information about dynamic stub generation. Generation of skeletons and
static stubs was typically performed as part of an application's build
process by calling the {@code rmic} tool. This is unnecessary, and
calls to {@code rmic} can simply be omitted.</em>
<!-- <!--
<h2>Package Specification</h2> <h2>Package Specification</h2>
......
...@@ -350,6 +350,10 @@ public final class AccessControlContext { ...@@ -350,6 +350,10 @@ public final class AccessControlContext {
return combiner; return combiner;
} }
boolean isAuthorized() {
return isAuthorized;
}
/** /**
* Determines whether the access request indicated by the * Determines whether the access request indicated by the
* specified permission should be allowed or denied, based on * specified permission should be allowed or denied, based on
......
...@@ -39,9 +39,9 @@ import sun.reflect.Reflection; ...@@ -39,9 +39,9 @@ import sun.reflect.Reflection;
* <ul> * <ul>
* <li> to decide whether an access to a critical system * <li> to decide whether an access to a critical system
* resource is to be allowed or denied, based on the security policy * resource is to be allowed or denied, based on the security policy
* currently in effect,<p> * currently in effect,
* <li>to mark code as being "privileged", thus affecting subsequent * <li>to mark code as being "privileged", thus affecting subsequent
* access determinations, and<p> * access determinations, and
* <li>to obtain a "snapshot" of the current calling context so * <li>to obtain a "snapshot" of the current calling context so
* access-control decisions from a different context can be made with * access-control decisions from a different context can be made with
* respect to the saved context. </ul> * respect to the saved context. </ul>
...@@ -344,9 +344,10 @@ public final class AccessController { ...@@ -344,9 +344,10 @@ public final class AccessController {
* If the action's {@code run} method throws an (unchecked) exception, * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method. * it will propagate through this method.
* <p> * <p>
* If a security manager is installed and the {@code AccessControlContext} * If a security manager is installed and the specified
* was not created by system code and the caller's {@code ProtectionDomain} * {@code AccessControlContext} was not created by system code and the
* has not been granted the {@literal "createAccessControlContext"} * caller's {@code ProtectionDomain} has not been granted the
* {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed * {@link java.security.SecurityPermission}, then the action is performed
* with no permissions. * with no permissions.
* *
...@@ -384,6 +385,13 @@ public final class AccessController { ...@@ -384,6 +385,13 @@ public final class AccessController {
* <p> * <p>
* If the action's {@code run} method throws an (unchecked) exception, * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method. * it will propagate through this method.
* <p>
* If a security manager is installed and the specified
* {@code AccessControlContext} was not created by system code and the
* caller's {@code ProtectionDomain} has not been granted the
* {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed
* with no permissions.
* *
* @param <T> the type of the value returned by the PrivilegedAction's * @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method. * {@code run} method.
...@@ -438,6 +446,13 @@ public final class AccessController { ...@@ -438,6 +446,13 @@ public final class AccessController {
* *
* <p> This method preserves the current AccessControlContext's * <p> This method preserves the current AccessControlContext's
* DomainCombiner (which may be null) while the action is performed. * DomainCombiner (which may be null) while the action is performed.
* <p>
* If a security manager is installed and the specified
* {@code AccessControlContext} was not created by system code and the
* caller's {@code ProtectionDomain} has not been granted the
* {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed
* with no permissions.
* *
* @param <T> the type of the value returned by the PrivilegedAction's * @param <T> the type of the value returned by the PrivilegedAction's
* {@code run} method. * {@code run} method.
...@@ -571,9 +586,19 @@ public final class AccessController { ...@@ -571,9 +586,19 @@ public final class AccessController {
AccessControlContext parent, AccessControlContext context, AccessControlContext parent, AccessControlContext context,
Permission[] perms) Permission[] perms)
{ {
return new AccessControlContext(getCallerPD(caller), combiner, parent, ProtectionDomain callerPD = getCallerPD(caller);
// check if caller is authorized to create context
if (context != null && !context.isAuthorized() &&
System.getSecurityManager() != null &&
!callerPD.impliesCreateAccessControlContext())
{
ProtectionDomain nullPD = new ProtectionDomain(null, null);
return new AccessControlContext(new ProtectionDomain[] { nullPD });
} else {
return new AccessControlContext(callerPD, combiner, parent,
context, perms); context, perms);
} }
}
private static ProtectionDomain getCallerPD(final Class <?> caller) { private static ProtectionDomain getCallerPD(final Class <?> caller) {
ProtectionDomain callerPd = doPrivileged ProtectionDomain callerPd = doPrivileged
...@@ -597,9 +622,10 @@ public final class AccessController { ...@@ -597,9 +622,10 @@ public final class AccessController {
* If the action's {@code run} method throws an <i>unchecked</i> * If the action's {@code run} method throws an <i>unchecked</i>
* exception, it will propagate through this method. * exception, it will propagate through this method.
* <p> * <p>
* If a security manager is installed and the {@code AccessControlContext} * If a security manager is installed and the specified
* was not created by system code and the caller's {@code ProtectionDomain} * {@code AccessControlContext} was not created by system code and the
* has not been granted the {@literal "createAccessControlContext"} * caller's {@code ProtectionDomain} has not been granted the
* {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed * {@link java.security.SecurityPermission}, then the action is performed
* with no permissions. * with no permissions.
* *
...@@ -641,6 +667,13 @@ public final class AccessController { ...@@ -641,6 +667,13 @@ public final class AccessController {
* <p> * <p>
* If the action's {@code run} method throws an (unchecked) exception, * If the action's {@code run} method throws an (unchecked) exception,
* it will propagate through this method. * it will propagate through this method.
* <p>
* If a security manager is installed and the specified
* {@code AccessControlContext} was not created by system code and the
* caller's {@code ProtectionDomain} has not been granted the
* {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed
* with no permissions.
* *
* @param <T> the type of the value returned by the * @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method. * PrivilegedExceptionAction's {@code run} method.
...@@ -697,6 +730,13 @@ public final class AccessController { ...@@ -697,6 +730,13 @@ public final class AccessController {
* *
* <p> This method preserves the current AccessControlContext's * <p> This method preserves the current AccessControlContext's
* DomainCombiner (which may be null) while the action is performed. * DomainCombiner (which may be null) while the action is performed.
* <p>
* If a security manager is installed and the specified
* {@code AccessControlContext} was not created by system code and the
* caller's {@code ProtectionDomain} has not been granted the
* {@literal "createAccessControlContext"}
* {@link java.security.SecurityPermission}, then the action is performed
* with no permissions.
* *
* @param <T> the type of the value returned by the * @param <T> the type of the value returned by the
* PrivilegedExceptionAction's {@code run} method. * PrivilegedExceptionAction's {@code run} method.
......
...@@ -48,7 +48,7 @@ import java.security.spec.AlgorithmParameterSpec; ...@@ -48,7 +48,7 @@ import java.security.spec.AlgorithmParameterSpec;
* of the prime modulus (in bits). * of the prime modulus (in bits).
* When using this approach, algorithm-specific parameter generation * When using this approach, algorithm-specific parameter generation
* values - if any - default to some standard values, unless they can be * values - if any - default to some standard values, unless they can be
* derived from the specified size.<P> * derived from the specified size.
* *
* <li>The other approach initializes a parameter generator object * <li>The other approach initializes a parameter generator object
* using algorithm-specific semantics, which are represented by a set of * using algorithm-specific semantics, which are represented by a set of
......
...@@ -57,7 +57,6 @@ import java.io.IOException; ...@@ -57,7 +57,6 @@ import java.io.IOException;
* Subclasses may implement actions on top of BasicPermission, * Subclasses may implement actions on top of BasicPermission,
* if desired. * if desired.
* <p> * <p>
* <P>
* @see java.security.Permission * @see java.security.Permission
* @see java.security.Permissions * @see java.security.Permissions
* @see java.security.PermissionCollection * @see java.security.PermissionCollection
...@@ -153,9 +152,9 @@ public abstract class BasicPermission extends Permission ...@@ -153,9 +152,9 @@ public abstract class BasicPermission extends Permission
* Checks if the specified permission is "implied" by * Checks if the specified permission is "implied" by
* this object. * this object.
* <P> * <P>
* More specifically, this method returns true if:<p> * More specifically, this method returns true if:
* <ul> * <ul>
* <li> <i>p</i>'s class is the same as this object's class, and<p> * <li> <i>p</i>'s class is the same as this object's class, and
* <li> <i>p</i>'s name equals or (in the case of wildcards) * <li> <i>p</i>'s name equals or (in the case of wildcards)
* is implied by this object's * is implied by this object's
* name. For example, "a.b.*" implies "a.b.c". * name. For example, "a.b.*" implies "a.b.c".
......
...@@ -234,7 +234,7 @@ public class CodeSource implements java.io.Serializable { ...@@ -234,7 +234,7 @@ public class CodeSource implements java.io.Serializable {
* Returns true if this CodeSource object "implies" the specified CodeSource. * Returns true if this CodeSource object "implies" the specified CodeSource.
* <p> * <p>
* More specifically, this method makes the following checks. * More specifically, this method makes the following checks.
* If any fail, it returns false. If they all succeed, it returns true.<p> * If any fail, it returns false. If they all succeed, it returns true.
* <ul> * <ul>
* <li> <i>codesource</i> must not be null. * <li> <i>codesource</i> must not be null.
* <li> If this object's certificates are not null, then all * <li> If this object's certificates are not null, then all
...@@ -242,7 +242,7 @@ public class CodeSource implements java.io.Serializable { ...@@ -242,7 +242,7 @@ public class CodeSource implements java.io.Serializable {
* certificates. * certificates.
* <li> If this object's location (getLocation()) is not null, then the * <li> If this object's location (getLocation()) is not null, then the
* following checks are made against this object's location and * following checks are made against this object's location and
* <i>codesource</i>'s:<p> * <i>codesource</i>'s:
* <ul> * <ul>
* <li> <i>codesource</i>'s location must not be null. * <li> <i>codesource</i>'s location must not be null.
* *
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册