提交 81dc45c9 编写于 作者: L lana

Merge

...@@ -218,3 +218,4 @@ a2a2a91075ad85becbe10a39d7fd04ef9bea8df5 jdk8-b92 ...@@ -218,3 +218,4 @@ a2a2a91075ad85becbe10a39d7fd04ef9bea8df5 jdk8-b92
51479fa56b7c4363c6d87c2e8b898d8185cf4b22 jdk8-b94 51479fa56b7c4363c6d87c2e8b898d8185cf4b22 jdk8-b94
42aa9f1828852bb8b77e98ec695211493ae0759d jdk8-b95 42aa9f1828852bb8b77e98ec695211493ae0759d jdk8-b95
4a5d3cf2b3af1660db0237e8da324c140e534fa4 jdk8-b96 4a5d3cf2b3af1660db0237e8da324c140e534fa4 jdk8-b96
978a95239044f26dcc8a6d59246be07ad6ca6be2 jdk8-b97
...@@ -400,7 +400,8 @@ TOOLS = \ ...@@ -400,7 +400,8 @@ TOOLS = \
# classes that go into jfr.jar # classes that go into jfr.jar
JFR_CLASSES_DIRS= \ JFR_CLASSES_DIRS= \
com/oracle/jrockit/jfr \ com/oracle/jrockit/jfr \
oracle/jrockit/jfr oracle/jrockit/jfr \
jdk/jfr
# classes that go into jsse.jar # classes that go into jsse.jar
JSSE_CLASSES_DIRS = \ JSSE_CLASSES_DIRS = \
...@@ -612,6 +613,7 @@ ifndef JAVASE_EMBEDDED ...@@ -612,6 +613,7 @@ ifndef JAVASE_EMBEDDED
$(ECHO) "oracle/jrockit/jfr/parser/" >> $@ $(ECHO) "oracle/jrockit/jfr/parser/" >> $@
$(ECHO) "oracle/jrockit/jfr/settings/" >> $@ $(ECHO) "oracle/jrockit/jfr/settings/" >> $@
$(ECHO) "oracle/jrockit/jfr/tools/" >> $@ $(ECHO) "oracle/jrockit/jfr/tools/" >> $@
$(ECHO) "jdk/jfr/" >> $@
endif endif
endif endif
......
# #
# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # 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
...@@ -529,7 +529,6 @@ JAVA_JAVA_java = \ ...@@ -529,7 +529,6 @@ JAVA_JAVA_java = \
sun/misc/JavaNioAccess.java \ sun/misc/JavaNioAccess.java \
sun/misc/Perf.java \ sun/misc/Perf.java \
sun/misc/PerfCounter.java \ sun/misc/PerfCounter.java \
sun/misc/Hashing.java \
sun/net/www/protocol/jar/Handler.java \ sun/net/www/protocol/jar/Handler.java \
sun/net/www/protocol/jar/JarURLConnection.java \ sun/net/www/protocol/jar/JarURLConnection.java \
sun/net/www/protocol/file/Handler.java \ sun/net/www/protocol/file/Handler.java \
......
...@@ -246,7 +246,8 @@ RT_JAR_EXCLUDES += \ ...@@ -246,7 +246,8 @@ RT_JAR_EXCLUDES += \
sun/util/resources/cldr \ sun/util/resources/cldr \
$(LOCALEDATA_INCLUDES) \ $(LOCALEDATA_INCLUDES) \
com/oracle/jrockit/jfr \ com/oracle/jrockit/jfr \
oracle/jrockit/jfr oracle/jrockit/jfr \
jdk/jfr
ifeq ($(OPENJDK_TARGET_OS), macosx) ifeq ($(OPENJDK_TARGET_OS), macosx)
RT_JAR_EXCLUDES += com/sun/nio/sctp \ RT_JAR_EXCLUDES += com/sun/nio/sctp \
...@@ -428,7 +429,8 @@ ifeq ($(ENABLE_JFR), true) ...@@ -428,7 +429,8 @@ ifeq ($(ENABLE_JFR), true)
SRCS:=$(JDK_OUTPUTDIR)/classes,\ SRCS:=$(JDK_OUTPUTDIR)/classes,\
SUFFIXES:=.class .jfc .xsd,\ SUFFIXES:=.class .jfc .xsd,\
INCLUDES:=com/oracle/jrockit/jfr \ INCLUDES:=com/oracle/jrockit/jfr \
oracle/jrockit/jfr,\ oracle/jrockit/jfr \
jdk/jfr,\
JAR:=$(IMAGES_OUTPUTDIR)/lib/jfr.jar,\ JAR:=$(IMAGES_OUTPUTDIR)/lib/jfr.jar,\
SKIP_METAINF:=true,\ SKIP_METAINF:=true,\
MANIFEST:=$(MAINMANIFEST), \ MANIFEST:=$(MAINMANIFEST), \
......
...@@ -125,13 +125,11 @@ PROFILE_3_JRE_LIB_FILES := \ ...@@ -125,13 +125,11 @@ PROFILE_3_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
jfr.jar \
jvm.hprof.txt \ jvm.hprof.txt \
management-agent.jar \ management-agent.jar \
management/jmxremote.access \ management/jmxremote.access \
...@@ -164,6 +162,7 @@ FULL_JRE_LIB_FILES := \ ...@@ -164,6 +162,7 @@ FULL_JRE_LIB_FILES := \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \
$(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \
...@@ -214,6 +213,7 @@ FULL_JRE_LIB_FILES := \ ...@@ -214,6 +213,7 @@ FULL_JRE_LIB_FILES := \
images/cursors/motif_MoveDrop32x32.gif \ images/cursors/motif_MoveDrop32x32.gif \
images/cursors/motif_MoveNoDrop32x32.gif \ images/cursors/motif_MoveNoDrop32x32.gif \
jexec \ jexec \
jfr.jar \
oblique-fonts/LucidaSansDemiOblique.ttf \ oblique-fonts/LucidaSansDemiOblique.ttf \
oblique-fonts/LucidaSansOblique.ttf \ oblique-fonts/LucidaSansOblique.ttf \
oblique-fonts/LucidaTypewriterBoldOblique.ttf \ oblique-fonts/LucidaTypewriterBoldOblique.ttf \
......
/* /*
* Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 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
......
...@@ -127,8 +127,21 @@ public class CEmbeddedFrame extends EmbeddedFrame { ...@@ -127,8 +127,21 @@ public class CEmbeddedFrame extends EmbeddedFrame {
} }
} }
/**
* When the parent window is activated this method is called for all EmbeddedFrames in it.
*
* For the CEmbeddedFrame which had focus before the deactivation this method triggers
* focus events in the following order:
* 1. WINDOW_ACTIVATED for this EmbeddedFrame
* 2. WINDOW_GAINED_FOCUS for this EmbeddedFrame
* 3. FOCUS_GAINED for the most recent focus owner in this EmbeddedFrame
*
* The caller must not requestFocus on the EmbeddedFrame together with calling this method.
*
* @param parentWindowActive true if the window is activated, false otherwise
*/
// handleWindowFocusEvent is called for all applets, when the browser // handleWindowFocusEvent is called for all applets, when the browser
// becames active/inactive. This event should be filtered out for // becomes active/inactive. This event should be filtered out for
// non-focused applet. This method can be called from different threads. // non-focused applet. This method can be called from different threads.
public void handleWindowFocusEvent(boolean parentWindowActive) { public void handleWindowFocusEvent(boolean parentWindowActive) {
this.parentWindowActive = parentWindowActive; this.parentWindowActive = parentWindowActive;
......
...@@ -377,7 +377,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable { ...@@ -377,7 +377,7 @@ public class XMLEncoder extends Encoder implements AutoCloseable {
Object arg = args[i]; Object arg = args[i];
mark(arg, true); mark(arg, true);
} }
mark(stm.getTarget(), false); mark(stm.getTarget(), stm instanceof Expression);
} }
......
/* /*
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 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
...@@ -205,9 +205,9 @@ public final class Boolean implements java.io.Serializable, ...@@ -205,9 +205,9 @@ public final class Boolean implements java.io.Serializable,
* Returns a hash code for a {@code boolean} value; compatible with * Returns a hash code for a {@code boolean} value; compatible with
* {@code Boolean.hashCode()}. * {@code Boolean.hashCode()}.
* *
* @since 1.8 * @param value the value to hash
*
* @return a hash code value for a {@code boolean} value. * @return a hash code value for a {@code boolean} value.
* @since 1.8
*/ */
public static int hashCode(boolean value) { public static int hashCode(boolean value) {
return value ? 1231 : 1237; return value ? 1231 : 1237;
......
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
...@@ -398,9 +398,9 @@ public final class Byte extends Number implements Comparable<Byte> { ...@@ -398,9 +398,9 @@ public final class Byte extends Number implements Comparable<Byte> {
* Returns a hash code for a {@code byte} value; compatible with * Returns a hash code for a {@code byte} value; compatible with
* {@code Byte.hashCode()}. * {@code Byte.hashCode()}.
* *
* @since 1.8 * @param value the value to hash
*
* @return a hash code value for a {@code byte} value. * @return a hash code value for a {@code byte} value.
* @since 1.8
*/ */
public static int hashCode(byte value) { public static int hashCode(byte value) {
return (int)value; return (int)value;
......
...@@ -3250,6 +3250,8 @@ public final class Class<T> implements java.io.Serializable, ...@@ -3250,6 +3250,8 @@ public final class Class<T> implements java.io.Serializable,
* could not be checked at runtime (because generic types are implemented * could not be checked at runtime (because generic types are implemented
* by erasure). * by erasure).
* *
* @param <U> the type to cast this class object to
* @param clazz the class of the type to cast this class object to
* @return this {@code Class} object, cast to represent a subclass of * @return this {@code Class} object, cast to represent a subclass of
* the specified class object. * the specified class object.
* @throws ClassCastException if this {@code Class} object does not * @throws ClassCastException if this {@code Class} object does not
...@@ -3405,6 +3407,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -3405,6 +3407,7 @@ public final class Class<T> implements java.io.Serializable,
* If this Class represents either the Object class, an interface type, an * If this Class represents either the Object class, an interface type, an
* array type, a primitive type, or void, the return value is null. * array type, a primitive type, or void, the return value is null.
* *
* @return an object representing the superclass
* @since 1.8 * @since 1.8
*/ */
public AnnotatedType getAnnotatedSuperclass() { public AnnotatedType getAnnotatedSuperclass() {
...@@ -3436,6 +3439,7 @@ public final class Class<T> implements java.io.Serializable, ...@@ -3436,6 +3439,7 @@ public final class Class<T> implements java.io.Serializable,
* If this Class represents either the Object class, an array type, a * If this Class represents either the Object class, an array type, a
* primitive type, or void, the return value is an array of length 0. * primitive type, or void, the return value is an array of length 0.
* *
* @return an array representing the superinterfaces
* @since 1.8 * @since 1.8
*/ */
public AnnotatedType[] getAnnotatedInterfaces() { public AnnotatedType[] getAnnotatedInterfaces() {
......
...@@ -453,8 +453,7 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -453,8 +453,7 @@ public final class Double extends Number implements Comparable<Double> {
* a {@code NumberFormatException} be thrown, the regular * a {@code NumberFormatException} be thrown, the regular
* expression below can be used to screen the input string: * expression below can be used to screen the input string:
* *
* <code> * <pre>{@code
* <pre>
* final String Digits = "(\\p{Digit}+)"; * final String Digits = "(\\p{Digit}+)";
* final String HexDigits = "(\\p{XDigit}+)"; * final String HexDigits = "(\\p{XDigit}+)";
* // an exponent is 'e' or 'E' followed by an optionally * // an exponent is 'e' or 'E' followed by an optionally
...@@ -474,7 +473,7 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -474,7 +473,7 @@ public final class Double extends Number implements Comparable<Double> {
* // in addition to strings of floating-point literals, the * // in addition to strings of floating-point literals, the
* // two sub-patterns below are simplifications of the grammar * // two sub-patterns below are simplifications of the grammar
* // productions from section 3.10.2 of * // productions from section 3.10.2 of
* // <cite>The Java&trade; Language Specification</cite>. * // The Java Language Specification.
* *
* // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt * // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
* "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+ * "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
...@@ -499,8 +498,7 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -499,8 +498,7 @@ public final class Double extends Number implements Comparable<Double> {
* else { * else {
* // Perform suitable alternative action * // Perform suitable alternative action
* } * }
* </pre> * }</pre>
* </code>
* *
* @param s the string to be parsed. * @param s the string to be parsed.
* @return a {@code Double} object holding the value * @return a {@code Double} object holding the value
...@@ -756,9 +754,9 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -756,9 +754,9 @@ public final class Double extends Number implements Comparable<Double> {
* Returns a hash code for a {@code double} value; compatible with * Returns a hash code for a {@code double} value; compatible with
* {@code Double.hashCode()}. * {@code Double.hashCode()}.
* *
* @since 1.8 * @param value the value to hash
*
* @return a hash code value for a {@code double} value. * @return a hash code value for a {@code double} value.
* @since 1.8
*/ */
public static int hashCode(double value) { public static int hashCode(double value) {
long bits = doubleToLongBits(value); long bits = doubleToLongBits(value);
......
...@@ -664,9 +664,9 @@ public final class Float extends Number implements Comparable<Float> { ...@@ -664,9 +664,9 @@ public final class Float extends Number implements Comparable<Float> {
* Returns a hash code for a {@code float} value; compatible with * Returns a hash code for a {@code float} value; compatible with
* {@code Float.hashCode()}. * {@code Float.hashCode()}.
* *
* @since 1.8 * @param value the value to hash
*
* @return a hash code value for a {@code float} value. * @return a hash code value for a {@code float} value.
* @since 1.8
*/ */
public static int hashCode(float value) { public static int hashCode(float value) {
return floatToIntBits(value); return floatToIntBits(value);
......
...@@ -951,6 +951,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -951,6 +951,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* Returns a hash code for a {@code int} value; compatible with * Returns a hash code for a {@code int} value; compatible with
* {@code Integer.hashCode()}. * {@code Integer.hashCode()}.
* *
* @param value the value to hash
* @since 1.8 * @since 1.8
* *
* @return a hash code value for a {@code int} value. * @return a hash code value for a {@code int} value.
...@@ -1336,6 +1337,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1336,6 +1337,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* one-bits in its two's complement binary representation, that is, if it * one-bits in its two's complement binary representation, that is, if it
* is equal to zero. * is equal to zero.
* *
* @param i the value whose highest one bit is to be computed
* @return an {@code int} value with a single one-bit, in the position * @return an {@code int} value with a single one-bit, in the position
* of the highest-order one-bit in the specified value, or zero if * of the highest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero. * the specified value is itself equal to zero.
...@@ -1358,6 +1360,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1358,6 +1360,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* one-bits in its two's complement binary representation, that is, if it * one-bits in its two's complement binary representation, that is, if it
* is equal to zero. * is equal to zero.
* *
* @param i the value whose lowest one bit is to be computed
* @return an {@code int} value with a single one-bit, in the position * @return an {@code int} value with a single one-bit, in the position
* of the lowest-order one-bit in the specified value, or zero if * of the lowest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero. * the specified value is itself equal to zero.
...@@ -1382,6 +1385,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1382,6 +1385,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* <li>ceil(log<sub>2</sub>(x)) = {@code 32 - numberOfLeadingZeros(x - 1)} * <li>ceil(log<sub>2</sub>(x)) = {@code 32 - numberOfLeadingZeros(x - 1)}
* </ul> * </ul>
* *
* @param i the value whose number of leading zeros is to be computed
* @return the number of zero bits preceding the highest-order * @return the number of zero bits preceding the highest-order
* ("leftmost") one-bit in the two's complement binary representation * ("leftmost") one-bit in the two's complement binary representation
* of the specified {@code int} value, or 32 if the value * of the specified {@code int} value, or 32 if the value
...@@ -1408,6 +1412,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1408,6 +1412,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* one-bits in its two's complement representation, in other words if it is * one-bits in its two's complement representation, in other words if it is
* equal to zero. * equal to zero.
* *
* @param i the value whose number of trailing zeros is to be computed
* @return the number of zero bits following the lowest-order ("rightmost") * @return the number of zero bits following the lowest-order ("rightmost")
* one-bit in the two's complement binary representation of the * one-bit in the two's complement binary representation of the
* specified {@code int} value, or 32 if the value is equal * specified {@code int} value, or 32 if the value is equal
...@@ -1431,6 +1436,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1431,6 +1436,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* representation of the specified {@code int} value. This function is * representation of the specified {@code int} value. This function is
* sometimes referred to as the <i>population count</i>. * sometimes referred to as the <i>population count</i>.
* *
* @param i the value whose bits are to be counted
* @return the number of one-bits in the two's complement binary * @return the number of one-bits in the two's complement binary
* representation of the specified {@code int} value. * representation of the specified {@code int} value.
* @since 1.5 * @since 1.5
...@@ -1458,6 +1464,8 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1458,6 +1464,8 @@ public final class Integer extends Number implements Comparable<Integer> {
* ignored, even if the distance is negative: {@code rotateLeft(val, * ignored, even if the distance is negative: {@code rotateLeft(val,
* distance) == rotateLeft(val, distance & 0x1F)}. * distance) == rotateLeft(val, distance & 0x1F)}.
* *
* @param i the value whose bits are to be rotated left
* @param distance the number of bit positions to rotate left
* @return the value obtained by rotating the two's complement binary * @return the value obtained by rotating the two's complement binary
* representation of the specified {@code int} value left by the * representation of the specified {@code int} value left by the
* specified number of bits. * specified number of bits.
...@@ -1480,6 +1488,8 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1480,6 +1488,8 @@ public final class Integer extends Number implements Comparable<Integer> {
* ignored, even if the distance is negative: {@code rotateRight(val, * ignored, even if the distance is negative: {@code rotateRight(val,
* distance) == rotateRight(val, distance & 0x1F)}. * distance) == rotateRight(val, distance & 0x1F)}.
* *
* @param i the value whose bits are to be rotated right
* @param distance the number of bit positions to rotate right
* @return the value obtained by rotating the two's complement binary * @return the value obtained by rotating the two's complement binary
* representation of the specified {@code int} value right by the * representation of the specified {@code int} value right by the
* specified number of bits. * specified number of bits.
...@@ -1494,6 +1504,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1494,6 +1504,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* two's complement binary representation of the specified {@code int} * two's complement binary representation of the specified {@code int}
* value. * value.
* *
* @param i the value to be reversed
* @return the value obtained by reversing order of the bits in the * @return the value obtained by reversing order of the bits in the
* specified {@code int} value. * specified {@code int} value.
* @since 1.5 * @since 1.5
...@@ -1513,6 +1524,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1513,6 +1524,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* return value is -1 if the specified value is negative; 0 if the * return value is -1 if the specified value is negative; 0 if the
* specified value is zero; and 1 if the specified value is positive.) * specified value is zero; and 1 if the specified value is positive.)
* *
* @param i the value whose signum is to be computed
* @return the signum function of the specified {@code int} value. * @return the signum function of the specified {@code int} value.
* @since 1.5 * @since 1.5
*/ */
...@@ -1525,6 +1537,7 @@ public final class Integer extends Number implements Comparable<Integer> { ...@@ -1525,6 +1537,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* Returns the value obtained by reversing the order of the bytes in the * Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code int} value. * two's complement representation of the specified {@code int} value.
* *
* @param i the value whose bytes are to be reversed
* @return the value obtained by reversing the bytes in the specified * @return the value obtained by reversing the bytes in the specified
* {@code int} value. * {@code int} value.
* @since 1.5 * @since 1.5
......
...@@ -1053,9 +1053,9 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1053,9 +1053,9 @@ public final class Long extends Number implements Comparable<Long> {
* Returns a hash code for a {@code long} value; compatible with * Returns a hash code for a {@code long} value; compatible with
* {@code Long.hashCode()}. * {@code Long.hashCode()}.
* *
* @since 1.8 * @param value the value to hash
*
* @return a hash code value for a {@code long} value. * @return a hash code value for a {@code long} value.
* @since 1.8
*/ */
public static int hashCode(long value) { public static int hashCode(long value) {
return (int)(value ^ (value >>> 32)); return (int)(value ^ (value >>> 32));
...@@ -1357,6 +1357,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1357,6 +1357,7 @@ public final class Long extends Number implements Comparable<Long> {
* one-bits in its two's complement binary representation, that is, if it * one-bits in its two's complement binary representation, that is, if it
* is equal to zero. * is equal to zero.
* *
* @param i the value whose highest one bit is to be computed
* @return a {@code long} value with a single one-bit, in the position * @return a {@code long} value with a single one-bit, in the position
* of the highest-order one-bit in the specified value, or zero if * of the highest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero. * the specified value is itself equal to zero.
...@@ -1380,6 +1381,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1380,6 +1381,7 @@ public final class Long extends Number implements Comparable<Long> {
* one-bits in its two's complement binary representation, that is, if it * one-bits in its two's complement binary representation, that is, if it
* is equal to zero. * is equal to zero.
* *
* @param i the value whose lowest one bit is to be computed
* @return a {@code long} value with a single one-bit, in the position * @return a {@code long} value with a single one-bit, in the position
* of the lowest-order one-bit in the specified value, or zero if * of the lowest-order one-bit in the specified value, or zero if
* the specified value is itself equal to zero. * the specified value is itself equal to zero.
...@@ -1404,6 +1406,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1404,6 +1406,7 @@ public final class Long extends Number implements Comparable<Long> {
* <li>ceil(log<sub>2</sub>(x)) = {@code 64 - numberOfLeadingZeros(x - 1)} * <li>ceil(log<sub>2</sub>(x)) = {@code 64 - numberOfLeadingZeros(x - 1)}
* </ul> * </ul>
* *
* @param i the value whose number of leading zeros is to be computed
* @return the number of zero bits preceding the highest-order * @return the number of zero bits preceding the highest-order
* ("leftmost") one-bit in the two's complement binary representation * ("leftmost") one-bit in the two's complement binary representation
* of the specified {@code long} value, or 64 if the value * of the specified {@code long} value, or 64 if the value
...@@ -1432,6 +1435,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1432,6 +1435,7 @@ public final class Long extends Number implements Comparable<Long> {
* one-bits in its two's complement representation, in other words if it is * one-bits in its two's complement representation, in other words if it is
* equal to zero. * equal to zero.
* *
* @param i the value whose number of trailing zeros is to be computed
* @return the number of zero bits following the lowest-order ("rightmost") * @return the number of zero bits following the lowest-order ("rightmost")
* one-bit in the two's complement binary representation of the * one-bit in the two's complement binary representation of the
* specified {@code long} value, or 64 if the value is equal * specified {@code long} value, or 64 if the value is equal
...@@ -1456,6 +1460,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1456,6 +1460,7 @@ public final class Long extends Number implements Comparable<Long> {
* representation of the specified {@code long} value. This function is * representation of the specified {@code long} value. This function is
* sometimes referred to as the <i>population count</i>. * sometimes referred to as the <i>population count</i>.
* *
* @param i the value whose bits are to be counted
* @return the number of one-bits in the two's complement binary * @return the number of one-bits in the two's complement binary
* representation of the specified {@code long} value. * representation of the specified {@code long} value.
* @since 1.5 * @since 1.5
...@@ -1484,6 +1489,8 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1484,6 +1489,8 @@ public final class Long extends Number implements Comparable<Long> {
* ignored, even if the distance is negative: {@code rotateLeft(val, * ignored, even if the distance is negative: {@code rotateLeft(val,
* distance) == rotateLeft(val, distance & 0x3F)}. * distance) == rotateLeft(val, distance & 0x3F)}.
* *
* @param i the value whose bits are to be rotated left
* @param distance the number of bit positions to rotate left
* @return the value obtained by rotating the two's complement binary * @return the value obtained by rotating the two's complement binary
* representation of the specified {@code long} value left by the * representation of the specified {@code long} value left by the
* specified number of bits. * specified number of bits.
...@@ -1506,6 +1513,8 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1506,6 +1513,8 @@ public final class Long extends Number implements Comparable<Long> {
* ignored, even if the distance is negative: {@code rotateRight(val, * ignored, even if the distance is negative: {@code rotateRight(val,
* distance) == rotateRight(val, distance & 0x3F)}. * distance) == rotateRight(val, distance & 0x3F)}.
* *
* @param i the value whose bits are to be rotated right
* @param distance the number of bit positions to rotate right
* @return the value obtained by rotating the two's complement binary * @return the value obtained by rotating the two's complement binary
* representation of the specified {@code long} value right by the * representation of the specified {@code long} value right by the
* specified number of bits. * specified number of bits.
...@@ -1520,6 +1529,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1520,6 +1529,7 @@ public final class Long extends Number implements Comparable<Long> {
* two's complement binary representation of the specified {@code long} * two's complement binary representation of the specified {@code long}
* value. * value.
* *
* @param i the value to be reversed
* @return the value obtained by reversing order of the bits in the * @return the value obtained by reversing order of the bits in the
* specified {@code long} value. * specified {@code long} value.
* @since 1.5 * @since 1.5
...@@ -1540,6 +1550,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1540,6 +1550,7 @@ public final class Long extends Number implements Comparable<Long> {
* return value is -1 if the specified value is negative; 0 if the * return value is -1 if the specified value is negative; 0 if the
* specified value is zero; and 1 if the specified value is positive.) * specified value is zero; and 1 if the specified value is positive.)
* *
* @param i the value whose signum is to be computed
* @return the signum function of the specified {@code long} value. * @return the signum function of the specified {@code long} value.
* @since 1.5 * @since 1.5
*/ */
...@@ -1552,6 +1563,7 @@ public final class Long extends Number implements Comparable<Long> { ...@@ -1552,6 +1563,7 @@ public final class Long extends Number implements Comparable<Long> {
* Returns the value obtained by reversing the order of the bytes in the * Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code long} value. * two's complement representation of the specified {@code long} value.
* *
* @param i the value whose bytes are to be reversed
* @return the value obtained by reversing the bytes in the specified * @return the value obtained by reversing the bytes in the specified
* {@code long} value. * {@code long} value.
* @since 1.5 * @since 1.5
......
...@@ -77,18 +77,18 @@ import java.lang.annotation.Annotation; ...@@ -77,18 +77,18 @@ import java.lang.annotation.Annotation;
* by the following formal grammar: * by the following formal grammar:
* <blockquote> * <blockquote>
* <dl> * <dl>
* <dt><i>SpecificationVersion: * <dt><i>SpecificationVersion:</i>
* <dd>Digits RefinedVersion<sub>opt</sub></i> * <dd><i>Digits RefinedVersion<sub>opt</sub></i>
* <p><dt><i>RefinedVersion:</i> * <dt><i>RefinedVersion:</i>
* <dd>{@code .} <i>Digits</i> * <dd>{@code .} <i>Digits</i>
* <dd>{@code .} <i>Digits RefinedVersion</i> * <dd>{@code .} <i>Digits RefinedVersion</i>
* *
* <p><dt><i>Digits: * <dt><i>Digits:</i>
* <dd>Digit * <dd><i>Digit</i>
* <dd>Digits</i> * <dd><i>Digits</i>
* *
* <p><dt><i>Digit:</i> * <dt><i>Digit:</i>
* <dd>any character for which {@link Character#isDigit} returns {@code true}, * <dd>any character for which {@link Character#isDigit} returns {@code true},
* e.g. 0, 1, 2, ... * e.g. 0, 1, 2, ...
* </dl> * </dl>
......
...@@ -117,11 +117,11 @@ public class Runtime { ...@@ -117,11 +117,11 @@ public class Runtime {
* *
* <ul> * <ul>
* *
* <p> <li> The program <i>exits</i> normally, when the last non-daemon * <li> The program <i>exits</i> normally, when the last non-daemon
* thread exits or when the <tt>{@link #exit exit}</tt> (equivalently, * thread exits or when the <tt>{@link #exit exit}</tt> (equivalently,
* <tt>{@link System#exit(int) System.exit}</tt>) method is invoked, or * {@link System#exit(int) System.exit}) method is invoked, or
* *
* <p> <li> The virtual machine is <i>terminated</i> in response to a * <li> The virtual machine is <i>terminated</i> in response to a
* user interrupt, such as typing <tt>^C</tt>, or a system-wide event, * user interrupt, such as typing <tt>^C</tt>, or a system-wide event,
* such as user logoff or system shutdown. * such as user logoff or system shutdown.
* *
......
/* /*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
...@@ -403,9 +403,9 @@ public final class Short extends Number implements Comparable<Short> { ...@@ -403,9 +403,9 @@ public final class Short extends Number implements Comparable<Short> {
* Returns a hash code for a {@code short} value; compatible with * Returns a hash code for a {@code short} value; compatible with
* {@code Short.hashCode()}. * {@code Short.hashCode()}.
* *
* @since 1.8 * @param value the value to hash
*
* @return a hash code value for a {@code short} value. * @return a hash code value for a {@code short} value.
* @since 1.8
*/ */
public static int hashCode(short value) { public static int hashCode(short value) {
return (int)value; return (int)value;
...@@ -482,6 +482,7 @@ public final class Short extends Number implements Comparable<Short> { ...@@ -482,6 +482,7 @@ public final class Short extends Number implements Comparable<Short> {
* Returns the value obtained by reversing the order of the bytes in the * Returns the value obtained by reversing the order of the bytes in the
* two's complement representation of the specified {@code short} value. * two's complement representation of the specified {@code short} value.
* *
* @param i the value whose bytes are to be reversed
* @return the value obtained by reversing (or, equivalently, swapping) * @return the value obtained by reversing (or, equivalently, swapping)
* the bytes in the specified {@code short} value. * the bytes in the specified {@code short} value.
* @since 1.5 * @since 1.5
......
/* /*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
...@@ -1419,6 +1419,7 @@ public final class StrictMath { ...@@ -1419,6 +1419,7 @@ public final class StrictMath {
* {@link Float#MIN_EXPONENT} -1. * {@link Float#MIN_EXPONENT} -1.
* </ul> * </ul>
* @param f a {@code float} value * @param f a {@code float} value
* @return the unbiased exponent of the argument
* @since 1.6 * @since 1.6
*/ */
public static int getExponent(float f) { public static int getExponent(float f) {
...@@ -1436,6 +1437,7 @@ public final class StrictMath { ...@@ -1436,6 +1437,7 @@ public final class StrictMath {
* {@link Double#MIN_EXPONENT} -1. * {@link Double#MIN_EXPONENT} -1.
* </ul> * </ul>
* @param d a {@code double} value * @param d a {@code double} value
* @return the unbiased exponent of the argument
* @since 1.6 * @since 1.6
*/ */
public static int getExponent(double d) { public static int getExponent(double d) {
......
...@@ -66,6 +66,7 @@ public @interface SuppressWarnings { ...@@ -66,6 +66,7 @@ public @interface SuppressWarnings {
* additional warning names they support in conjunction with this * additional warning names they support in conjunction with this
* annotation type. They are encouraged to cooperate to ensure * annotation type. They are encouraged to cooperate to ensure
* that the same names work across multiple compilers. * that the same names work across multiple compilers.
* @return the set of warnings to be suppressed
*/ */
String[] value(); String[] value();
} }
...@@ -634,6 +634,8 @@ public final class System { ...@@ -634,6 +634,8 @@ public final class System {
* *
* <p>On UNIX systems, it returns {@code "\n"}; on Microsoft * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
* Windows systems it returns {@code "\r\n"}. * Windows systems it returns {@code "\r\n"}.
*
* @return the system-dependent line separator string
* @since 1.7 * @since 1.7
*/ */
public static String lineSeparator() { public static String lineSeparator() {
......
...@@ -1993,12 +1993,21 @@ class Thread implements Runnable { ...@@ -1993,12 +1993,21 @@ class Thread implements Runnable {
// The following three initially uninitialized fields are exclusively // The following three initially uninitialized fields are exclusively
// managed by class java.util.concurrent.ThreadLocalRandom. // managed by class java.util.concurrent.ThreadLocalRandom. These
// fields are used to build the high-performance PRNGs in the
// concurrent code, and we can not risk accidental false sharing.
// Hence, the fields are isolated with @Contended.
/** The current seed for a ThreadLocalRandom */ /** The current seed for a ThreadLocalRandom */
@sun.misc.Contended("tlr")
long threadLocalRandomSeed; long threadLocalRandomSeed;
/** Probe hash value; nonzero if threadLocalRandomSeed initialized */ /** Probe hash value; nonzero if threadLocalRandomSeed initialized */
@sun.misc.Contended("tlr")
int threadLocalRandomProbe; int threadLocalRandomProbe;
/** Secondary seed isolated from public ThreadLocalRandom sequence */ /** Secondary seed isolated from public ThreadLocalRandom sequence */
@sun.misc.Contended("tlr")
int threadLocalRandomSecondarySeed; int threadLocalRandomSecondarySeed;
/* Some private helper methods */ /* Some private helper methods */
......
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 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
...@@ -126,6 +126,7 @@ public interface Annotation { ...@@ -126,6 +126,7 @@ public interface Annotation {
/** /**
* Returns the annotation type of this annotation. * Returns the annotation type of this annotation.
* @return the annotation type of this annotation
*/ */
Class<? extends Annotation> annotationType(); Class<? extends Annotation> annotationType();
} }
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 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
...@@ -43,6 +43,7 @@ public @interface Repeatable { ...@@ -43,6 +43,7 @@ public @interface Repeatable {
/** /**
* Indicates the <em>containing annotation type</em> for the * Indicates the <em>containing annotation type</em> for the
* repeatable annotation type. * repeatable annotation type.
* @return the containing annotation type
*/ */
Class<? extends Annotation> value(); Class<? extends Annotation> value();
} }
...@@ -44,5 +44,9 @@ package java.lang.annotation; ...@@ -44,5 +44,9 @@ package java.lang.annotation;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE) @Target(ElementType.ANNOTATION_TYPE)
public @interface Retention { public @interface Retention {
/**
* Returns the retention policy.
* @return the retention policy
*/
RetentionPolicy value(); RetentionPolicy value();
} }
...@@ -67,5 +67,11 @@ package java.lang.annotation; ...@@ -67,5 +67,11 @@ package java.lang.annotation;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE) @Target(ElementType.ANNOTATION_TYPE)
public @interface Target { public @interface Target {
/**
* Returns an array of the kinds of elements an annotation type
* can be applied to.
* @return an array of the kinds of elements an annotation type
* can be applied to
*/
ElementType[] value(); ElementType[] value();
} }
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 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
...@@ -363,6 +363,8 @@ public interface Instrumentation { ...@@ -363,6 +363,8 @@ public interface Instrumentation {
* Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) * Primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
* and array classes are never modifiable. * and array classes are never modifiable.
* *
* @param theClass the class to check for being modifiable
* @return whether or not the argument class is modifiable
* @throws java.lang.NullPointerException if the specified class is <code>null</code>. * @throws java.lang.NullPointerException if the specified class is <code>null</code>.
* *
* @see #retransformClasses * @see #retransformClasses
...@@ -549,14 +551,14 @@ public interface Instrumentation { ...@@ -549,14 +551,14 @@ public interface Instrumentation {
* {@link java.lang.instrument.ClassFileTransformer ClassFileTransformer}, * {@link java.lang.instrument.ClassFileTransformer ClassFileTransformer},
* it enables native methods to be * it enables native methods to be
* instrumented. * instrumented.
* <p/> * <p>
* Since native methods cannot be directly instrumented * Since native methods cannot be directly instrumented
* (they have no bytecodes), they must be wrapped with * (they have no bytecodes), they must be wrapped with
* a non-native method which can be instrumented. * a non-native method which can be instrumented.
* For example, if we had: * For example, if we had:
* <pre> * <pre>
* native boolean foo(int x);</pre> * native boolean foo(int x);</pre>
* <p/> * <p>
* We could transform the class file (with the * We could transform the class file (with the
* ClassFileTransformer during the initial definition * ClassFileTransformer during the initial definition
* of the class) so that this becomes: * of the class) so that this becomes:
...@@ -567,14 +569,14 @@ public interface Instrumentation { ...@@ -567,14 +569,14 @@ public interface Instrumentation {
* } * }
* *
* native boolean wrapped_foo(int x);</pre> * native boolean wrapped_foo(int x);</pre>
* <p/> * <p>
* Where <code>foo</code> becomes a wrapper for the actual native * Where <code>foo</code> becomes a wrapper for the actual native
* method with the appended prefix "wrapped_". Note that * method with the appended prefix "wrapped_". Note that
* "wrapped_" would be a poor choice of prefix since it * "wrapped_" would be a poor choice of prefix since it
* might conceivably form the name of an existing method * might conceivably form the name of an existing method
* thus something like "$$$MyAgentWrapped$$$_" would be * thus something like "$$$MyAgentWrapped$$$_" would be
* better but would make these examples less readable. * better but would make these examples less readable.
* <p/> * <p>
* The wrapper will allow data to be collected on the native * The wrapper will allow data to be collected on the native
* method call, but now the problem becomes linking up the * method call, but now the problem becomes linking up the
* wrapped method with the native implementation. * wrapped method with the native implementation.
...@@ -583,7 +585,7 @@ public interface Instrumentation { ...@@ -583,7 +585,7 @@ public interface Instrumentation {
* which might be: * which might be:
* <pre> * <pre>
* Java_somePackage_someClass_foo(JNIEnv* env, jint x)</pre> * Java_somePackage_someClass_foo(JNIEnv* env, jint x)</pre>
* <p/> * <p>
* This function allows the prefix to be specified and the * This function allows the prefix to be specified and the
* proper resolution to occur. * proper resolution to occur.
* Specifically, when the standard resolution fails, the * Specifically, when the standard resolution fails, the
...@@ -596,29 +598,29 @@ public interface Instrumentation { ...@@ -596,29 +598,29 @@ public interface Instrumentation {
* <pre>{@code * <pre>{@code
* method(foo) -> nativeImplementation(foo) * method(foo) -> nativeImplementation(foo)
* }</pre> * }</pre>
* <p/> * <p>
* When this fails, the resolution will be retried with * When this fails, the resolution will be retried with
* the specified prefix prepended to the method name, * the specified prefix prepended to the method name,
* yielding the correct resolution: * yielding the correct resolution:
* <pre>{@code * <pre>{@code
* method(wrapped_foo) -> nativeImplementation(foo) * method(wrapped_foo) -> nativeImplementation(foo)
* }</pre> * }</pre>
* <p/> * <p>
* For automatic resolution, the JVM will attempt: * For automatic resolution, the JVM will attempt:
* <pre>{@code * <pre>{@code
* method(wrapped_foo) -> nativeImplementation(wrapped_foo) * method(wrapped_foo) -> nativeImplementation(wrapped_foo)
* }</pre> * }</pre>
* <p/> * <p>
* When this fails, the resolution will be retried with * When this fails, the resolution will be retried with
* the specified prefix deleted from the implementation name, * the specified prefix deleted from the implementation name,
* yielding the correct resolution: * yielding the correct resolution:
* <pre>{@code * <pre>{@code
* method(wrapped_foo) -> nativeImplementation(foo) * method(wrapped_foo) -> nativeImplementation(foo)
* }</pre> * }</pre>
* <p/> * <p>
* Note that since the prefix is only used when standard * Note that since the prefix is only used when standard
* resolution fails, native methods can be wrapped selectively. * resolution fails, native methods can be wrapped selectively.
* <p/> * <p>
* Since each <code>ClassFileTransformer</code> * Since each <code>ClassFileTransformer</code>
* can do its own transformation of the bytecodes, more * can do its own transformation of the bytecodes, more
* than one layer of wrappers may be applied. Thus each * than one layer of wrappers may be applied. Thus each
......
...@@ -112,7 +112,9 @@ import java.security.PrivilegedAction; ...@@ -112,7 +112,9 @@ import java.security.PrivilegedAction;
implMethodDesc = implMethodType.toMethodDescriptorString(); implMethodDesc = implMethodType.toMethodDescriptorString();
Type implMethodAsmType = Type.getMethodType(implMethodDesc); Type implMethodAsmType = Type.getMethodType(implMethodDesc);
implMethodArgumentTypes = implMethodAsmType.getArgumentTypes(); implMethodArgumentTypes = implMethodAsmType.getArgumentTypes();
implMethodReturnType = implMethodAsmType.getReturnType(); implMethodReturnType = (implKind == MethodHandleInfo.REF_newInvokeSpecial)
? Type.getObjectType(implMethodClassName)
: implMethodAsmType.getReturnType();
constructorType = invokedType.changeReturnType(Void.TYPE); constructorType = invokedType.changeReturnType(Void.TYPE);
constructorDesc = constructorType.toMethodDescriptorString(); constructorDesc = constructorType.toMethodDescriptorString();
lambdaClassName = targetClass.getName().replace('.', '/') + "$$Lambda$" + counter.incrementAndGet(); lambdaClassName = targetClass.getName().replace('.', '/') + "$$Lambda$" + counter.incrementAndGet();
......
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 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
...@@ -29,21 +29,45 @@ package java.lang.invoke; ...@@ -29,21 +29,45 @@ package java.lang.invoke;
* LambdaConversionException * LambdaConversionException
*/ */
public class LambdaConversionException extends Exception { public class LambdaConversionException extends Exception {
/**
* Constructs a {@code LambdaConversionException}.
*/
public LambdaConversionException() { public LambdaConversionException() {
} }
/**
* Constructs a {@code LambdaConversionException} with a message.
* @param message the detail message
*/
public LambdaConversionException(String message) { public LambdaConversionException(String message) {
super(message); super(message);
} }
/**
* Constructs a {@code LambdaConversionException} with a message and cause.
* @param message the detail message
* @param cause the cause
*/
public LambdaConversionException(String message, Throwable cause) { public LambdaConversionException(String message, Throwable cause) {
super(message, cause); super(message, cause);
} }
/**
* Constructs a {@code LambdaConversionException} with a cause.
* @param cause the cause
*/
public LambdaConversionException(Throwable cause) { public LambdaConversionException(Throwable cause) {
super(cause); super(cause);
} }
/**
* Constructs a {@code LambdaConversionException} with a message,
* cause, and other settings.
* @param message the detail message
* @param cause the cause
* @param enableSuppression whether or not suppressed exceptions are enabled
* @param writableStackTrace whether or not the stack trace is writable
*/
public LambdaConversionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { public LambdaConversionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace); super(message, cause, enableSuppression, writableStackTrace);
} }
......
...@@ -111,7 +111,7 @@ package java.lang.invoke; ...@@ -111,7 +111,7 @@ package java.lang.invoke;
* done on return type, while a strict version is applied to arguments. * done on return type, while a strict version is applied to arguments.
* *
* <p>A type Q is considered adaptable to S as follows: * <p>A type Q is considered adaptable to S as follows:
* <table> * <table summary="adaptable types">
* <tr><th>Q</th><th>S</th><th>Link-time checks</th><th>Capture-time checks</th></tr> * <tr><th>Q</th><th>S</th><th>Link-time checks</th><th>Capture-time checks</th></tr>
* <tr> * <tr>
* <td>Primitive</td><td>Primitive</td> * <td>Primitive</td><td>Primitive</td>
...@@ -155,7 +155,7 @@ public class LambdaMetafactory { ...@@ -155,7 +155,7 @@ public class LambdaMetafactory {
private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0]; private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0];
/** /**
* Standard meta-factory for conversion of lambda expressions or method references to functional interfaces. * Standard meta-factory for conversion of lambda expressions or method references to functional interfaces.
* *
* @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges
...@@ -174,7 +174,7 @@ public class LambdaMetafactory { ...@@ -174,7 +174,7 @@ public class LambdaMetafactory {
* @param instantiatedMethodType The signature of the primary functional interface method after type variables * @param instantiatedMethodType The signature of the primary functional interface method after type variables
* are substituted with their instantiation from the capture site * are substituted with their instantiation from the capture site
* @return a CallSite, which, when invoked, will return an instance of the functional interface * @return a CallSite, which, when invoked, will return an instance of the functional interface
* @throws ReflectiveOperationException * @throws ReflectiveOperationException if the caller is not able to reconstruct one of the method handles
* @throws LambdaConversionException If any of the meta-factory protocol invariants are violated * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
*/ */
public static CallSite metaFactory(MethodHandles.Lookup caller, public static CallSite metaFactory(MethodHandles.Lookup caller,
...@@ -226,7 +226,7 @@ public class LambdaMetafactory { ...@@ -226,7 +226,7 @@ public class LambdaMetafactory {
* the first argument in the invocation signature will correspond to the receiver. * the first argument in the invocation signature will correspond to the receiver.
* @param args argument to pass, flags, marker interface count, and marker interfaces as described above * @param args argument to pass, flags, marker interface count, and marker interfaces as described above
* @return a CallSite, which, when invoked, will return an instance of the functional interface * @return a CallSite, which, when invoked, will return an instance of the functional interface
* @throws ReflectiveOperationException * @throws ReflectiveOperationException if the caller is not able to reconstruct one of the method handles
* @throws LambdaConversionException If any of the meta-factory protocol invariants are violated * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated
*/ */
public static CallSite altMetaFactory(MethodHandles.Lookup caller, public static CallSite altMetaFactory(MethodHandles.Lookup caller,
......
...@@ -44,7 +44,7 @@ import java.util.logging.Logger; ...@@ -44,7 +44,7 @@ import java.util.logging.Logger;
* {@linkplain java.lang.invoke.MethodHandles#dropArguments deletion}, * {@linkplain java.lang.invoke.MethodHandles#dropArguments deletion},
* and {@linkplain java.lang.invoke.MethodHandles#filterArguments substitution}. * and {@linkplain java.lang.invoke.MethodHandles#filterArguments substitution}.
* *
* <h3>Method handle contents</h3> * <h1>Method handle contents</h1>
* Method handles are dynamically and strongly typed according to their parameter and return types. * Method handles are dynamically and strongly typed according to their parameter and return types.
* They are not distinguished by the name or the defining class of their underlying methods. * They are not distinguished by the name or the defining class of their underlying methods.
* A method handle must be invoked using a symbolic type descriptor which matches * A method handle must be invoked using a symbolic type descriptor which matches
...@@ -81,7 +81,7 @@ import java.util.logging.Logger; ...@@ -81,7 +81,7 @@ import java.util.logging.Logger;
* from its specific class, as the method handle class hierarchy (if any) * from its specific class, as the method handle class hierarchy (if any)
* may change from time to time or across implementations from different vendors. * may change from time to time or across implementations from different vendors.
* *
* <h3>Method handle compilation</h3> * <h1>Method handle compilation</h1>
* A Java method call expression naming {@code invokeExact} or {@code invoke} * A Java method call expression naming {@code invokeExact} or {@code invoke}
* can invoke a method handle from Java source code. * can invoke a method handle from Java source code.
* From the viewpoint of source code, these methods can take any arguments * From the viewpoint of source code, these methods can take any arguments
...@@ -111,7 +111,7 @@ import java.util.logging.Logger; ...@@ -111,7 +111,7 @@ import java.util.logging.Logger;
* The ambiguity with the type {@code Void} is harmless, since there are no references of type * The ambiguity with the type {@code Void} is harmless, since there are no references of type
* {@code Void} except the null reference. * {@code Void} except the null reference.
* *
* <h3>Method handle invocation</h3> * <h1>Method handle invocation</h1>
* The first time a {@code invokevirtual} instruction is executed * The first time a {@code invokevirtual} instruction is executed
* it is linked, by symbolically resolving the names in the instruction * it is linked, by symbolically resolving the names in the instruction
* and verifying that the method call is statically legal. * and verifying that the method call is statically legal.
...@@ -154,7 +154,7 @@ import java.util.logging.Logger; ...@@ -154,7 +154,7 @@ import java.util.logging.Logger;
* (<em>Note:</em> The adjusted method handle {@code M2} is not directly observable, * (<em>Note:</em> The adjusted method handle {@code M2} is not directly observable,
* and implementations are therefore not required to materialize it.) * and implementations are therefore not required to materialize it.)
* *
* <h3>Invocation checking</h3> * <h1>Invocation checking</h1>
* In typical programs, method handle type matching will usually succeed. * In typical programs, method handle type matching will usually succeed.
* But if a match fails, the JVM will throw a {@link WrongMethodTypeException}, * But if a match fails, the JVM will throw a {@link WrongMethodTypeException},
* either directly (in the case of {@code invokeExact}) or indirectly as if * either directly (in the case of {@code invokeExact}) or indirectly as if
...@@ -195,7 +195,7 @@ import java.util.logging.Logger; ...@@ -195,7 +195,7 @@ import java.util.logging.Logger;
* They should not be passed to untrusted code unless their use from * They should not be passed to untrusted code unless their use from
* the untrusted code would be harmless. * the untrusted code would be harmless.
* *
* <h3>Method handle creation</h3> * <h1>Method handle creation</h1>
* Java code can create a method handle that directly accesses * Java code can create a method handle that directly accesses
* any method, constructor, or field that is accessible to that code. * any method, constructor, or field that is accessible to that code.
* This is done via a reflective, capability-based API called * This is done via a reflective, capability-based API called
...@@ -249,7 +249,7 @@ import java.util.logging.Logger; ...@@ -249,7 +249,7 @@ import java.util.logging.Logger;
* receiver type. Such a method handle simulates the effect of * receiver type. Such a method handle simulates the effect of
* an {@code invokespecial} instruction to the same method. * an {@code invokespecial} instruction to the same method.
* *
* <h3>Usage examples</h3> * <h1>Usage examples</h1>
* Here are some examples of usage: * Here are some examples of usage:
* <p><blockquote><pre>{@code * <p><blockquote><pre>{@code
Object x, y; String s; int i; Object x, y; String s; int i;
...@@ -295,7 +295,7 @@ mh.invokeExact(System.out, "Hello, world."); ...@@ -295,7 +295,7 @@ mh.invokeExact(System.out, "Hello, world.");
* be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals } * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
* on its arguments, and asserts that the result is true. * on its arguments, and asserts that the result is true.
* *
* <h3>Exceptions</h3> * <h1>Exceptions</h1>
* The methods {@code invokeExact} and {@code invoke} are declared * The methods {@code invokeExact} and {@code invoke} are declared
* to throw {@link java.lang.Throwable Throwable}, * to throw {@link java.lang.Throwable Throwable},
* which is to say that there is no static restriction on what a method handle * which is to say that there is no static restriction on what a method handle
...@@ -308,7 +308,7 @@ mh.invokeExact(System.out, "Hello, world."); ...@@ -308,7 +308,7 @@ mh.invokeExact(System.out, "Hello, world.");
* throwables locally, rethrowing only those which are legal in the context, * throwables locally, rethrowing only those which are legal in the context,
* and wrapping ones which are illegal. * and wrapping ones which are illegal.
* *
* <h3><a name="sigpoly"></a>Signature polymorphism</h3> * <h1><a name="sigpoly"></a>Signature polymorphism</h1>
* The unusual compilation and linkage behavior of * The unusual compilation and linkage behavior of
* {@code invokeExact} and plain {@code invoke} * {@code invokeExact} and plain {@code invoke}
* is referenced by the term <em>signature polymorphism</em>. * is referenced by the term <em>signature polymorphism</em>.
...@@ -333,7 +333,7 @@ mh.invokeExact(System.out, "Hello, world."); ...@@ -333,7 +333,7 @@ mh.invokeExact(System.out, "Hello, world.");
* Tools which determine symbolic linkage are required to accept such * Tools which determine symbolic linkage are required to accept such
* untransformed descriptors, without reporting linkage errors. * untransformed descriptors, without reporting linkage errors.
* *
* <h3>Interoperation between method handles and the Core Reflection API</h3> * <h1>Interoperation between method handles and the Core Reflection API</h1>
* Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup Lookup} API, * Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup Lookup} API,
* any class member represented by a Core Reflection API object * any class member represented by a Core Reflection API object
* can be converted to a behaviorally equivalent method handle. * can be converted to a behaviorally equivalent method handle.
...@@ -375,7 +375,7 @@ mh.invokeExact(System.out, "Hello, world."); ...@@ -375,7 +375,7 @@ mh.invokeExact(System.out, "Hello, world.");
* to call {@code invokeExact} or plain {@code invoke}, * to call {@code invokeExact} or plain {@code invoke},
* for any specified type descriptor . * for any specified type descriptor .
* *
* <h3>Interoperation between method handles and Java generics</h3> * <h1>Interoperation between method handles and Java generics</h1>
* A method handle can be obtained on a method, constructor, or field * A method handle can be obtained on a method, constructor, or field
* which is declared with Java generic types. * which is declared with Java generic types.
* As with the Core Reflection API, the type of the method handle * As with the Core Reflection API, the type of the method handle
...@@ -457,6 +457,8 @@ public abstract class MethodHandle { ...@@ -457,6 +457,8 @@ public abstract class MethodHandle {
* {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI, * {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI,
* or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}, * or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
* it will throw an {@code UnsupportedOperationException}. * it will throw an {@code UnsupportedOperationException}.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
* @throws WrongMethodTypeException if the target's type is not identical with the caller's symbolic type descriptor * @throws WrongMethodTypeException if the target's type is not identical with the caller's symbolic type descriptor
* @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
*/ */
...@@ -491,6 +493,8 @@ public abstract class MethodHandle { ...@@ -491,6 +493,8 @@ public abstract class MethodHandle {
* {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI, * {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI,
* or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}, * or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect},
* it will throw an {@code UnsupportedOperationException}. * it will throw an {@code UnsupportedOperationException}.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
* @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's symbolic type descriptor * @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's symbolic type descriptor
* @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails * @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails
* @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call
...@@ -511,15 +515,26 @@ public abstract class MethodHandle { ...@@ -511,15 +515,26 @@ public abstract class MethodHandle {
* operations on outgoing argument values.) * operations on outgoing argument values.)
* The caller can assume that the incoming result value is part of the range * The caller can assume that the incoming result value is part of the range
* of the callee's return type. * of the callee's return type.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
*/ */
/*non-public*/ final native @PolymorphicSignature Object invokeBasic(Object... args) throws Throwable; /*non-public*/ final native @PolymorphicSignature Object invokeBasic(Object... args) throws Throwable;
/**
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeVirtual}.
* The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
*/
/*non-public*/ static native @PolymorphicSignature Object linkToVirtual(Object... args) throws Throwable; /*non-public*/ static native @PolymorphicSignature Object linkToVirtual(Object... args) throws Throwable;
/** /**
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeStatic}. * Private method for trusted invocation of a MemberName of kind {@code REF_invokeStatic}.
* The caller signature is restricted to basic types as with {@code invokeBasic}. * The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName. * The trailing (not leading) argument must be a MemberName.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
*/ */
/*non-public*/ static native @PolymorphicSignature Object linkToStatic(Object... args) throws Throwable; /*non-public*/ static native @PolymorphicSignature Object linkToStatic(Object... args) throws Throwable;
...@@ -527,6 +542,8 @@ public abstract class MethodHandle { ...@@ -527,6 +542,8 @@ public abstract class MethodHandle {
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeSpecial}. * Private method for trusted invocation of a MemberName of kind {@code REF_invokeSpecial}.
* The caller signature is restricted to basic types as with {@code invokeBasic}. * The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName. * The trailing (not leading) argument must be a MemberName.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
*/ */
/*non-public*/ static native @PolymorphicSignature Object linkToSpecial(Object... args) throws Throwable; /*non-public*/ static native @PolymorphicSignature Object linkToSpecial(Object... args) throws Throwable;
...@@ -534,6 +551,8 @@ public abstract class MethodHandle { ...@@ -534,6 +551,8 @@ public abstract class MethodHandle {
* Private method for trusted invocation of a MemberName of kind {@code REF_invokeInterface}. * Private method for trusted invocation of a MemberName of kind {@code REF_invokeInterface}.
* The caller signature is restricted to basic types as with {@code invokeBasic}. * The caller signature is restricted to basic types as with {@code invokeBasic}.
* The trailing (not leading) argument must be a MemberName. * The trailing (not leading) argument must be a MemberName.
* @param args the signature-polymorphic parameter list, statically represented using varargs
* @return the signature-polymorphic result, statically represented using {@code Object}
*/ */
/*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable; /*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable;
......
...@@ -108,8 +108,9 @@ public class MethodHandleProxies { ...@@ -108,8 +108,9 @@ public class MethodHandleProxies {
* Future versions of this API may also equip wrapper instances * Future versions of this API may also equip wrapper instances
* with one or more additional public "marker" interfaces. * with one or more additional public "marker" interfaces.
* *
* @param <T> the desired type of the wrapper, a single-method interface
* @param intfc a class object representing {@code T}
* @param target the method handle to invoke from the wrapper * @param target the method handle to invoke from the wrapper
* @param intfc the desired type of the wrapper, a single-method interface
* @return a correctly-typed wrapper for the given target * @return a correctly-typed wrapper for the given target
* @throws NullPointerException if either argument is null * @throws NullPointerException if either argument is null
* @throws IllegalArgumentException if the {@code intfc} is not a * @throws IllegalArgumentException if the {@code intfc} is not a
......
...@@ -70,6 +70,7 @@ public class MethodHandles { ...@@ -70,6 +70,7 @@ public class MethodHandles {
* including direct method handles to private fields and methods. * including direct method handles to private fields and methods.
* This lookup object is a <em>capability</em> which may be delegated to trusted agents. * This lookup object is a <em>capability</em> which may be delegated to trusted agents.
* Do not store it in place where untrusted code can access it. * Do not store it in place where untrusted code can access it.
* @return a lookup object for the caller of this method
*/ */
@CallerSensitive @CallerSensitive
public static Lookup lookup() { public static Lookup lookup() {
...@@ -88,6 +89,7 @@ public class MethodHandles { ...@@ -88,6 +89,7 @@ public class MethodHandles {
* {@linkplain Lookup#in <code>publicLookup().in(C.class)</code>}. * {@linkplain Lookup#in <code>publicLookup().in(C.class)</code>}.
* Since all classes have equal access to public names, * Since all classes have equal access to public names,
* such a change would confer no new access rights. * such a change would confer no new access rights.
* @return a lookup object which is trusted minimally
*/ */
public static Lookup publicLookup() { public static Lookup publicLookup() {
return Lookup.PUBLIC_LOOKUP; return Lookup.PUBLIC_LOOKUP;
...@@ -111,72 +113,74 @@ public class MethodHandles { ...@@ -111,72 +113,74 @@ public class MethodHandles {
* on the {@code Lookup} object to create method handles for access-checked members. * on the {@code Lookup} object to create method handles for access-checked members.
* This includes all methods, constructors, and fields which are allowed to the lookup class, * This includes all methods, constructors, and fields which are allowed to the lookup class,
* even private ones. * even private ones.
* <p> *
* <h1><a name="lookups"></a>Lookup Factory Methods</h1>
* The factory methods on a {@code Lookup} object correspond to all major * The factory methods on a {@code Lookup} object correspond to all major
* use cases for methods, constructors, and fields. * use cases for methods, constructors, and fields.
* Here is a summary of the correspondence between these factory methods and * Here is a summary of the correspondence between these factory methods and
* the behavior the resulting method handles: * the behavior the resulting method handles:
* <code>
* <table border=1 cellpadding=5 summary="lookup method behaviors"> * <table border=1 cellpadding=5 summary="lookup method behaviors">
* <tr><th>lookup expression</th><th>member</th><th>behavior</th></tr> * <tr><th>lookup expression</th><th>member</th><th>behavior</th></tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}</td>
* <td>FT f;</td><td>(T) this.f;</td> * <td>{@code FT f;}</td><td>{@code (T) this.f;}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</td>
* <td>static<br>FT f;</td><td>(T) C.f;</td> * <td>{@code static}<br>{@code FT f;}</td><td>{@code (T) C.f;}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</td>
* <td>FT f;</td><td>this.f = x;</td> * <td>{@code FT f;}</td><td>{@code this.f = x;}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}</td>
* <td>static<br>FT f;</td><td>C.f = arg;</td> * <td>{@code static}<br>{@code FT f;}</td><td>{@code C.f = arg;}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}</td>
* <td>T m(A*);</td><td>(T) this.m(arg*);</td> * <td>{@code T m(A*);}</td><td>{@code (T) this.m(arg*);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}</td>
* <td>static<br>T m(A*);</td><td>(T) C.m(arg*);</td> * <td>{@code static}<br>{@code T m(A*);}</td><td>{@code (T) C.m(arg*);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}</td>
* <td>T m(A*);</td><td>(T) super.m(arg*);</td> * <td>{@code T m(A*);}</td><td>{@code (T) super.m(arg*);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}</td>
* <td>C(A*);</td><td>(T) new C(arg*);</td> * <td>{@code C(A*);}</td><td>{@code new C(arg*);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}</td>
* <td>(static)?<br>FT f;</td><td>(FT) aField.get(thisOrNull);</td> * <td>({@code static})?<br>{@code FT f;}</td><td>{@code (FT) aField.get(thisOrNull);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}</td>
* <td>(static)?<br>FT f;</td><td>aField.set(thisOrNull, arg);</td> * <td>({@code static})?<br>{@code FT f;}</td><td>{@code aField.set(thisOrNull, arg);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
* <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td> * <td>({@code static})?<br>{@code T m(A*);}</td><td>{@code (T) aMethod.invoke(thisOrNull, arg*);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}</td>
* <td>C(A*);</td><td>(C) aConstructor.newInstance(arg*);</td> * <td>{@code C(A*);}</td><td>{@code (C) aConstructor.newInstance(arg*);}</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>{@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td> * <td>{@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</td>
* <td>(static)?<br>T m(A*);</td><td>(T) aMethod.invoke(thisOrNull, arg*);</td> * <td>({@code static})?<br>{@code T m(A*);}</td><td>{@code (T) aMethod.invoke(thisOrNull, arg*);}</td>
* </tr> * </tr>
* </table> * </table>
* </code> *
* Here, the type {@code C} is the class or interface being searched for a member, * Here, the type {@code C} is the class or interface being searched for a member,
* documented as a parameter named {@code refc} in the lookup methods. * documented as a parameter named {@code refc} in the lookup methods.
* The method or constructor type {@code MT} is composed from the return type {@code T} * The method type {@code MT} is composed from the return type {@code T}
* and the sequence of argument types {@code A*}. * and the sequence of argument types {@code A*}.
* The constructor also has a sequence of argument types {@code A*} and
* is deemed to return the newly-created object of type {@code C}.
* Both {@code MT} and the field type {@code FT} are documented as a parameter named {@code type}. * Both {@code MT} and the field type {@code FT} are documented as a parameter named {@code type}.
* The formal parameter {@code this} stands for the self-reference of type {@code C}; * The formal parameter {@code this} stands for the self-reference of type {@code C};
* if it is present, it is always the leading argument to the method handle invocation. * if it is present, it is always the leading argument to the method handle invocation.
...@@ -210,7 +214,7 @@ public class MethodHandles { ...@@ -210,7 +214,7 @@ public class MethodHandles {
* security manager checks. * security manager checks.
* </ul> * </ul>
* *
* <h3><a name="access"></a>Access checking</h3> * <h1><a name="access"></a>Access checking</h1>
* Access checks are applied in the factory methods of {@code Lookup}, * Access checks are applied in the factory methods of {@code Lookup},
* when a method handle is created. * when a method handle is created.
* This is a key difference from the Core Reflection API, since * This is a key difference from the Core Reflection API, since
...@@ -297,7 +301,7 @@ public class MethodHandles { ...@@ -297,7 +301,7 @@ public class MethodHandles {
* with static methods of {@link MethodHandles}, * with static methods of {@link MethodHandles},
* independently of any {@code Lookup} object. * independently of any {@code Lookup} object.
* *
* <h3>Security manager interactions</h3> * <h1>Security manager interactions</h1>
* <a name="secmgr"></a> * <a name="secmgr"></a>
* If a security manager is present, member lookups are subject to * If a security manager is present, member lookups are subject to
* additional checks. * additional checks.
...@@ -388,6 +392,7 @@ public class MethodHandles { ...@@ -388,6 +392,7 @@ public class MethodHandles {
* but the permissions may be additionally limited by the bitmask * but the permissions may be additionally limited by the bitmask
* {@link #lookupModes lookupModes}, which controls whether non-public members * {@link #lookupModes lookupModes}, which controls whether non-public members
* can be accessed. * can be accessed.
* @return the lookup class, on behalf of which this lookup object finds members
*/ */
public Class<?> lookupClass() { public Class<?> lookupClass() {
return lookupClass; return lookupClass;
...@@ -414,6 +419,7 @@ public class MethodHandles { ...@@ -414,6 +419,7 @@ public class MethodHandles {
* The purpose of this is to restrict access via the new lookup object, * The purpose of this is to restrict access via the new lookup object,
* so that it can access only names which can be reached by the original * so that it can access only names which can be reached by the original
* lookup object, and also by the new lookup class. * lookup object, and also by the new lookup class.
* @return the lookup modes, which limit the kinds of access performed by this lookup object
*/ */
public int lookupModes() { public int lookupModes() {
return allowedModes & ALL_MODES; return allowedModes & ALL_MODES;
...@@ -1352,6 +1358,7 @@ return mh1; ...@@ -1352,6 +1358,7 @@ return mh1;
* The type of the method handle will have a void return type. * The type of the method handle will have a void return type.
* Its last argument will be the array's element type. * Its last argument will be the array's element type.
* The first and second arguments will be the array type and int. * The first and second arguments will be the array type and int.
* @param arrayClass the class of an array
* @return a method handle which can store values into the array type * @return a method handle which can store values into the array type
* @throws NullPointerException if the argument is null * @throws NullPointerException if the argument is null
* @throws IllegalArgumentException if arrayClass is not an array type * @throws IllegalArgumentException if arrayClass is not an array type
...@@ -1580,12 +1587,12 @@ import static java.lang.invoke.MethodType.*; ...@@ -1580,12 +1587,12 @@ import static java.lang.invoke.MethodType.*;
... ...
MethodType intfn1 = methodType(int.class, int.class); MethodType intfn1 = methodType(int.class, int.class);
MethodType intfn2 = methodType(int.class, int.class, int.class); MethodType intfn2 = methodType(int.class, int.class, int.class);
MethodHandle sub = ... {int x, int y => x-y} ...; MethodHandle sub = ... (int x, int y) -> (x-y) ...;
assert(sub.type().equals(intfn2)); assert(sub.type().equals(intfn2));
MethodHandle sub1 = permuteArguments(sub, intfn2, 0, 1); MethodHandle sub1 = permuteArguments(sub, intfn2, 0, 1);
MethodHandle rsub = permuteArguments(sub, intfn2, 1, 0); MethodHandle rsub = permuteArguments(sub, intfn2, 1, 0);
assert((int)rsub.invokeExact(1, 100) == 99); assert((int)rsub.invokeExact(1, 100) == 99);
MethodHandle add = ... {int x, int y => x+y} ...; MethodHandle add = ... (int x, int y) -> (x+y) ...;
assert(add.type().equals(intfn2)); assert(add.type().equals(intfn2));
MethodHandle twice = permuteArguments(add, intfn1, 0, 0); MethodHandle twice = permuteArguments(add, intfn1, 0, 0);
assert(twice.type().equals(intfn1)); assert(twice.type().equals(intfn1));
...@@ -2261,6 +2268,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum")); ...@@ -2261,6 +2268,8 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* The method type will nominally specify a return of {@code returnType}. * The method type will nominally specify a return of {@code returnType}.
* The return type may be anything convenient: It doesn't matter to the * The return type may be anything convenient: It doesn't matter to the
* method handle's behavior, since it will never return normally. * method handle's behavior, since it will never return normally.
* @param returnType the return type of the desired method handle
* @param exType the parameter type of the desired method handle
* @return method handle which can throw the given exceptions * @return method handle which can throw the given exceptions
* @throws NullPointerException if either argument is null * @throws NullPointerException if either argument is null
*/ */
......
...@@ -194,6 +194,8 @@ class MethodType implements java.io.Serializable { ...@@ -194,6 +194,8 @@ class MethodType implements java.io.Serializable {
/** /**
* Finds or creates a method type with the given components. * Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* @param rtype the return type
* @param ptypes the parameter types
* @return a method type with the given components * @return a method type with the given components
* @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null * @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null
* @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class} * @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class}
...@@ -214,6 +216,9 @@ class MethodType implements java.io.Serializable { ...@@ -214,6 +216,9 @@ class MethodType implements java.io.Serializable {
* Finds or creates a method type with the given components. * Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The leading parameter type is prepended to the remaining array. * The leading parameter type is prepended to the remaining array.
* @param rtype the return type
* @param ptype0 the first parameter type
* @param ptypes the remaining parameter types
* @return a method type with the given components * @return a method type with the given components
* @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null * @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null
* @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class} * @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class}
...@@ -230,6 +235,7 @@ class MethodType implements java.io.Serializable { ...@@ -230,6 +235,7 @@ class MethodType implements java.io.Serializable {
* Finds or creates a method type with the given components. * Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The resulting method has no parameter types. * The resulting method has no parameter types.
* @param rtype the return type
* @return a method type with the given return value * @return a method type with the given return value
* @throws NullPointerException if {@code rtype} is null * @throws NullPointerException if {@code rtype} is null
*/ */
...@@ -242,6 +248,8 @@ class MethodType implements java.io.Serializable { ...@@ -242,6 +248,8 @@ class MethodType implements java.io.Serializable {
* Finds or creates a method type with the given components. * Finds or creates a method type with the given components.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The resulting method has the single given parameter type. * The resulting method has the single given parameter type.
* @param rtype the return type
* @param ptype0 the parameter type
* @return a method type with the given return value and parameter type * @return a method type with the given return value and parameter type
* @throws NullPointerException if {@code rtype} or {@code ptype0} is null * @throws NullPointerException if {@code rtype} or {@code ptype0} is null
* @throws IllegalArgumentException if {@code ptype0} is {@code void.class} * @throws IllegalArgumentException if {@code ptype0} is {@code void.class}
...@@ -256,6 +264,9 @@ class MethodType implements java.io.Serializable { ...@@ -256,6 +264,9 @@ class MethodType implements java.io.Serializable {
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* The resulting method has the same parameter types as {@code ptypes}, * The resulting method has the same parameter types as {@code ptypes},
* and the specified return type. * and the specified return type.
* @param rtype the return type
* @param ptypes the method type which supplies the parameter types
* @return a method type with the given components
* @throws NullPointerException if {@code rtype} or {@code ptypes} is null * @throws NullPointerException if {@code rtype} or {@code ptypes} is null
*/ */
public static public static
...@@ -938,7 +949,8 @@ s.writeObject(this.parameterArray()); ...@@ -938,7 +949,8 @@ s.writeObject(this.parameterArray());
* provided to the factory method {@link #methodType(Class,Class[]) methodType}. * provided to the factory method {@link #methodType(Class,Class[]) methodType}.
* For example, null values, or {@code void} parameter types, * For example, null values, or {@code void} parameter types,
* will lead to exceptions during deserialization. * will lead to exceptions during deserialization.
* @param the stream to write the object to * @param s the stream to write the object to
* @throws java.io.IOException if there is a problem writing the object
*/ */
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
s.defaultWriteObject(); // requires serialPersistentFields to be an empty array s.defaultWriteObject(); // requires serialPersistentFields to be an empty array
...@@ -953,7 +965,9 @@ s.writeObject(this.parameterArray()); ...@@ -953,7 +965,9 @@ s.writeObject(this.parameterArray());
* It provides the parameters to the factory method called by * It provides the parameters to the factory method called by
* {@link #readResolve readResolve}. * {@link #readResolve readResolve}.
* After that call it is discarded. * After that call it is discarded.
* @param the stream to read the object from * @param s the stream to read the object from
* @throws java.io.IOException if there is a problem reading the object
* @throws ClassNotFoundException if one of the component classes cannot be resolved
* @see #MethodType() * @see #MethodType()
* @see #readResolve * @see #readResolve
* @see #writeObject * @see #writeObject
......
...@@ -195,7 +195,7 @@ public class MutableCallSite extends CallSite { ...@@ -195,7 +195,7 @@ public class MutableCallSite extends CallSite {
* processed before the method returns abnormally. * processed before the method returns abnormally.
* Which elements these are (if any) is implementation-dependent. * Which elements these are (if any) is implementation-dependent.
* *
* <h3>Java Memory Model details</h3> * <h1>Java Memory Model details</h1>
* In terms of the Java Memory Model, this operation performs a synchronization * In terms of the Java Memory Model, this operation performs a synchronization
* action which is comparable in effect to the writing of a volatile variable * action which is comparable in effect to the writing of a volatile variable
* by the current thread, and an eventual volatile read by every other thread * by the current thread, and an eventual volatile read by every other thread
......
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 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
...@@ -97,66 +97,113 @@ public final class SerializedLambda implements Serializable { ...@@ -97,66 +97,113 @@ public final class SerializedLambda implements Serializable {
this.capturedArgs = Objects.requireNonNull(capturedArgs).clone(); this.capturedArgs = Objects.requireNonNull(capturedArgs).clone();
} }
/** Get the name of the class that captured this lambda */ /**
* Get the name of the class that captured this lambda.
* @return the name of the class that captured this lambda
*/
public String getCapturingClass() { public String getCapturingClass() {
return capturingClass.getName().replace('.', '/'); return capturingClass.getName().replace('.', '/');
} }
/** Get the name of the functional interface class to which this lambda has been converted */ /**
* Get the name of the functional interface class to which this
* lambda has been converted
* @return the name of the functional interface this lambda has
* been converted to
*/
public String getFunctionalInterfaceClass() { public String getFunctionalInterfaceClass() {
return functionalInterfaceClass; return functionalInterfaceClass;
} }
/** Get the name of the primary method for the functional interface to which this lambda has been converted */ /**
* Get the name of the primary method for the functional interface
* to which this lambda has been converted.
* @return the name of the primary methods of the functional interface
*/
public String getFunctionalInterfaceMethodName() { public String getFunctionalInterfaceMethodName() {
return functionalInterfaceMethodName; return functionalInterfaceMethodName;
} }
/** Get the signature of the primary method for the functional interface to which this lambda has been converted */ /**
* Get the signature of the primary method for the functional
* interface to which this lambda has been converted.
* @return the signature of the primary method of the functional
* interface
*/
public String getFunctionalInterfaceMethodSignature() { public String getFunctionalInterfaceMethodSignature() {
return functionalInterfaceMethodSignature; return functionalInterfaceMethodSignature;
} }
/** Get the method handle kind (see {@link MethodHandleInfo}) of the primary method for the functional interface /**
* to which this lambda has been converted */ * Get the method handle kind (see {@link MethodHandleInfo}) of
* the primary method for the functional interface to which this
* lambda has been converted
* @return the method handle kind of the primary method of
* functional interface
*/
public int getFunctionalInterfaceMethodKind() { public int getFunctionalInterfaceMethodKind() {
return functionalInterfaceMethodKind; return functionalInterfaceMethodKind;
} }
/** Get the name of the class containing the implementation method */ /**
* Get the name of the class containing the implementation
* method.
* @return the name of the class containing the implementation
* method
*/
public String getImplClass() { public String getImplClass() {
return implClass; return implClass;
} }
/** Get the name of the implementation method */ /**
* Get the name of the implementation method.
* @return the name of the implementation method
*/
public String getImplMethodName() { public String getImplMethodName() {
return implMethodName; return implMethodName;
} }
/** Get the signature of the implementation method */ /**
* Get the signature of the implementation method.
* @return the signature of the implementation method
*/
public String getImplMethodSignature() { public String getImplMethodSignature() {
return implMethodSignature; return implMethodSignature;
} }
/** Get the method handle kind (see {@link MethodHandleInfo}) of the implementation method */ /**
* Get the method handle kind (see {@link MethodHandleInfo}) of
* the implementation method.
* @return the method handle kind of the implementation method
*/
public int getImplMethodKind() { public int getImplMethodKind() {
return implMethodKind; return implMethodKind;
} }
/** /**
* Get the signature of the primary functional interface method after type variables are substituted with * Get the signature of the primary functional interface method
* their instantiation from the capture site * after type variables are substituted with their instantiation
* from the capture site.
* @return the signature of the primary functional interface method
* after type variable processing
*/ */
public final String getInstantiatedMethodType() { public final String getInstantiatedMethodType() {
return instantiatedMethodType; return instantiatedMethodType;
} }
/** Get the count of dynamic arguments to the lambda capture site */ /**
* Get the count of dynamic arguments to the lambda capture site.
* @return the count of dynamic arguments to the lambda capture site
*/
public int getCapturedArgCount() { public int getCapturedArgCount() {
return capturedArgs.length; return capturedArgs.length;
} }
/** Get a dynamic argument to the lambda capture site */ /**
* Get a dynamic argument to the lambda capture site.
* @param i the argument to capture
* @return a dynamic argument to the lambda capture site
*/
public Object getCapturedArg(int i) { public Object getCapturedArg(int i) {
return capturedArgs[i]; return capturedArgs[i];
} }
......
...@@ -43,13 +43,13 @@ ...@@ -43,13 +43,13 @@
* </li> * </li>
* </ul> * </ul>
* *
* <h2><a name="jvm_mods"></a>Summary of relevant Java Virtual Machine changes</h2> * <h1><a name="jvm_mods"></a>Summary of relevant Java Virtual Machine changes</h1>
* The following low-level information summarizes relevant parts of the * The following low-level information summarizes relevant parts of the
* Java Virtual Machine specification. For full details, please see the * Java Virtual Machine specification. For full details, please see the
* current version of that specification. * current version of that specification.
* *
* Each occurrence of an {@code invokedynamic} instruction is called a <em>dynamic call site</em>. * Each occurrence of an {@code invokedynamic} instruction is called a <em>dynamic call site</em>.
* <h3><a name="indyinsn"></a>{@code invokedynamic} instructions</h3> * <h2><a name="indyinsn"></a>{@code invokedynamic} instructions</h2>
* A dynamic call site is originally in an unlinked state. In this state, there is * A dynamic call site is originally in an unlinked state. In this state, there is
* no target method for the call site to invoke. * no target method for the call site to invoke.
* <p> * <p>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
* If this happens, the same error will the thrown for all subsequent * If this happens, the same error will the thrown for all subsequent
* attempts to execute the dynamic call site. * attempts to execute the dynamic call site.
* *
* <h3>timing of linkage</h3> * <h2>timing of linkage</h2>
* A dynamic call site is linked just before its first execution. * A dynamic call site is linked just before its first execution.
* The bootstrap method call implementing the linkage occurs within * The bootstrap method call implementing the linkage occurs within
* a thread that is attempting a first execution. * a thread that is attempting a first execution.
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
* just before its first invocation. * just before its first invocation.
* There is no way to undo the effect of a completed bootstrap method call. * There is no way to undo the effect of a completed bootstrap method call.
* *
* <h3>types of bootstrap methods</h3> * <h2>types of bootstrap methods</h2>
* As long as each bootstrap method can be correctly invoked * As long as each bootstrap method can be correctly invoked
* by {@code MethodHandle.invoke}, its detailed type is arbitrary. * by {@code MethodHandle.invoke}, its detailed type is arbitrary.
* For example, the first argument could be {@code Object} * For example, the first argument could be {@code Object}
......
...@@ -130,6 +130,7 @@ public interface AnnotatedElement { ...@@ -130,6 +130,7 @@ public interface AnnotatedElement {
* Returns this element's annotation for the specified type if * Returns this element's annotation for the specified type if
* such an annotation is present, else null. * such an annotation is present, else null.
* *
* @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
* @return this element's annotation for the specified annotation type if * @return this element's annotation for the specified annotation type if
...@@ -154,6 +155,7 @@ public interface AnnotatedElement { ...@@ -154,6 +155,7 @@ 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.
* *
* @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
* @return all this element's annotations for the specified annotation type if * @return all this element's annotations for the specified annotation type if
...@@ -184,6 +186,7 @@ public interface AnnotatedElement { ...@@ -184,6 +186,7 @@ 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.)
* *
* @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
* @return this element's annotation for the specified annotation type if * @return this element's annotation for the specified annotation type if
...@@ -209,6 +212,8 @@ public interface AnnotatedElement { ...@@ -209,6 +212,8 @@ 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.
* *
* @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
* @return all this element's annotations for the specified annotation type if * @return all this element's annotations for the specified annotation type if
......
...@@ -384,6 +384,8 @@ public abstract class Executable extends AccessibleObject ...@@ -384,6 +384,8 @@ public abstract class Executable extends AccessibleObject
/** /**
* Returns a string describing this {@code Executable}, including * Returns a string describing this {@code Executable}, including
* any type parameters. * any type parameters.
* @return a string describing this {@code Executable}, including
* any type parameters
*/ */
public abstract String toGenericString(); public abstract String toGenericString();
...@@ -496,6 +498,8 @@ public abstract class Executable extends AccessibleObject ...@@ -496,6 +498,8 @@ public abstract class Executable extends AccessibleObject
* If this Executable represents a method, the AnnotatedType object * If this Executable represents a method, the AnnotatedType object
* represents the use of a type to specify the return type of the method. * represents the use of a type to specify the return type of the method.
* *
* @return an object representing the return type of this method
* or constructor
* @since 1.8 * @since 1.8
*/ */
public abstract AnnotatedType getAnnotatedReturnType(); public abstract AnnotatedType getAnnotatedReturnType();
...@@ -531,6 +535,9 @@ public abstract class Executable extends AccessibleObject ...@@ -531,6 +535,9 @@ public abstract class Executable extends AccessibleObject
* *
* Returns null if this Executable represents a static method. * Returns null if this Executable represents a static method.
* *
* @return an object representing the receiver type of the
* method or constructor represented by this Executable
*
* @since 1.8 * @since 1.8
*/ */
public AnnotatedType getAnnotatedReceiverType() { public AnnotatedType getAnnotatedReceiverType() {
...@@ -553,6 +560,9 @@ public abstract class Executable extends AccessibleObject ...@@ -553,6 +560,9 @@ public abstract class Executable extends AccessibleObject
* Returns an array of length 0 if the method/constructor declares no * Returns an array of length 0 if the method/constructor declares no
* parameters. * parameters.
* *
* @return an array of objects representing the types of the
* formal parameters of this method or constructor
*
* @since 1.8 * @since 1.8
*/ */
public AnnotatedType[] getAnnotatedParameterTypes() { public AnnotatedType[] getAnnotatedParameterTypes() {
...@@ -575,6 +585,9 @@ public abstract class Executable extends AccessibleObject ...@@ -575,6 +585,9 @@ public abstract class Executable extends AccessibleObject
* Returns an array of length 0 if the method/constructor declares no * Returns an array of length 0 if the method/constructor declares no
* exceptions. * exceptions.
* *
* @return an array of objects representing the declared
* exceptions of this method or constructor
*
* @since 1.8 * @since 1.8
*/ */
public AnnotatedType[] getAnnotatedExceptionTypes() { public AnnotatedType[] getAnnotatedExceptionTypes() {
......
...@@ -1151,6 +1151,8 @@ class Field extends AccessibleObject implements Member { ...@@ -1151,6 +1151,8 @@ class Field extends AccessibleObject implements Member {
/** /**
* Returns an AnnotatedType object that represents the use of a type to specify * Returns an AnnotatedType object that represents the use of a type to specify
* the declared type of the field represented by this Field. * the declared type of the field represented by this Field.
* @return an object representing the declared type of the field
* represented by this Field
* *
* @since 1.8 * @since 1.8
*/ */
......
...@@ -152,6 +152,8 @@ public final class Parameter implements AnnotatedElement { ...@@ -152,6 +152,8 @@ public final class Parameter implements AnnotatedElement {
* defined in a class file, then that name will be returned by * defined in a class file, then that name will be returned by
* this method. Otherwise, this method will synthesize a name of * this method. Otherwise, this method will synthesize a name of
* the form argN, where N is the index of the parameter. * the form argN, where N is the index of the parameter.
*
* @return the name of the parameter
*/ */
public String getName() { public String getName() {
// Note: empty strings as paramete names are now outlawed. // Note: empty strings as paramete names are now outlawed.
......
...@@ -95,6 +95,7 @@ public interface TypeVariable<D extends GenericDeclaration> extends Type, Annota ...@@ -95,6 +95,7 @@ public interface TypeVariable<D extends GenericDeclaration> extends Type, Annota
* *
* Returns an array of length 0 if the type parameter declares no bounds. * Returns an array of length 0 if the type parameter declares no bounds.
* *
* @return an array of objects representing the upper bounds of the type variable
* @since 1.8 * @since 1.8
*/ */
AnnotatedType[] getAnnotatedBounds(); AnnotatedType[] getAnnotatedBounds();
......
...@@ -2572,6 +2572,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> { ...@@ -2572,6 +2572,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal> {
* ({@code this} * 10<sup>n</sup>). The scale of * ({@code this} * 10<sup>n</sup>). The scale of
* the result is {@code (this.scale() - n)}. * the result is {@code (this.scale() - n)}.
* *
* @param n the exponent power of ten to scale by
* @return a BigDecimal whose numerical value is equal to
* ({@code this} * 10<sup>n</sup>)
* @throws ArithmeticException if the scale would be * @throws ArithmeticException if the scale would be
* outside the range of a 32-bit integer. * outside the range of a 32-bit integer.
* *
......
...@@ -33,8 +33,11 @@ import java.io.IOException; ...@@ -33,8 +33,11 @@ import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.io.ObjectStreamField; import java.io.ObjectStreamField;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Random; import java.util.Random;
import sun.misc.DoubleConsts;
import sun.misc.FloatConsts;
/** /**
* Immutable arbitrary-precision integers. All operations behave as if * Immutable arbitrary-precision integers. All operations behave as if
...@@ -211,6 +214,16 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -211,6 +214,16 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
*/ */
private static final int TOOM_COOK_SQUARE_THRESHOLD = 140; private static final int TOOM_COOK_SQUARE_THRESHOLD = 140;
/**
* The threshold value for using Schoenhage recursive base conversion. If
* the number of ints in the number are larger than this value,
* the Schoenhage algorithm will be used. In practice, it appears that the
* Schoenhage routine is faster for any threshold down to 2, and is
* relatively flat for thresholds between 2-25, so this choice may be
* varied within this range for very small effect.
*/
private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8;
//Constructors //Constructors
/** /**
...@@ -1024,6 +1037,19 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -1024,6 +1037,19 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1]; private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1];
private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1]; private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1];
/**
* The cache of powers of each radix. This allows us to not have to
* recalculate powers of radix^(2^n) more than once. This speeds
* Schoenhage recursive base conversion significantly.
*/
private static volatile BigInteger[][] powerCache;
/** The cache of logarithms of radices for base conversion. */
private static final double[] logCache;
/** The natural log of 2. This is used in computing cache indices. */
private static final double LOG_TWO = Math.log(2.0);
static { static {
for (int i = 1; i <= MAX_CONSTANT; i++) { for (int i = 1; i <= MAX_CONSTANT; i++) {
int[] magnitude = new int[1]; int[] magnitude = new int[1];
...@@ -1031,6 +1057,20 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -1031,6 +1057,20 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
posConst[i] = new BigInteger(magnitude, 1); posConst[i] = new BigInteger(magnitude, 1);
negConst[i] = new BigInteger(magnitude, -1); negConst[i] = new BigInteger(magnitude, -1);
} }
/*
* Initialize the cache of radix^(2^x) values used for base conversion
* with just the very first value. Additional values will be created
* on demand.
*/
powerCache = new BigInteger[Character.MAX_RADIX+1][];
logCache = new double[Character.MAX_RADIX+1];
for (int i=Character.MIN_RADIX; i<=Character.MAX_RADIX; i++)
{
powerCache[i] = new BigInteger[] { BigInteger.valueOf(i) };
logCache[i] = Math.log(i);
}
} }
/** /**
...@@ -3297,6 +3337,28 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -3297,6 +3337,28 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
radix = 10; radix = 10;
// If it's small enough, use smallToString.
if (mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD)
return smallToString(radix);
// Otherwise use recursive toString, which requires positive arguments.
// The results will be concatenated into this StringBuilder
StringBuilder sb = new StringBuilder();
if (signum < 0) {
toString(this.negate(), sb, radix, 0);
sb.insert(0, '-');
}
else
toString(this, sb, radix, 0);
return sb.toString();
}
/** This method is used to perform toString when arguments are small. */
private String smallToString(int radix) {
if (signum == 0)
return "0";
// Compute upper bound on number of digit groups and allocate space // Compute upper bound on number of digit groups and allocate space
int maxNumDigitGroups = (4*mag.length + 6)/7; int maxNumDigitGroups = (4*mag.length + 6)/7;
String digitGroup[] = new String[maxNumDigitGroups]; String digitGroup[] = new String[maxNumDigitGroups];
...@@ -3335,6 +3397,81 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -3335,6 +3397,81 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
return buf.toString(); return buf.toString();
} }
/**
* Converts the specified BigInteger to a string and appends to
* <code>sb</code>. This implements the recursive Schoenhage algorithm
* for base conversions.
* <p/>
* See Knuth, Donald, _The Art of Computer Programming_, Vol. 2,
* Answers to Exercises (4.4) Question 14.
*
* @param u The number to convert to a string.
* @param sb The StringBuilder that will be appended to in place.
* @param radix The base to convert to.
* @param digits The minimum number of digits to pad to.
*/
private static void toString(BigInteger u, StringBuilder sb, int radix,
int digits) {
/* If we're smaller than a certain threshold, use the smallToString
method, padding with leading zeroes when necessary. */
if (u.mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD) {
String s = u.smallToString(radix);
// Pad with internal zeros if necessary.
// Don't pad if we're at the beginning of the string.
if ((s.length() < digits) && (sb.length() > 0))
for (int i=s.length(); i<digits; i++) // May be a faster way to
sb.append('0'); // do this?
sb.append(s);
return;
}
int b, n;
b = u.bitLength();
// Calculate a value for n in the equation radix^(2^n) = u
// and subtract 1 from that value. This is used to find the
// cache index that contains the best value to divide u.
n = (int) Math.round(Math.log(b * LOG_TWO / logCache[radix]) / LOG_TWO - 1.0);
BigInteger v = getRadixConversionCache(radix, n);
BigInteger[] results;
results = u.divideAndRemainder(v);
int expectedDigits = 1 << n;
// Now recursively build the two halves of each number.
toString(results[0], sb, radix, digits-expectedDigits);
toString(results[1], sb, radix, expectedDigits);
}
/**
* Returns the value radix^(2^exponent) from the cache.
* If this value doesn't already exist in the cache, it is added.
* <p/>
* This could be changed to a more complicated caching method using
* <code>Future</code>.
*/
private static BigInteger getRadixConversionCache(int radix, int exponent) {
BigInteger[] cacheLine = powerCache[radix]; // volatile read
if (exponent < cacheLine.length) {
return cacheLine[exponent];
}
int oldLength = cacheLine.length;
cacheLine = Arrays.copyOf(cacheLine, exponent + 1);
for (int i = oldLength; i <= exponent; i++) {
cacheLine[i] = cacheLine[i - 1].pow(2);
}
BigInteger[][] pc = powerCache; // volatile read again
if (exponent >= pc[radix].length) {
pc = pc.clone();
pc[radix] = cacheLine;
powerCache = pc; // volatile write, publish
}
return cacheLine[exponent];
}
/* zero[i] is a string of i consecutive zeros. */ /* zero[i] is a string of i consecutive zeros. */
private static String zeros[] = new String[64]; private static String zeros[] = new String[64];
...@@ -3452,8 +3589,72 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -3452,8 +3589,72 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @return this BigInteger converted to a {@code float}. * @return this BigInteger converted to a {@code float}.
*/ */
public float floatValue() { public float floatValue() {
// Somewhat inefficient, but guaranteed to work. if (signum == 0) {
return Float.parseFloat(this.toString()); return 0.0f;
}
int exponent = ((mag.length - 1) << 5) + bitLengthForInt(mag[0]) - 1;
// exponent == floor(log2(abs(this)))
if (exponent < Long.SIZE - 1) {
return longValue();
} else if (exponent > Float.MAX_EXPONENT) {
return signum > 0 ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
}
/*
* We need the top SIGNIFICAND_WIDTH bits, including the "implicit"
* one bit. To make rounding easier, we pick out the top
* SIGNIFICAND_WIDTH + 1 bits, so we have one to help us round up or
* down. twiceSignifFloor will contain the top SIGNIFICAND_WIDTH + 1
* bits, and signifFloor the top SIGNIFICAND_WIDTH.
*
* It helps to consider the real number signif = abs(this) *
* 2^(SIGNIFICAND_WIDTH - 1 - exponent).
*/
int shift = exponent - FloatConsts.SIGNIFICAND_WIDTH;
int twiceSignifFloor;
// twiceSignifFloor will be == abs().shiftRight(shift).intValue()
// We do the shift into an int directly to improve performance.
int nBits = shift & 0x1f;
int nBits2 = 32 - nBits;
if (nBits == 0) {
twiceSignifFloor = mag[0];
} else {
twiceSignifFloor = mag[0] >>> nBits;
if (twiceSignifFloor == 0) {
twiceSignifFloor = (mag[0] << nBits2) | (mag[1] >>> nBits);
}
}
int signifFloor = twiceSignifFloor >> 1;
signifFloor &= FloatConsts.SIGNIF_BIT_MASK; // remove the implied bit
/*
* We round up if either the fractional part of signif is strictly
* greater than 0.5 (which is true if the 0.5 bit is set and any lower
* bit is set), or if the fractional part of signif is >= 0.5 and
* signifFloor is odd (which is true if both the 0.5 bit and the 1 bit
* are set). This is equivalent to the desired HALF_EVEN rounding.
*/
boolean increment = (twiceSignifFloor & 1) != 0
&& ((signifFloor & 1) != 0 || abs().getLowestSetBit() < shift);
int signifRounded = increment ? signifFloor + 1 : signifFloor;
int bits = ((exponent + FloatConsts.EXP_BIAS))
<< (FloatConsts.SIGNIFICAND_WIDTH - 1);
bits += signifRounded;
/*
* If signifRounded == 2^24, we'd need to set all of the significand
* bits to zero and add 1 to the exponent. This is exactly the behavior
* we get from just adding signifRounded to bits directly. If the
* exponent is Float.MAX_EXPONENT, we round up (correctly) to
* Float.POSITIVE_INFINITY.
*/
bits |= signum & FloatConsts.SIGN_BIT_MASK;
return Float.intBitsToFloat(bits);
} }
/** /**
...@@ -3472,8 +3673,80 @@ public class BigInteger extends Number implements Comparable<BigInteger> { ...@@ -3472,8 +3673,80 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* @return this BigInteger converted to a {@code double}. * @return this BigInteger converted to a {@code double}.
*/ */
public double doubleValue() { public double doubleValue() {
// Somewhat inefficient, but guaranteed to work. if (signum == 0) {
return Double.parseDouble(this.toString()); return 0.0;
}
int exponent = ((mag.length - 1) << 5) + bitLengthForInt(mag[0]) - 1;
// exponent == floor(log2(abs(this))Double)
if (exponent < Long.SIZE - 1) {
return longValue();
} else if (exponent > Double.MAX_EXPONENT) {
return signum > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY;
}
/*
* We need the top SIGNIFICAND_WIDTH bits, including the "implicit"
* one bit. To make rounding easier, we pick out the top
* SIGNIFICAND_WIDTH + 1 bits, so we have one to help us round up or
* down. twiceSignifFloor will contain the top SIGNIFICAND_WIDTH + 1
* bits, and signifFloor the top SIGNIFICAND_WIDTH.
*
* It helps to consider the real number signif = abs(this) *
* 2^(SIGNIFICAND_WIDTH - 1 - exponent).
*/
int shift = exponent - DoubleConsts.SIGNIFICAND_WIDTH;
long twiceSignifFloor;
// twiceSignifFloor will be == abs().shiftRight(shift).longValue()
// We do the shift into a long directly to improve performance.
int nBits = shift & 0x1f;
int nBits2 = 32 - nBits;
int highBits;
int lowBits;
if (nBits == 0) {
highBits = mag[0];
lowBits = mag[1];
} else {
highBits = mag[0] >>> nBits;
lowBits = (mag[0] << nBits2) | (mag[1] >>> nBits);
if (highBits == 0) {
highBits = lowBits;
lowBits = (mag[1] << nBits2) | (mag[2] >>> nBits);
}
}
twiceSignifFloor = ((highBits & LONG_MASK) << 32)
| (lowBits & LONG_MASK);
long signifFloor = twiceSignifFloor >> 1;
signifFloor &= DoubleConsts.SIGNIF_BIT_MASK; // remove the implied bit
/*
* We round up if either the fractional part of signif is strictly
* greater than 0.5 (which is true if the 0.5 bit is set and any lower
* bit is set), or if the fractional part of signif is >= 0.5 and
* signifFloor is odd (which is true if both the 0.5 bit and the 1 bit
* are set). This is equivalent to the desired HALF_EVEN rounding.
*/
boolean increment = (twiceSignifFloor & 1) != 0
&& ((signifFloor & 1) != 0 || abs().getLowestSetBit() < shift);
long signifRounded = increment ? signifFloor + 1 : signifFloor;
long bits = (long) ((exponent + DoubleConsts.EXP_BIAS))
<< (DoubleConsts.SIGNIFICAND_WIDTH - 1);
bits += signifRounded;
/*
* If signifRounded == 2^53, we'd need to set all of the significand
* bits to zero and add 1 to the exponent. This is exactly the behavior
* we get from just adding signifRounded to bits directly. If the
* exponent is Double.MAX_EXPONENT, we round up (correctly) to
* Double.POSITIVE_INFINITY.
*/
bits |= signum & DoubleConsts.SIGN_BIT_MASK;
return Double.longBitsToDouble(bits);
} }
/** /**
......
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 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
...@@ -101,6 +101,7 @@ public enum RoundingMode { ...@@ -101,6 +101,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode UP Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code UP} rounding * <th>Input rounded to one digit<br> with {@code UP} rounding
*<tr align=right><td>5.5</td> <td>6</td> *<tr align=right><td>5.5</td> <td>6</td>
...@@ -124,6 +125,7 @@ public enum RoundingMode { ...@@ -124,6 +125,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode DOWN Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code DOWN} rounding * <th>Input rounded to one digit<br> with {@code DOWN} rounding
*<tr align=right><td>5.5</td> <td>5</td> *<tr align=right><td>5.5</td> <td>5</td>
...@@ -148,6 +150,7 @@ public enum RoundingMode { ...@@ -148,6 +150,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode CEILING Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code CEILING} rounding * <th>Input rounded to one digit<br> with {@code CEILING} rounding
*<tr align=right><td>5.5</td> <td>6</td> *<tr align=right><td>5.5</td> <td>6</td>
...@@ -172,6 +175,7 @@ public enum RoundingMode { ...@@ -172,6 +175,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode FLOOR Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code FLOOR} rounding * <th>Input rounded to one digit<br> with {@code FLOOR} rounding
*<tr align=right><td>5.5</td> <td>5</td> *<tr align=right><td>5.5</td> <td>5</td>
...@@ -198,6 +202,7 @@ public enum RoundingMode { ...@@ -198,6 +202,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode HALF_UP Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code HALF_UP} rounding * <th>Input rounded to one digit<br> with {@code HALF_UP} rounding
*<tr align=right><td>5.5</td> <td>6</td> *<tr align=right><td>5.5</td> <td>6</td>
...@@ -223,6 +228,7 @@ public enum RoundingMode { ...@@ -223,6 +228,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode HALF_DOWN Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code HALF_DOWN} rounding * <th>Input rounded to one digit<br> with {@code HALF_DOWN} rounding
*<tr align=right><td>5.5</td> <td>5</td> *<tr align=right><td>5.5</td> <td>5</td>
...@@ -255,6 +261,7 @@ public enum RoundingMode { ...@@ -255,6 +261,7 @@ public enum RoundingMode {
* *
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode HALF_EVEN Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code HALF_EVEN} rounding * <th>Input rounded to one digit<br> with {@code HALF_EVEN} rounding
*<tr align=right><td>5.5</td> <td>6</td> *<tr align=right><td>5.5</td> <td>6</td>
...@@ -278,6 +285,7 @@ public enum RoundingMode { ...@@ -278,6 +285,7 @@ public enum RoundingMode {
* {@code ArithmeticException} is thrown. * {@code ArithmeticException} is thrown.
*<p>Example: *<p>Example:
*<table border> *<table border>
* <caption><b>Rounding mode UNNECESSARY Examples</b></caption>
*<tr valign=top><th>Input Number</th> *<tr valign=top><th>Input Number</th>
* <th>Input rounded to one digit<br> with {@code UNNECESSARY} rounding * <th>Input rounded to one digit<br> with {@code UNNECESSARY} rounding
*<tr align=right><td>5.5</td> <td>throw {@code ArithmeticException}</td> *<tr align=right><td>5.5</td> <td>throw {@code ArithmeticException}</td>
......
...@@ -52,7 +52,7 @@ import java.util.Spliterator; ...@@ -52,7 +52,7 @@ import java.util.Spliterator;
* <p> There is one subclass of this class for each non-boolean primitive type. * <p> There is one subclass of this class for each non-boolean primitive type.
* *
* *
* <h4> Transferring data </h4> * <h2> Transferring data </h2>
* *
* <p> Each subclass of this class defines two categories of <i>get</i> and * <p> Each subclass of this class defines two categories of <i>get</i> and
* <i>put</i> operations: </p> * <i>put</i> operations: </p>
...@@ -78,7 +78,7 @@ import java.util.Spliterator; ...@@ -78,7 +78,7 @@ import java.util.Spliterator;
* current position. * current position.
* *
* *
* <h4> Marking and resetting </h4> * <h2> Marking and resetting </h2>
* *
* <p> A buffer's <i>mark</i> is the index to which its position will be reset * <p> A buffer's <i>mark</i> is the index to which its position will be reset
* when the {@link #reset reset} method is invoked. The mark is not always * when the {@link #reset reset} method is invoked. The mark is not always
...@@ -89,7 +89,7 @@ import java.util.Spliterator; ...@@ -89,7 +89,7 @@ import java.util.Spliterator;
* {@link InvalidMarkException} to be thrown. * {@link InvalidMarkException} to be thrown.
* *
* *
* <h4> Invariants </h4> * <h2> Invariants </h2>
* *
* <p> The following invariant holds for the mark, position, limit, and * <p> The following invariant holds for the mark, position, limit, and
* capacity values: * capacity values:
...@@ -109,7 +109,7 @@ import java.util.Spliterator; ...@@ -109,7 +109,7 @@ import java.util.Spliterator;
* to zero. * to zero.
* *
* *
* <h4> Clearing, flipping, and rewinding </h4> * <h2> Clearing, flipping, and rewinding </h2>
* *
* <p> In addition to methods for accessing the position, limit, and capacity * <p> In addition to methods for accessing the position, limit, and capacity
* values and for marking and resetting, this class also defines the following * values and for marking and resetting, this class also defines the following
...@@ -132,7 +132,7 @@ import java.util.Spliterator; ...@@ -132,7 +132,7 @@ import java.util.Spliterator;
* </ul> * </ul>
* *
* *
* <h4> Read-only buffers </h4> * <h2> Read-only buffers </h2>
* *
* <p> Every buffer is readable, but not every buffer is writable. The * <p> Every buffer is readable, but not every buffer is writable. The
* mutation methods of each buffer class are specified as <i>optional * mutation methods of each buffer class are specified as <i>optional
...@@ -143,14 +143,14 @@ import java.util.Spliterator; ...@@ -143,14 +143,14 @@ import java.util.Spliterator;
* {@link #isReadOnly isReadOnly} method. * {@link #isReadOnly isReadOnly} method.
* *
* *
* <h4> Thread safety </h4> * <h2> Thread safety </h2>
* *
* <p> Buffers are not safe for use by multiple concurrent threads. If a * <p> Buffers are not safe for use by multiple concurrent threads. If a
* buffer is to be used by more than one thread then access to the buffer * buffer is to be used by more than one thread then access to the buffer
* should be controlled by appropriate synchronization. * should be controlled by appropriate synchronization.
* *
* *
* <h4> Invocation chaining </h4> * <h2> Invocation chaining </h2>
* *
* <p> Methods in this class that do not otherwise have a value to return are * <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows * specified to return the buffer upon which they are invoked. This allows
......
...@@ -45,7 +45,7 @@ import sun.misc.Unsafe; ...@@ -45,7 +45,7 @@ import sun.misc.Unsafe;
* this program or another. Whether or not such changes occur, and when they * this program or another. Whether or not such changes occur, and when they
* occur, is operating-system dependent and therefore unspecified. * occur, is operating-system dependent and therefore unspecified.
* *
* <a name="inaccess"><p> All or part of a mapped byte buffer may become * <a name="inaccess"></a><p> All or part of a mapped byte buffer may become
* inaccessible at any time, for example if the mapped file is truncated. An * inaccessible at any time, for example if the mapped file is truncated. An
* attempt to access an inaccessible region of a mapped byte buffer will not * attempt to access an inaccessible region of a mapped byte buffer will not
* change the buffer's content and will cause an unspecified exception to be * change the buffer's content and will cause an unspecified exception to be
......
...@@ -44,23 +44,23 @@ import java.util.stream.$Streamtype$Stream; ...@@ -44,23 +44,23 @@ import java.util.stream.$Streamtype$Stream;
* *
* <ul> * <ul>
* *
* <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and * <li><p> Absolute and relative {@link #get() <i>get</i>} and
* {@link #put($type$) </code><i>put</i><code>} methods that read and write * {@link #put($type$) <i>put</i>} methods that read and write
* single $type$s; </p></li> * single $type$s; </p></li>
* *
* <li><p> Relative {@link #get($type$[]) </code><i>bulk get</i><code>} * <li><p> Relative {@link #get($type$[]) <i>bulk get</i>}
* methods that transfer contiguous sequences of $type$s from this buffer * methods that transfer contiguous sequences of $type$s from this buffer
* into an array; {#if[!byte]?and}</p></li> * into an array; {#if[!byte]?and}</p></li>
* *
* <li><p> Relative {@link #put($type$[]) </code><i>bulk put</i><code>} * <li><p> Relative {@link #put($type$[]) <i>bulk put</i>}
* methods that transfer contiguous sequences of $type$s from $a$ * methods that transfer contiguous sequences of $type$s from $a$
* $type$ array{#if[char]?,&#32;a&#32;string,} or some other $type$ * $type$ array{#if[char]?,&#32;a&#32;string,} or some other $type$
* buffer into this buffer;{#if[!byte]?&#32;and} </p></li> * buffer into this buffer;{#if[!byte]?&#32;and} </p></li>
* *
#if[byte] #if[byte]
* *
* <li><p> Absolute and relative {@link #getChar() </code><i>get</i><code>} * <li><p> Absolute and relative {@link #getChar() <i>get</i>}
* and {@link #putChar(char) </code><i>put</i><code>} methods that read and * and {@link #putChar(char) <i>put</i>} methods that read and
* write values of other primitive types, translating them to and from * write values of other primitive types, translating them to and from
* sequences of bytes in a particular byte order; </p></li> * sequences of bytes in a particular byte order; </p></li>
* *
...@@ -70,23 +70,23 @@ import java.util.stream.$Streamtype$Stream; ...@@ -70,23 +70,23 @@ import java.util.stream.$Streamtype$Stream;
* *
#end[byte] #end[byte]
* *
* <li><p> Methods for {@link #compact </code>compacting<code>}, {@link * <li><p> Methods for {@link #compact compacting}, {@link
* #duplicate </code>duplicating<code>}, and {@link #slice * #duplicate duplicating}, and {@link #slice slicing}
* </code>slicing<code>} $a$ $type$ buffer. </p></li> * $a$ $type$ buffer. </p></li>
* *
* </ul> * </ul>
* *
* <p> $Type$ buffers can be created either by {@link #allocate * <p> $Type$ buffers can be created either by {@link #allocate
* </code><i>allocation</i><code>}, which allocates space for the buffer's * <i>allocation</i>}, which allocates space for the buffer's
* *
#if[byte] #if[byte]
* *
* content, or by {@link #wrap($type$[]) </code><i>wrapping</i><code>} an * content, or by {@link #wrap($type$[]) <i>wrapping</i>} an
* existing $type$ array {#if[char]?or&#32;string} into a buffer. * existing $type$ array {#if[char]?or&#32;string} into a buffer.
* *
#else[byte] #else[byte]
* *
* content, by {@link #wrap($type$[]) </code><i>wrapping</i><code>} an existing * content, by {@link #wrap($type$[]) <i>wrapping</i>} an existing
* $type$ array {#if[char]?or&#32;string} into a buffer, or by creating a * $type$ array {#if[char]?or&#32;string} into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer. * <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
* *
...@@ -94,8 +94,8 @@ import java.util.stream.$Streamtype$Stream; ...@@ -94,8 +94,8 @@ import java.util.stream.$Streamtype$Stream;
* *
#if[byte] #if[byte]
* *
* <a name="direct"> * <a name="direct"></a>
* <h4> Direct <i>vs.</i> non-direct buffers </h4> * <h2> Direct <i>vs.</i> non-direct buffers </h2>
* *
* <p> A byte buffer is either <i>direct</i> or <i>non-direct</i>. Given a * <p> A byte buffer is either <i>direct</i> or <i>non-direct</i>. Given a
* direct byte buffer, the Java virtual machine will make a best effort to * direct byte buffer, the Java virtual machine will make a best effort to
...@@ -116,7 +116,7 @@ import java.util.stream.$Streamtype$Stream; ...@@ -116,7 +116,7 @@ import java.util.stream.$Streamtype$Stream;
* buffers only when they yield a measureable gain in program performance. * buffers only when they yield a measureable gain in program performance.
* *
* <p> A direct byte buffer may also be created by {@link * <p> A direct byte buffer may also be created by {@link
* java.nio.channels.FileChannel#map </code>mapping<code>} a region of a file * java.nio.channels.FileChannel#map mapping} a region of a file
* directly into memory. An implementation of the Java platform may optionally * directly into memory. An implementation of the Java platform may optionally
* support the creation of direct byte buffers from native code via JNI. If an * support the creation of direct byte buffers from native code via JNI. If an
* instance of one of these kinds of buffers refers to an inaccessible region * instance of one of these kinds of buffers refers to an inaccessible region
...@@ -129,8 +129,8 @@ import java.util.stream.$Streamtype$Stream; ...@@ -129,8 +129,8 @@ import java.util.stream.$Streamtype$Stream;
* that explicit buffer management can be done in performance-critical code. * that explicit buffer management can be done in performance-critical code.
* *
* *
* <a name="bin"> * <a name="bin"></a>
* <h4> Access to binary data </h4> * <h2> Access to binary data </h2>
* *
* <p> This class defines methods for reading and writing values of all other * <p> This class defines methods for reading and writing values of all other
* primitive types, except <tt>boolean</tt>. Primitive values are translated * primitive types, except <tt>boolean</tt>. Primitive values are translated
...@@ -156,7 +156,7 @@ import java.util.stream.$Streamtype$Stream; ...@@ -156,7 +156,7 @@ import java.util.stream.$Streamtype$Stream;
* parameters of the absolute <i>get</i> and <i>put</i> methods are in terms of * parameters of the absolute <i>get</i> and <i>put</i> methods are in terms of
* bytes rather than of the type being read or written. * bytes rather than of the type being read or written.
* *
* <a name="views"> * <a name="views"></a>
* *
* <p> For access to homogeneous binary data, that is, sequences of values of * <p> For access to homogeneous binary data, that is, sequences of values of
* the same type, this class defines methods that can create <i>views</i> of a * the same type, this class defines methods that can create <i>views</i> of a
...@@ -214,7 +214,7 @@ import java.util.stream.$Streamtype$Stream; ...@@ -214,7 +214,7 @@ import java.util.stream.$Streamtype$Stream;
#end[char] #end[char]
* *
#if[byte] #if[byte]
* <h4> Invocation chaining </h4> * <h2> Invocation chaining </h2>
#end[byte] #end[byte]
* *
* <p> Methods in this class that do not otherwise have a value to return are * <p> Methods in this class that do not otherwise have a value to return are
...@@ -297,7 +297,7 @@ public abstract class $Type$Buffer ...@@ -297,7 +297,7 @@ public abstract class $Type$Buffer
* <p> The new buffer's position will be zero, its limit will be its * <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be * capacity, its mark will be undefined, and each of its elements will be
* initialized to zero. Whether or not it has a * initialized to zero. Whether or not it has a
* {@link #hasArray </code>backing array<code>} is unspecified. * {@link #hasArray backing array} is unspecified.
* *
* @param capacity * @param capacity
* The new buffer's capacity, in $type$s * The new buffer's capacity, in $type$s
...@@ -318,9 +318,8 @@ public abstract class $Type$Buffer ...@@ -318,9 +318,8 @@ public abstract class $Type$Buffer
* *
* <p> The new buffer's position will be zero, its limit will be its * <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be * capacity, its mark will be undefined, and each of its elements will be
* initialized to zero. It will have a {@link #array * initialized to zero. It will have a {@link #array backing array},
* </code>backing array<code>}, and its {@link #arrayOffset </code>array * and its {@link #arrayOffset array offset} will be zero.
* offset<code>} will be zero.
* *
* @param capacity * @param capacity
* The new buffer's capacity, in $type$s * The new buffer's capacity, in $type$s
...@@ -344,8 +343,8 @@ public abstract class $Type$Buffer ...@@ -344,8 +343,8 @@ public abstract class $Type$Buffer
* and vice versa. The new buffer's capacity will be * and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit * <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its * will be <tt>offset + length</tt>, and its mark will be undefined. Its
* {@link #array </code>backing array<code>} will be the given array, and * {@link #array backing array} will be the given array, and
* its {@link #arrayOffset </code>array offset<code>} will be zero. </p> * its {@link #arrayOffset array offset} will be zero. </p>
* *
* @param array * @param array
* The array that will back the new buffer * The array that will back the new buffer
...@@ -384,8 +383,8 @@ public abstract class $Type$Buffer ...@@ -384,8 +383,8 @@ public abstract class $Type$Buffer
* that is, modifications to the buffer will cause the array to be modified * that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be * and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be * <tt>array.length</tt>, its position will be zero, and its mark will be
* undefined. Its {@link #array </code>backing array<code>} will be the * undefined. Its {@link #array backing array} will be the
* given array, and its {@link #arrayOffset </code>array offset<code>} will * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p> * be zero. </p>
* *
* @param array * @param array
...@@ -703,6 +702,9 @@ public abstract class $Type$Buffer ...@@ -703,6 +702,9 @@ public abstract class $Type$Buffer
* <pre> * <pre>
* src.get(a, 0, a.length) </pre> * src.get(a, 0, a.length) </pre>
* *
* @param dst
* The destination array
*
* @return This buffer * @return This buffer
* *
* @throws BufferUnderflowException * @throws BufferUnderflowException
...@@ -842,6 +844,9 @@ public abstract class $Type$Buffer ...@@ -842,6 +844,9 @@ public abstract class $Type$Buffer
* <pre> * <pre>
* dst.put(a, 0, a.length) </pre> * dst.put(a, 0, a.length) </pre>
* *
* @param src
* The source array
*
* @return This buffer * @return This buffer
* *
* @throws BufferOverflowException * @throws BufferOverflowException
...@@ -930,6 +935,9 @@ public abstract class $Type$Buffer ...@@ -930,6 +935,9 @@ public abstract class $Type$Buffer
* <pre> * <pre>
* dst.put(s, 0, s.length()) </pre> * dst.put(s, 0, s.length()) </pre>
* *
* @param src
* The source string
*
* @return This buffer * @return This buffer
* *
* @throws BufferOverflowException * @throws BufferOverflowException
...@@ -1419,7 +1427,7 @@ public abstract class $Type$Buffer ...@@ -1419,7 +1427,7 @@ public abstract class $Type$Buffer
* *
* <p> The byte order of $a$ $type$ buffer created by allocation or by * <p> The byte order of $a$ $type$ buffer created by allocation or by
* wrapping an existing <tt>$type$</tt> array is the {@link * wrapping an existing <tt>$type$</tt> array is the {@link
* ByteOrder#nativeOrder </code>native order<code>} of the underlying * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of $a$ $type$ buffer created as a <a * hardware. The byte order of $a$ $type$ buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the * href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p> * byte buffer at the moment that the view is created. </p>
......
...@@ -87,6 +87,8 @@ public interface AsynchronousByteChannel ...@@ -87,6 +87,8 @@ public interface AsynchronousByteChannel
* initiates a read operation before a previous read operation has * initiates a read operation before a previous read operation has
* completed then a {@link ReadPendingException} will be thrown. * completed then a {@link ReadPendingException} will be thrown.
* *
* @param <A>
* The type of the attachment
* @param dst * @param dst
* The buffer into which bytes are to be transferred * The buffer into which bytes are to be transferred
* @param attachment * @param attachment
...@@ -166,6 +168,8 @@ public interface AsynchronousByteChannel ...@@ -166,6 +168,8 @@ public interface AsynchronousByteChannel
* initiates a write operation before a previous write operation has * initiates a write operation before a previous write operation has
* completed then a {@link WritePendingException} will be thrown. * completed then a {@link WritePendingException} will be thrown.
* *
* @param <A>
* The type of the attachment
* @param src * @param src
* The buffer from which bytes are to be retrieved * The buffer from which bytes are to be retrieved
* @param attachment * @param attachment
......
...@@ -61,7 +61,7 @@ import java.util.concurrent.Future; // javadoc ...@@ -61,7 +61,7 @@ import java.util.concurrent.Future; // javadoc
* may not allow more than one read and one write operation to be outstanding at * may not allow more than one read and one write operation to be outstanding at
* any given time. * any given time.
* *
* <h4>Cancellation</h4> * <h2>Cancellation</h2>
* *
* <p> The {@code Future} interface defines the {@link Future#cancel cancel} * <p> The {@code Future} interface defines the {@link Future#cancel cancel}
* method to cancel execution. This causes all threads waiting on the result of * method to cancel execution. This causes all threads waiting on the result of
......
...@@ -60,7 +60,7 @@ import java.util.concurrent.TimeUnit; ...@@ -60,7 +60,7 @@ import java.util.concurrent.TimeUnit;
* default group is not configured then the pooled threads of the default group * default group is not configured then the pooled threads of the default group
* are {@link Thread#isDaemon daemon} threads. * are {@link Thread#isDaemon daemon} threads.
* *
* <table border> * <table border summary="System properties">
* <tr> * <tr>
* <th>System property</th> * <th>System property</th>
* <th>Description</th> * <th>Description</th>
...@@ -89,7 +89,7 @@ import java.util.concurrent.TimeUnit; ...@@ -89,7 +89,7 @@ import java.util.concurrent.TimeUnit;
* </tr> * </tr>
* </table> * </table>
* *
* <a name="threading"><h4>Threading</h4></a> * <a name="threading"></a><h2>Threading</h2>
* *
* <p> The completion handler for an I/O operation initiated on a channel bound * <p> The completion handler for an I/O operation initiated on a channel bound
* to a group is guaranteed to be invoked by one of the pooled threads in the * to a group is guaranteed to be invoked by one of the pooled threads in the
...@@ -104,7 +104,7 @@ import java.util.concurrent.TimeUnit; ...@@ -104,7 +104,7 @@ import java.util.concurrent.TimeUnit;
* handler directly by the initiating thread (see {@link * handler directly by the initiating thread (see {@link
* AsynchronousServerSocketChannel#accept(Object,CompletionHandler) accept}). * AsynchronousServerSocketChannel#accept(Object,CompletionHandler) accept}).
* *
* <a name="shutdown"><h4>Shutdown and Termination</h4></a> * <a name="shutdown"></a><h2>Shutdown and Termination</h2>
* *
* <p> The {@link #shutdown() shutdown} method is used to initiate an <em>orderly * <p> The {@link #shutdown() shutdown} method is used to initiate an <em>orderly
* shutdown</em> of a group. An orderly shutdown marks the group as shutdown; * shutdown</em> of a group. An orderly shutdown marks the group as shutdown;
......
...@@ -425,6 +425,8 @@ public abstract class AsynchronousFileChannel ...@@ -425,6 +425,8 @@ public abstract class AsynchronousFileChannel
* They are not suitable for controlling access to a file by multiple * They are not suitable for controlling access to a file by multiple
* threads within the same virtual machine. * threads within the same virtual machine.
* *
* @param <A>
* The type of the attachment
* @param position * @param position
* The position at which the locked region is to start; must be * The position at which the locked region is to start; must be
* non-negative * non-negative
...@@ -473,6 +475,8 @@ public abstract class AsynchronousFileChannel ...@@ -473,6 +475,8 @@ public abstract class AsynchronousFileChannel
* ch.{@link #lock(long,long,boolean,Object,CompletionHandler) lock}(0L, Long.MAX_VALUE, false, att, handler) * ch.{@link #lock(long,long,boolean,Object,CompletionHandler) lock}(0L, Long.MAX_VALUE, false, att, handler)
* </pre> * </pre>
* *
* @param <A>
* The type of the attachment
* @param attachment * @param attachment
* The object to attach to the I/O operation; can be {@code null} * The object to attach to the I/O operation; can be {@code null}
* @param handler * @param handler
...@@ -652,6 +656,8 @@ public abstract class AsynchronousFileChannel ...@@ -652,6 +656,8 @@ public abstract class AsynchronousFileChannel
* If the given file position is greater than the file's size at the time * If the given file position is greater than the file's size at the time
* that the read is attempted then no bytes are read. * that the read is attempted then no bytes are read.
* *
* @param <A>
* The type of the attachment
* @param dst * @param dst
* The buffer into which bytes are to be transferred * The buffer into which bytes are to be transferred
* @param position * @param position
...@@ -716,6 +722,8 @@ public abstract class AsynchronousFileChannel ...@@ -716,6 +722,8 @@ public abstract class AsynchronousFileChannel
* bytes; the values of any bytes between the previous end-of-file and the * bytes; the values of any bytes between the previous end-of-file and the
* newly-written bytes are unspecified. * newly-written bytes are unspecified.
* *
* @param <A>
* The type of the attachment
* @param src * @param src
* The buffer from which bytes are to be transferred * The buffer from which bytes are to be transferred
* @param position * @param position
......
...@@ -52,7 +52,7 @@ import java.io.IOException; ...@@ -52,7 +52,7 @@ import java.io.IOException;
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object) * <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Channels of this type support the following options: * setOption} method. Channels of this type support the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -98,6 +98,9 @@ public abstract class AsynchronousServerSocketChannel ...@@ -98,6 +98,9 @@ public abstract class AsynchronousServerSocketChannel
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this channel
*/ */
protected AsynchronousServerSocketChannel(AsynchronousChannelProvider provider) { protected AsynchronousServerSocketChannel(AsynchronousChannelProvider provider) {
this.provider = provider; this.provider = provider;
...@@ -105,6 +108,8 @@ public abstract class AsynchronousServerSocketChannel ...@@ -105,6 +108,8 @@ public abstract class AsynchronousServerSocketChannel
/** /**
* Returns the provider that created this channel. * Returns the provider that created this channel.
*
* @return The provider that created this channel
*/ */
public final AsynchronousChannelProvider provider() { public final AsynchronousChannelProvider provider() {
return provider; return provider;
...@@ -263,6 +268,8 @@ public abstract class AsynchronousServerSocketChannel ...@@ -263,6 +268,8 @@ public abstract class AsynchronousServerSocketChannel
* the connection is closed and the operation completes with a {@link * the connection is closed and the operation completes with a {@link
* SecurityException}. * SecurityException}.
* *
* @param <A>
* The type of the attachment
* @param attachment * @param attachment
* The object to attach to the I/O operation; can be {@code null} * The object to attach to the I/O operation; can be {@code null}
* @param handler * @param handler
......
...@@ -62,7 +62,7 @@ import java.nio.ByteBuffer; ...@@ -62,7 +62,7 @@ import java.nio.ByteBuffer;
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object) * <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Asynchronous socket channels support the following options: * setOption} method. Asynchronous socket channels support the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -91,7 +91,7 @@ import java.nio.ByteBuffer; ...@@ -91,7 +91,7 @@ import java.nio.ByteBuffer;
* </blockquote> * </blockquote>
* Additional (implementation specific) options may also be supported. * Additional (implementation specific) options may also be supported.
* *
* <h4>Timeouts</h4> * <h2>Timeouts</h2>
* *
* <p> The {@link #read(ByteBuffer,long,TimeUnit,Object,CompletionHandler) read} * <p> The {@link #read(ByteBuffer,long,TimeUnit,Object,CompletionHandler) read}
* and {@link #write(ByteBuffer,long,TimeUnit,Object,CompletionHandler) write} * and {@link #write(ByteBuffer,long,TimeUnit,Object,CompletionHandler) write}
...@@ -123,6 +123,9 @@ public abstract class AsynchronousSocketChannel ...@@ -123,6 +123,9 @@ public abstract class AsynchronousSocketChannel
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this channel
*/ */
protected AsynchronousSocketChannel(AsynchronousChannelProvider provider) { protected AsynchronousSocketChannel(AsynchronousChannelProvider provider) {
this.provider = provider; this.provider = provider;
...@@ -130,6 +133,8 @@ public abstract class AsynchronousSocketChannel ...@@ -130,6 +133,8 @@ public abstract class AsynchronousSocketChannel
/** /**
* Returns the provider that created this channel. * Returns the provider that created this channel.
*
* @return The provider that created this channel
*/ */
public final AsynchronousChannelProvider provider() { public final AsynchronousChannelProvider provider() {
return provider; return provider;
...@@ -287,6 +292,8 @@ public abstract class AsynchronousSocketChannel ...@@ -287,6 +292,8 @@ public abstract class AsynchronousSocketChannel
* java.lang.SecurityManager#checkConnect checkConnect} method permits * java.lang.SecurityManager#checkConnect checkConnect} method permits
* connecting to the address and port number of the given remote endpoint. * connecting to the address and port number of the given remote endpoint.
* *
* @param <A>
* The type of the attachment
* @param remote * @param remote
* The remote address to which this channel is to be connected * The remote address to which this channel is to be connected
* @param attachment * @param attachment
...@@ -365,6 +372,8 @@ public abstract class AsynchronousSocketChannel ...@@ -365,6 +372,8 @@ public abstract class AsynchronousSocketChannel
* AsynchronousByteChannel#read(ByteBuffer,Object,CompletionHandler)} * AsynchronousByteChannel#read(ByteBuffer,Object,CompletionHandler)}
* method. * method.
* *
* @param <A>
* The type of the attachment
* @param dst * @param dst
* The buffer into which bytes are to be transferred * The buffer into which bytes are to be transferred
* @param timeout * @param timeout
...@@ -461,6 +470,8 @@ public abstract class AsynchronousSocketChannel ...@@ -461,6 +470,8 @@ public abstract class AsynchronousSocketChannel
* read from the channel will cause an unspecific runtime exception to be * read from the channel will cause an unspecific runtime exception to be
* thrown. * thrown.
* *
* @param <A>
* The type of the attachment
* @param dsts * @param dsts
* The buffers into which bytes are to be transferred * The buffers into which bytes are to be transferred
* @param offset * @param offset
...@@ -520,6 +531,8 @@ public abstract class AsynchronousSocketChannel ...@@ -520,6 +531,8 @@ public abstract class AsynchronousSocketChannel
* AsynchronousByteChannel#write(ByteBuffer,Object,CompletionHandler)} * AsynchronousByteChannel#write(ByteBuffer,Object,CompletionHandler)}
* method. * method.
* *
* @param <A>
* The type of the attachment
* @param src * @param src
* The buffer from which bytes are to be retrieved * The buffer from which bytes are to be retrieved
* @param timeout * @param timeout
...@@ -610,6 +623,8 @@ public abstract class AsynchronousSocketChannel ...@@ -610,6 +623,8 @@ public abstract class AsynchronousSocketChannel
* to write to the channel will cause an unspecific runtime exception to be * to write to the channel will cause an unspecific runtime exception to be
* thrown. * thrown.
* *
* @param <A>
* The type of the attachment
* @param srcs * @param srcs
* The buffers from which bytes are to be retrieved * The buffers from which bytes are to be retrieved
* @param offset * @param offset
......
...@@ -57,7 +57,7 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -57,7 +57,7 @@ import java.nio.channels.spi.SelectorProvider;
* setOption} method. A datagram channel to an Internet Protocol socket supports * setOption} method. A datagram channel to an Internet Protocol socket supports
* the following options: * the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -117,6 +117,9 @@ public abstract class DatagramChannel ...@@ -117,6 +117,9 @@ public abstract class DatagramChannel
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this channel
*/ */
protected DatagramChannel(SelectorProvider provider) { protected DatagramChannel(SelectorProvider provider) {
super(provider); super(provider);
......
...@@ -46,7 +46,7 @@ import java.util.Collections; ...@@ -46,7 +46,7 @@ import java.util.Collections;
* of bytes that can be read and written and whose current {@link #size * of bytes that can be read and written and whose current {@link #size
* <i>size</i>} can be queried. The size of the file increases * <i>size</i>} can be queried. The size of the file increases
* when bytes are written beyond its current size; the size of the file * when bytes are written beyond its current size; the size of the file
* decreases when it is {@link #truncate </code><i>truncated</i><code>}. The * decreases when it is {@link #truncate <i>truncated</i>}. The
* file may also have some associated <i>metadata</i> such as access * file may also have some associated <i>metadata</i> such as access
* permissions, content type, and last-modification time; this class does not * permissions, content type, and last-modification time; this class does not
* define methods for metadata access. * define methods for metadata access.
...@@ -830,7 +830,7 @@ public abstract class FileChannel ...@@ -830,7 +830,7 @@ public abstract class FileChannel
* <p> A region of a file may be mapped into memory in one of three modes: * <p> A region of a file may be mapped into memory in one of three modes:
* </p> * </p>
* *
* <ul type=disc> * <ul>
* *
* <li><p> <i>Read-only:</i> Any attempt to modify the resulting buffer * <li><p> <i>Read-only:</i> Any attempt to modify the resulting buffer
* will cause a {@link java.nio.ReadOnlyBufferException} to be thrown. * will cause a {@link java.nio.ReadOnlyBufferException} to be thrown.
......
...@@ -72,7 +72,7 @@ import java.io.IOException; ...@@ -72,7 +72,7 @@ import java.io.IOException;
* <p> File-lock objects are safe for use by multiple concurrent threads. * <p> File-lock objects are safe for use by multiple concurrent threads.
* *
* *
* <a name="pdep"><h4> Platform dependencies </h4></a> * <a name="pdep"></a><h2> Platform dependencies </h2>
* *
* <p> This file-locking API is intended to map directly to the native locking * <p> This file-locking API is intended to map directly to the native locking
* facility of the underlying operating system. Thus the locks held on a file * facility of the underlying operating system. Thus the locks held on a file
...@@ -261,6 +261,11 @@ public abstract class FileLock implements AutoCloseable { ...@@ -261,6 +261,11 @@ public abstract class FileLock implements AutoCloseable {
/** /**
* Tells whether or not this lock overlaps the given lock range. * Tells whether or not this lock overlaps the given lock range.
* *
* @param position
* The starting position of the lock range
* @param size
* The size of the lock range
*
* @return <tt>true</tt> if, and only if, this lock and the given lock * @return <tt>true</tt> if, and only if, this lock and the given lock
* range overlap by at least one byte * range overlap by at least one byte
*/ */
......
...@@ -71,7 +71,7 @@ import java.net.StandardSocketOptions; // javadoc ...@@ -71,7 +71,7 @@ import java.net.StandardSocketOptions; // javadoc
* MembershipKey#drop drop} method drops membership so that datagrams from the * MembershipKey#drop drop} method drops membership so that datagrams from the
* source address can no longer be received. * source address can no longer be received.
* *
* <h4>Platform dependencies</h4> * <h2>Platform dependencies</h2>
* *
* The multicast implementation is intended to map directly to the native * The multicast implementation is intended to map directly to the native
* multicasting facility. Consequently, the following items should be considered * multicasting facility. Consequently, the following items should be considered
......
...@@ -106,6 +106,8 @@ public interface NetworkChannel ...@@ -106,6 +106,8 @@ public interface NetworkChannel
/** /**
* Sets the value of a socket option. * Sets the value of a socket option.
* *
* @param <T>
* The type of the socket option value
* @param name * @param name
* The socket option * The socket option
* @param value * @param value
...@@ -130,6 +132,8 @@ public interface NetworkChannel ...@@ -130,6 +132,8 @@ public interface NetworkChannel
/** /**
* Returns the value of a socket option. * Returns the value of a socket option.
* *
* @param <T>
* The type of the socket option value
* @param name * @param name
* The socket option * The socket option
* *
......
...@@ -33,10 +33,9 @@ import java.nio.channels.spi.*; ...@@ -33,10 +33,9 @@ import java.nio.channels.spi.*;
* A pair of channels that implements a unidirectional pipe. * A pair of channels that implements a unidirectional pipe.
* *
* <p> A pipe consists of a pair of channels: A writable {@link * <p> A pipe consists of a pair of channels: A writable {@link
* Pipe.SinkChannel </code>sink<code>} channel and a readable {@link * Pipe.SinkChannel sink} channel and a readable {@link Pipe.SourceChannel source}
* Pipe.SourceChannel </code>source<code>} channel. Once some bytes are * channel. Once some bytes are written to the sink channel they can be read
* written to the sink channel they can be read from source channel in exactly * from source channel in exactlyAthe order in which they were written.
* the order in which they were written.
* *
* <p> Whether or not a thread writing bytes to a pipe will block until another * <p> Whether or not a thread writing bytes to a pipe will block until another
* thread reads those bytes, or some previously-written bytes, from the pipe is * thread reads those bytes, or some previously-written bytes, from the pipe is
...@@ -63,6 +62,9 @@ public abstract class Pipe { ...@@ -63,6 +62,9 @@ public abstract class Pipe {
{ {
/** /**
* Constructs a new instance of this class. * Constructs a new instance of this class.
*
* @param provider
* The selector provider
*/ */
protected SourceChannel(SelectorProvider provider) { protected SourceChannel(SelectorProvider provider) {
super(provider); super(provider);
...@@ -94,6 +96,9 @@ public abstract class Pipe { ...@@ -94,6 +96,9 @@ public abstract class Pipe {
{ {
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The selector provider
*/ */
protected SinkChannel(SelectorProvider provider) { protected SinkChannel(SelectorProvider provider) {
super(provider); super(provider);
......
...@@ -64,8 +64,8 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -64,8 +64,8 @@ import java.nio.channels.spi.SelectorProvider;
* threads. </p> * threads. </p>
* *
* *
* <a name="bm"> * <a name="bm"></a>
* <h4>Blocking mode</h4> * <h2>Blocking mode</h2>
* *
* A selectable channel is either in <i>blocking</i> mode or in * A selectable channel is either in <i>blocking</i> mode or in
* <i>non-blocking</i> mode. In blocking mode, every I/O operation invoked * <i>non-blocking</i> mode. In blocking mode, every I/O operation invoked
...@@ -142,6 +142,9 @@ public abstract class SelectableChannel ...@@ -142,6 +142,9 @@ public abstract class SelectableChannel
* Retrieves the key representing the channel's registration with the given * Retrieves the key representing the channel's registration with the given
* selector. * selector.
* *
* @param sel
* The selector
*
* @return The key returned when this channel was last registered with the * @return The key returned when this channel was last registered with the
* given selector, or <tt>null</tt> if this channel is not * given selector, or <tt>null</tt> if this channel is not
* currently registered with that selector * currently registered with that selector
......
...@@ -42,7 +42,7 @@ import java.io.IOException; ...@@ -42,7 +42,7 @@ import java.io.IOException;
* next selection operation. The validity of a key may be tested by invoking * next selection operation. The validity of a key may be tested by invoking
* its {@link #isValid isValid} method. * its {@link #isValid isValid} method.
* *
* <a name="opsets"> * <a name="opsets"></a>
* *
* <p> A selection key contains two <i>operation sets</i> represented as * <p> A selection key contains two <i>operation sets</i> represented as
* integer values. Each bit of an operation set denotes a category of * integer values. Each bit of an operation set denotes a category of
......
...@@ -36,13 +36,13 @@ import java.util.Set; ...@@ -36,13 +36,13 @@ import java.util.Set;
* *
* <p> A selector may be created by invoking the {@link #open open} method of * <p> A selector may be created by invoking the {@link #open open} method of
* this class, which will use the system's default {@link * this class, which will use the system's default {@link
* java.nio.channels.spi.SelectorProvider </code>selector provider<code>} to * java.nio.channels.spi.SelectorProvider selector provider} to
* create a new selector. A selector may also be created by invoking the * create a new selector. A selector may also be created by invoking the
* {@link java.nio.channels.spi.SelectorProvider#openSelector openSelector} * {@link java.nio.channels.spi.SelectorProvider#openSelector openSelector}
* method of a custom selector provider. A selector remains open until it is * method of a custom selector provider. A selector remains open until it is
* closed via its {@link #close close} method. * closed via its {@link #close close} method.
* *
* <a name="ks"> * <a name="ks"></a>
* *
* <p> A selectable channel's registration with a selector is represented by a * <p> A selectable channel's registration with a selector is represented by a
* {@link SelectionKey} object. A selector maintains three sets of selection * {@link SelectionKey} object. A selector maintains three sets of selection
...@@ -80,18 +80,18 @@ import java.util.Set; ...@@ -80,18 +80,18 @@ import java.util.Set;
* during the next selection operation, at which time the key will removed from * during the next selection operation, at which time the key will removed from
* all of the selector's key sets. * all of the selector's key sets.
* *
* <a name="sks"><p> Keys are added to the selected-key set by selection * <a name="sks"></a><p> Keys are added to the selected-key set by selection
* operations. A key may be removed directly from the selected-key set by * operations. A key may be removed directly from the selected-key set by
* invoking the set's {@link java.util.Set#remove(java.lang.Object) remove} * invoking the set's {@link java.util.Set#remove(java.lang.Object) remove}
* method or by invoking the {@link java.util.Iterator#remove() remove} method * method or by invoking the {@link java.util.Iterator#remove() remove} method
* of an {@link java.util.Iterator </code>iterator<code>} obtained from the * of an {@link java.util.Iterator iterator} obtained from the
* set. Keys are never removed from the selected-key set in any other way; * set. Keys are never removed from the selected-key set in any other way;
* they are not, in particular, removed as a side effect of selection * they are not, in particular, removed as a side effect of selection
* operations. Keys may not be added directly to the selected-key set. </p> * operations. Keys may not be added directly to the selected-key set. </p>
* *
* *
* <a name="selop"> * <a name="selop"></a>
* <h4>Selection</h4> * <h2>Selection</h2>
* *
* <p> During each selection operation, keys may be added to and removed from a * <p> During each selection operation, keys may be added to and removed from a
* selector's selected-key set and may be removed from its key and * selector's selected-key set and may be removed from its key and
...@@ -111,7 +111,7 @@ import java.util.Set; ...@@ -111,7 +111,7 @@ import java.util.Set;
* operation began. For a channel that is ready for at least one such * operation began. For a channel that is ready for at least one such
* operation, one of the following two actions is performed: </p> * operation, one of the following two actions is performed: </p>
* *
* <ol type=a> * <ol>
* *
* <li><p> If the channel's key is not already in the selected-key set then * <li><p> If the channel's key is not already in the selected-key set then
* it is added to that set and its ready-operation set is modified to * it is added to that set and its ready-operation set is modified to
...@@ -126,7 +126,7 @@ import java.util.Set; ...@@ -126,7 +126,7 @@ import java.util.Set;
* words, the ready set returned by the underlying system is * words, the ready set returned by the underlying system is
* bitwise-disjoined into the key's current ready set. </p></li> * bitwise-disjoined into the key's current ready set. </p></li>
* *
* </ol></li> * </ol>
* *
* If all of the keys in the key set at the start of this step have empty * If all of the keys in the key set at the start of this step have empty
* interest sets then neither the selected-key set nor any of the keys' * interest sets then neither the selected-key set nor any of the keys'
...@@ -142,7 +142,7 @@ import java.util.Set; ...@@ -142,7 +142,7 @@ import java.util.Set;
* difference between the three selection methods. </p> * difference between the three selection methods. </p>
* *
* *
* <h4>Concurrency</h4> * <h2>Concurrency</h2>
* *
* <p> Selectors are themselves safe for use by multiple concurrent threads; * <p> Selectors are themselves safe for use by multiple concurrent threads;
* their key sets, however, are not. * their key sets, however, are not.
...@@ -183,7 +183,7 @@ import java.util.Set; ...@@ -183,7 +183,7 @@ import java.util.Set;
* <p> The {@link #close close} method synchronizes on the selector and all * <p> The {@link #close close} method synchronizes on the selector and all
* three key sets in the same order as in a selection operation. * three key sets in the same order as in a selection operation.
* *
* <a name="ksc"> * <a name="ksc"></a>
* *
* <p> A selector's key and selected-key sets are not, in general, safe for use * <p> A selector's key and selected-key sets are not, in general, safe for use
* by multiple concurrent threads. If such a thread might modify one of these * by multiple concurrent threads. If such a thread might modify one of these
......
...@@ -46,7 +46,7 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -46,7 +46,7 @@ import java.nio.channels.spi.SelectorProvider;
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object) * <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Server-socket channels support the following options: * setOption} method. Server-socket channels support the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -78,6 +78,9 @@ public abstract class ServerSocketChannel ...@@ -78,6 +78,9 @@ public abstract class ServerSocketChannel
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this channel
*/ */
protected ServerSocketChannel(SelectorProvider provider) { protected ServerSocketChannel(SelectorProvider provider) {
super(provider); super(provider);
......
...@@ -66,7 +66,7 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -66,7 +66,7 @@ import java.nio.channels.spi.SelectorProvider;
* <p> Socket options are configured using the {@link #setOption(SocketOption,Object) * <p> Socket options are configured using the {@link #setOption(SocketOption,Object)
* setOption} method. Socket channels support the following options: * setOption} method. Socket channels support the following options:
* <blockquote> * <blockquote>
* <table border> * <table border summary="Socket options">
* <tr> * <tr>
* <th>Option Name</th> * <th>Option Name</th>
* <th>Description</th> * <th>Description</th>
...@@ -120,6 +120,9 @@ public abstract class SocketChannel ...@@ -120,6 +120,9 @@ public abstract class SocketChannel
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this channel
*/ */
protected SocketChannel(SelectorProvider provider) { protected SocketChannel(SelectorProvider provider) {
super(provider); super(provider);
...@@ -153,6 +156,8 @@ public abstract class SocketChannel ...@@ -153,6 +156,8 @@ public abstract class SocketChannel
* @param remote * @param remote
* The remote address to which the new channel is to be connected * The remote address to which the new channel is to be connected
* *
* @return A new, and connected, socket channel
*
* @throws AsynchronousCloseException * @throws AsynchronousCloseException
* If another thread closes this channel * If another thread closes this channel
* while the connect operation is in progress * while the connect operation is in progress
......
...@@ -46,7 +46,7 @@ import sun.nio.ch.Interruptible; ...@@ -46,7 +46,7 @@ import sun.nio.ch.Interruptible;
* before and after, respectively, invoking an I/O operation that might block * before and after, respectively, invoking an I/O operation that might block
* indefinitely. In order to ensure that the {@link #end end} method is always * indefinitely. In order to ensure that the {@link #end end} method is always
* invoked, these methods should be used within a * invoked, these methods should be used within a
* <tt>try</tt>&nbsp;...&nbsp;<tt>finally</tt> block: <a name="be"> * <tt>try</tt>&nbsp;...&nbsp;<tt>finally</tt> block:
* *
* <blockquote><pre> * <blockquote><pre>
* boolean completed = false; * boolean completed = false;
......
...@@ -72,6 +72,9 @@ public abstract class AbstractSelectableChannel ...@@ -72,6 +72,9 @@ public abstract class AbstractSelectableChannel
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this channel
*/ */
protected AbstractSelectableChannel(SelectorProvider provider) { protected AbstractSelectableChannel(SelectorProvider provider) {
this.provider = provider; this.provider = provider;
...@@ -251,6 +254,9 @@ public abstract class AbstractSelectableChannel ...@@ -251,6 +254,9 @@ public abstract class AbstractSelectableChannel
* that is blocked in an I/O operation upon this channel to return * that is blocked in an I/O operation upon this channel to return
* immediately, either by throwing an exception or by returning normally. * immediately, either by throwing an exception or by returning normally.
* </p> * </p>
*
* @throws IOException
* If an I/O error occurs
*/ */
protected abstract void implCloseSelectableChannel() throws IOException; protected abstract void implCloseSelectableChannel() throws IOException;
...@@ -299,6 +305,10 @@ public abstract class AbstractSelectableChannel ...@@ -299,6 +305,10 @@ public abstract class AbstractSelectableChannel
* changing the blocking mode. This method is only invoked if the new mode * changing the blocking mode. This method is only invoked if the new mode
* is different from the current mode. </p> * is different from the current mode. </p>
* *
* @param block If <tt>true</tt> then this channel will be placed in
* blocking mode; if <tt>false</tt> then it will be placed
* non-blocking mode
*
* @throws IOException * @throws IOException
* If an I/O error occurs * If an I/O error occurs
*/ */
......
...@@ -43,7 +43,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -43,7 +43,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* after, respectively, invoking an I/O operation that might block * after, respectively, invoking an I/O operation that might block
* indefinitely. In order to ensure that the {@link #end end} method is always * indefinitely. In order to ensure that the {@link #end end} method is always
* invoked, these methods should be used within a * invoked, these methods should be used within a
* <tt>try</tt>&nbsp;...&nbsp;<tt>finally</tt> block: <a name="be"> * <tt>try</tt>&nbsp;...&nbsp;<tt>finally</tt> block:
* *
* <blockquote><pre> * <blockquote><pre>
* try { * try {
...@@ -77,6 +77,9 @@ public abstract class AbstractSelector ...@@ -77,6 +77,9 @@ public abstract class AbstractSelector
/** /**
* Initializes a new instance of this class. * Initializes a new instance of this class.
*
* @param provider
* The provider that created this selector
*/ */
protected AbstractSelector(SelectorProvider provider) { protected AbstractSelector(SelectorProvider provider) {
this.provider = provider; this.provider = provider;
......
...@@ -174,6 +174,8 @@ public abstract class AsynchronousChannelProvider { ...@@ -174,6 +174,8 @@ public abstract class AsynchronousChannelProvider {
* @param threadFactory * @param threadFactory
* The factory to use when creating new threads * The factory to use when creating new threads
* *
* @return A new asynchronous channel group
*
* @throws IllegalArgumentException * @throws IllegalArgumentException
* If {@code nThreads <= 0} * If {@code nThreads <= 0}
* @throws IOException * @throws IOException
...@@ -193,6 +195,8 @@ public abstract class AsynchronousChannelProvider { ...@@ -193,6 +195,8 @@ public abstract class AsynchronousChannelProvider {
* A value {@code >=0} or a negative value for implementation * A value {@code >=0} or a negative value for implementation
* specific default * specific default
* *
* @return A new asynchronous channel group
*
* @throws IOException * @throws IOException
* If an I/O error occurs * If an I/O error occurs
* *
......
...@@ -183,6 +183,9 @@ public abstract class SelectorProvider { ...@@ -183,6 +183,9 @@ public abstract class SelectorProvider {
* Opens a datagram channel. * Opens a datagram channel.
* *
* @return The new channel * @return The new channel
*
* @throws IOException
* If an I/O error occurs
*/ */
public abstract DatagramChannel openDatagramChannel() public abstract DatagramChannel openDatagramChannel()
throws IOException; throws IOException;
...@@ -209,6 +212,9 @@ public abstract class SelectorProvider { ...@@ -209,6 +212,9 @@ public abstract class SelectorProvider {
* Opens a pipe. * Opens a pipe.
* *
* @return The new pipe * @return The new pipe
*
* @throws IOException
* If an I/O error occurs
*/ */
public abstract Pipe openPipe() public abstract Pipe openPipe()
throws IOException; throws IOException;
...@@ -217,6 +223,9 @@ public abstract class SelectorProvider { ...@@ -217,6 +223,9 @@ public abstract class SelectorProvider {
* Opens a selector. * Opens a selector.
* *
* @return The new selector * @return The new selector
*
* @throws IOException
* If an I/O error occurs
*/ */
public abstract AbstractSelector openSelector() public abstract AbstractSelector openSelector()
throws IOException; throws IOException;
...@@ -225,6 +234,9 @@ public abstract class SelectorProvider { ...@@ -225,6 +234,9 @@ public abstract class SelectorProvider {
* Opens a server-socket channel. * Opens a server-socket channel.
* *
* @return The new channel * @return The new channel
*
* @throws IOException
* If an I/O error occurs
*/ */
public abstract ServerSocketChannel openServerSocketChannel() public abstract ServerSocketChannel openServerSocketChannel()
throws IOException; throws IOException;
...@@ -233,6 +245,9 @@ public abstract class SelectorProvider { ...@@ -233,6 +245,9 @@ public abstract class SelectorProvider {
* Opens a socket channel. * Opens a socket channel.
* *
* @return The new channel * @return The new channel
*
* @throws IOException
* If an I/O error occurs
*/ */
public abstract SocketChannel openSocketChannel() public abstract SocketChannel openSocketChannel()
throws IOException; throws IOException;
......
...@@ -163,6 +163,9 @@ public abstract class Charset$Coder$ { ...@@ -163,6 +163,9 @@ public abstract class Charset$Coder$ {
* Initializes a new $coder$. The new $coder$ will have the given * Initializes a new $coder$. The new $coder$ will have the given
* $otypes-per-itype$ and replacement values. * $otypes-per-itype$ and replacement values.
* *
* @param cs
* The charset that created this $coder$
*
* @param average$ItypesPerOtype$ * @param average$ItypesPerOtype$
* A positive float value indicating the expected number of * A positive float value indicating the expected number of
* $otype$s that will be produced for each input $itype$ * $otype$s that will be produced for each input $itype$
...@@ -209,6 +212,9 @@ public abstract class Charset$Coder$ { ...@@ -209,6 +212,9 @@ public abstract class Charset$Coder$ {
* $otypes-per-itype$ values and its replacement will be the * $otypes-per-itype$ values and its replacement will be the
* $replTypeName$ $defaultReplName$. * $replTypeName$ $defaultReplName$.
* *
* @param cs
* The charset that created this $coder$
*
* @param average$ItypesPerOtype$ * @param average$ItypesPerOtype$
* A positive float value indicating the expected number of * A positive float value indicating the expected number of
* $otype$s that will be produced for each input $itype$ * $otype$s that will be produced for each input $itype$
...@@ -386,6 +392,8 @@ public abstract class Charset$Coder$ { ...@@ -386,6 +392,8 @@ public abstract class Charset$Coder$ {
* <p> The default implementation of this method does nothing. This method * <p> The default implementation of this method does nothing. This method
* should be overridden by $coder$s that require notification of changes to * should be overridden by $coder$s that require notification of changes to
* the malformed-input action. </p> * the malformed-input action. </p>
*
* @param newAction The new action
*/ */
protected void implOnMalformedInput(CodingErrorAction newAction) { } protected void implOnMalformedInput(CodingErrorAction newAction) { }
...@@ -428,6 +436,8 @@ public abstract class Charset$Coder$ { ...@@ -428,6 +436,8 @@ public abstract class Charset$Coder$ {
* <p> The default implementation of this method does nothing. This method * <p> The default implementation of this method does nothing. This method
* should be overridden by $coder$s that require notification of changes to * should be overridden by $coder$s that require notification of changes to
* the unmappable-character action. </p> * the unmappable-character action. </p>
*
* @param newAction The new action
*/ */
protected void implOnUnmappableCharacter(CodingErrorAction newAction) { } protected void implOnUnmappableCharacter(CodingErrorAction newAction) { }
...@@ -925,6 +935,9 @@ public abstract class Charset$Coder$ { ...@@ -925,6 +935,9 @@ public abstract class Charset$Coder$ {
* <p> The default implementation of this method is not very efficient; it * <p> The default implementation of this method is not very efficient; it
* should generally be overridden to improve performance. </p> * should generally be overridden to improve performance. </p>
* *
* @param c
* The given character
*
* @return <tt>true</tt> if, and only if, this encoder can encode * @return <tt>true</tt> if, and only if, this encoder can encode
* the given character * the given character
* *
...@@ -953,6 +966,9 @@ public abstract class Charset$Coder$ { ...@@ -953,6 +966,9 @@ public abstract class Charset$Coder$ {
* <p> The default implementation of this method is not very efficient; it * <p> The default implementation of this method is not very efficient; it
* should generally be overridden to improve performance. </p> * should generally be overridden to improve performance. </p>
* *
* @param cs
* The given character sequence
*
* @return <tt>true</tt> if, and only if, this encoder can encode * @return <tt>true</tt> if, and only if, this encoder can encode
* the given character without throwing any exceptions and without * the given character without throwing any exceptions and without
* performing any replacements * performing any replacements
......
...@@ -66,7 +66,7 @@ import sun.security.action.GetPropertyAction; ...@@ -66,7 +66,7 @@ import sun.security.action.GetPropertyAction;
* *
* *
* <a name="names"><a name="charenc"> * <a name="names"><a name="charenc">
* <h4>Charset names</h4> * <h2>Charset names</h2>
* *
* <p> Charsets are named by strings composed of the following characters: * <p> Charsets are named by strings composed of the following characters:
* *
...@@ -140,7 +140,7 @@ import sun.security.action.GetPropertyAction; ...@@ -140,7 +140,7 @@ import sun.security.action.GetPropertyAction;
* previous canonical name be made into an alias. * previous canonical name be made into an alias.
* *
* *
* <h4>Standard charsets</h4> * <h2>Standard charsets</h2>
* *
* <a name="standard"> * <a name="standard">
* *
...@@ -217,7 +217,7 @@ import sun.security.action.GetPropertyAction; ...@@ -217,7 +217,7 @@ import sun.security.action.GetPropertyAction;
* <p>The {@link StandardCharsets} class defines constants for each of the * <p>The {@link StandardCharsets} class defines constants for each of the
* standard charsets. * standard charsets.
* *
* <h4>Terminology</h4> * <h2>Terminology</h2>
* *
* <p> The name of this class is taken from the terms used in * <p> The name of this class is taken from the terms used in
* <a href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC&nbsp;2278</i></a>. * <a href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC&nbsp;2278</i></a>.
...@@ -737,6 +737,9 @@ public abstract class Charset ...@@ -737,6 +737,9 @@ public abstract class Charset
* it is not necessarily the case that the given charset is not contained * it is not necessarily the case that the given charset is not contained
* in this charset. * in this charset.
* *
* @param cs
* The given charset
*
* @return <tt>true</tt> if the given charset is contained in this charset * @return <tt>true</tt> if the given charset is contained in this charset
*/ */
public abstract boolean contains(Charset cs); public abstract boolean contains(Charset cs);
......
...@@ -227,6 +227,9 @@ public class CoderResult { ...@@ -227,6 +227,9 @@ public class CoderResult {
* Static factory method that returns the unique object describing a * Static factory method that returns the unique object describing a
* malformed-input error of the given length. * malformed-input error of the given length.
* *
* @param length
* The given length
*
* @return The requested coder-result object * @return The requested coder-result object
*/ */
public static CoderResult malformedForLength(int length) { public static CoderResult malformedForLength(int length) {
...@@ -243,6 +246,9 @@ public class CoderResult { ...@@ -243,6 +246,9 @@ public class CoderResult {
* Static factory method that returns the unique result object describing * Static factory method that returns the unique result object describing
* an unmappable-character error of the given length. * an unmappable-character error of the given length.
* *
* @param length
* The given length
*
* @return The requested coder-result object * @return The requested coder-result object
*/ */
public static CoderResult unmappableForLength(int length) { public static CoderResult unmappableForLength(int length) {
......
...@@ -39,8 +39,8 @@ import java.util.Iterator; ...@@ -39,8 +39,8 @@ import java.util.Iterator;
* the usual extension directories. Providers may also be made available by * the usual extension directories. Providers may also be made available by
* adding them to the applet or application class path or by some other * adding them to the applet or application class path or by some other
* platform-specific means. Charset providers are looked up via the current * platform-specific means. Charset providers are looked up via the current
* thread's {@link java.lang.Thread#getContextClassLoader() </code>context * thread's {@link java.lang.Thread#getContextClassLoader() context class
* class loader<code>}. * loader}.
* *
* <p> A charset provider identifies itself with a provider-configuration file * <p> A charset provider identifies itself with a provider-configuration file
* named <tt>java.nio.charset.spi.CharsetProvider</tt> in the resource * named <tt>java.nio.charset.spi.CharsetProvider</tt> in the resource
......
...@@ -173,6 +173,8 @@ public abstract class FileStore { ...@@ -173,6 +173,8 @@ public abstract class FileStore {
* The {@code type} parameter is the type of the attribute view required and * The {@code type} parameter is the type of the attribute view required and
* the method returns an instance of that type if supported. * the method returns an instance of that type if supported.
* *
* @param <V>
* The {@code FileStoreAttributeView} type
* @param type * @param type
* the {@code Class} object corresponding to the attribute view * the {@code Class} object corresponding to the attribute view
* *
......
...@@ -315,7 +315,7 @@ public abstract class FileSystem ...@@ -315,7 +315,7 @@ public abstract class FileSystem
* that resembles regular expressions but with a simpler syntax. For example: * that resembles regular expressions but with a simpler syntax. For example:
* *
* <blockquote> * <blockquote>
* <table border="0"> * <table border="0" summary="Pattern Language">
* <tr> * <tr>
* <td>{@code *.java}</td> * <td>{@code *.java}</td>
* <td>Matches a path that represents a file name ending in {@code .java}</td> * <td>Matches a path that represents a file name ending in {@code .java}</td>
......
...@@ -200,6 +200,10 @@ public final class FileSystems { ...@@ -200,6 +200,10 @@ public final class FileSystems {
* existing file system. In the case of the {@link FileSystems#getDefault * existing file system. In the case of the {@link FileSystems#getDefault
* default} file system, no permission check is required. * default} file system, no permission check is required.
* *
* @param uri the URI to locate the file system
*
* @return the reference to the file system
*
* @throws IllegalArgumentException * @throws IllegalArgumentException
* if the pre-conditions for the {@code uri} parameter are not met * if the pre-conditions for the {@code uri} parameter are not met
* @throws FileSystemNotFoundException * @throws FileSystemNotFoundException
......
...@@ -194,7 +194,7 @@ public final class Files { ...@@ -194,7 +194,7 @@ public final class Files {
* <p> In the addition to {@code READ} and {@code WRITE}, the following * <p> In the addition to {@code READ} and {@code WRITE}, the following
* options may be present: * options may be present:
* *
* <table border=1 cellpadding=5 summary=""> * <table border=1 cellpadding=5 summary="Options">
* <tr> <th>Option</th> <th>Description</th> </tr> * <tr> <th>Option</th> <th>Description</th> </tr>
* <tr> * <tr>
* <td> {@link StandardOpenOption#APPEND APPEND} </td> * <td> {@link StandardOpenOption#APPEND APPEND} </td>
...@@ -1616,7 +1616,8 @@ public final class Files { ...@@ -1616,7 +1616,8 @@ public final class Files {
* } * }
* </pre> * </pre>
* *
* * @param <V>
* The {@code FileAttributeView} type
* @param path * @param path
* the path to the file * the path to the file
* @param type * @param type
...@@ -1665,6 +1666,8 @@ public final class Files { ...@@ -1665,6 +1666,8 @@ public final class Files {
* PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS); * PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS);
* </pre> * </pre>
* *
* @param <A>
* The {@code BasicFileAttributes} type
* @param path * @param path
* the path to the file * the path to the file
* @param type * @param type
...@@ -1863,7 +1866,7 @@ public final class Files { ...@@ -1863,7 +1866,7 @@ public final class Files {
* attributes} parameter: * attributes} parameter:
* *
* <blockquote> * <blockquote>
* <table border="0"> * <table border="0" summary="Possible values">
* <tr> * <tr>
* <td> {@code "*"} </td> * <td> {@code "*"} </td>
* <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td> * <td> Read all {@link BasicFileAttributes basic-file-attributes}. </td>
...@@ -1971,10 +1974,12 @@ public final class Files { ...@@ -1971,10 +1974,12 @@ public final class Files {
* System Interface (POSIX) family of standards. * System Interface (POSIX) family of standards.
* *
* @param path * @param path
* A file reference that locates the file * The path to the file
* @param perms * @param perms
* The new set of permissions * The new set of permissions
* *
* @return The path
*
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
* if the associated file system does not support the {@code * if the associated file system does not support the {@code
* PosixFileAttributeView} * PosixFileAttributeView}
...@@ -2009,7 +2014,7 @@ public final class Files { ...@@ -2009,7 +2014,7 @@ public final class Files {
* access to a file attribute that is the owner of the file. * access to a file attribute that is the owner of the file.
* *
* @param path * @param path
* A file reference that locates the file * The path to the file
* @param options * @param options
* options indicating how symbolic links are handled * options indicating how symbolic links are handled
* *
...@@ -2052,10 +2057,12 @@ public final class Files { ...@@ -2052,10 +2057,12 @@ public final class Files {
* </pre> * </pre>
* *
* @param path * @param path
* A file reference that locates the file * The path to the file
* @param owner * @param owner
* The new file owner * The new file owner
* *
* @return The path
*
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
* if the associated file system does not support the {@code * if the associated file system does not support the {@code
* FileOwnerAttributeView} * FileOwnerAttributeView}
...@@ -2090,6 +2097,8 @@ public final class Files { ...@@ -2090,6 +2097,8 @@ public final class Files {
* readAttributes} method and the file type tested with the {@link * readAttributes} method and the file type tested with the {@link
* BasicFileAttributes#isSymbolicLink} method. * BasicFileAttributes#isSymbolicLink} method.
* *
* @param path The path to the file
*
* @return {@code true} if the file is a symbolic link; {@code false} if * @return {@code true} if the file is a symbolic link; {@code false} if
* the file does not exist, is not a symbolic link, or it cannot * the file does not exist, is not a symbolic link, or it cannot
* be determined if the file is a symbolic link or not. * be determined if the file is a symbolic link or not.
...@@ -2239,7 +2248,7 @@ public final class Files { ...@@ -2239,7 +2248,7 @@ public final class Files {
* @param time * @param time
* the new last modified time * the new last modified time
* *
* @return the file * @return the path
* *
* @throws IOException * @throws IOException
* if an I/O error occurs * if an I/O error occurs
......
...@@ -64,7 +64,7 @@ import java.util.Iterator; ...@@ -64,7 +64,7 @@ import java.util.Iterator;
* those developing custom file system implementations. Methods may be added to * those developing custom file system implementations. Methods may be added to
* this interface in future releases. </p> * this interface in future releases. </p>
* *
* <h4>Accessing Files</h4> * <h2>Accessing Files</h2>
* <p> Paths may be used with the {@link Files} class to operate on files, * <p> Paths may be used with the {@link Files} class to operate on files,
* directories, and other types of files. For example, suppose we want a {@link * directories, and other types of files. For example, suppose we want a {@link
* java.io.BufferedReader} to read text from a file "{@code access.log}". The * java.io.BufferedReader} to read text from a file "{@code access.log}". The
...@@ -75,7 +75,7 @@ import java.util.Iterator; ...@@ -75,7 +75,7 @@ import java.util.Iterator;
* BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8); * BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
* </pre> * </pre>
* *
* <a name="interop"><h4>Interoperability</h4></a> * <a name="interop"></a><h2>Interoperability</h2>
* <p> Paths associated with the default {@link * <p> Paths associated with the default {@link
* java.nio.file.spi.FileSystemProvider provider} are generally interoperable * java.nio.file.spi.FileSystemProvider provider} are generally interoperable
* with the {@link java.io.File java.io.File} class. Paths created by other * with the {@link java.io.File java.io.File} class. Paths created by other
...@@ -87,7 +87,7 @@ import java.util.Iterator; ...@@ -87,7 +87,7 @@ import java.util.Iterator;
* addition, the {@link #toFile toFile} method is useful to construct a {@code * addition, the {@link #toFile toFile} method is useful to construct a {@code
* File} from the {@code String} representation of a {@code Path}. * File} from the {@code String} representation of a {@code Path}.
* *
* <h4>Concurrency</h4> * <h2>Concurrency</h2>
* <p> Implementations of this interface are immutable and safe for use by * <p> Implementations of this interface are immutable and safe for use by
* multiple concurrent threads. * multiple concurrent threads.
* *
......
...@@ -122,6 +122,8 @@ public interface SecureDirectoryStream<T> ...@@ -122,6 +122,8 @@ public interface SecureDirectoryStream<T>
* an optional list of attributes to set atomically when creating * an optional list of attributes to set atomically when creating
* the file * the file
* *
* @return the seekable byte channel
*
* @throws ClosedDirectoryStreamException * @throws ClosedDirectoryStreamException
* if the directory stream is closed * if the directory stream is closed
* @throws IllegalArgumentException * @throws IllegalArgumentException
...@@ -260,6 +262,8 @@ public interface SecureDirectoryStream<T> ...@@ -260,6 +262,8 @@ public interface SecureDirectoryStream<T>
* then all methods to read or update attributes will throw {@link * then all methods to read or update attributes will throw {@link
* ClosedDirectoryStreamException ClosedDirectoryStreamException}. * ClosedDirectoryStreamException ClosedDirectoryStreamException}.
* *
* @param <V>
* The {@code FileAttributeView} type
* @param type * @param type
* the {@code Class} object corresponding to the file attribute view * the {@code Class} object corresponding to the file attribute view
* *
...@@ -288,6 +292,8 @@ public interface SecureDirectoryStream<T> ...@@ -288,6 +292,8 @@ public interface SecureDirectoryStream<T>
* is created but methods to read or update attributes of the file will * is created but methods to read or update attributes of the file will
* fail when invoked and the file does not exist. * fail when invoked and the file does not exist.
* *
* @param <V>
* The {@code FileAttributeView} type
* @param path * @param path
* the path of the file * the path of the file
* @param type * @param type
......
...@@ -55,11 +55,16 @@ public interface WatchEvent<T> { ...@@ -55,11 +55,16 @@ public interface WatchEvent<T> {
public static interface Kind<T> { public static interface Kind<T> {
/** /**
* Returns the name of the event kind. * Returns the name of the event kind.
*
* @return the name of the event kind
*/ */
String name(); String name();
/** /**
* Returns the type of the {@link WatchEvent#context context} value. * Returns the type of the {@link WatchEvent#context context} value.
*
*
* @return the type of the context value
*/ */
Class<T> type(); Class<T> type();
} }
...@@ -76,6 +81,8 @@ public interface WatchEvent<T> { ...@@ -76,6 +81,8 @@ public interface WatchEvent<T> {
public static interface Modifier { public static interface Modifier {
/** /**
* Returns the name of the modifier. * Returns the name of the modifier.
*
* @return the name of the modifier
*/ */
String name(); String name();
} }
......
...@@ -78,7 +78,7 @@ import java.util.concurrent.TimeUnit; ...@@ -78,7 +78,7 @@ import java.util.concurrent.TimeUnit;
* The {@link java.nio.channels.FileChannel FileChannel} class defines methods * The {@link java.nio.channels.FileChannel FileChannel} class defines methods
* to lock regions of a file against access by other programs. * to lock regions of a file against access by other programs.
* *
* <h4>Platform dependencies</h4> * <h2>Platform dependencies</h2>
* *
* <p> The implementation that observes events from the file system is intended * <p> The implementation that observes events from the file system is intended
* to map directly on to the native file event notification facility where * to map directly on to the native file event notification facility where
......
...@@ -134,6 +134,7 @@ public final class AclEntry { ...@@ -134,6 +134,7 @@ public final class AclEntry {
/** /**
* Sets the type component of this builder. * Sets the type component of this builder.
* *
* @param type the component type
* @return this builder * @return this builder
*/ */
public Builder setType(AclEntryType type) { public Builder setType(AclEntryType type) {
...@@ -146,6 +147,7 @@ public final class AclEntry { ...@@ -146,6 +147,7 @@ public final class AclEntry {
/** /**
* Sets the principal component of this builder. * Sets the principal component of this builder.
* *
* @param who the principal component
* @return this builder * @return this builder
*/ */
public Builder setPrincipal(UserPrincipal who) { public Builder setPrincipal(UserPrincipal who) {
...@@ -168,6 +170,7 @@ public final class AclEntry { ...@@ -168,6 +170,7 @@ public final class AclEntry {
* Sets the permissions component of this builder. On return, the * Sets the permissions component of this builder. On return, the
* permissions component of this builder is a copy of the given set. * permissions component of this builder is a copy of the given set.
* *
* @param perms the permissions component
* @return this builder * @return this builder
* *
* @throws ClassCastException * @throws ClassCastException
...@@ -193,6 +196,7 @@ public final class AclEntry { ...@@ -193,6 +196,7 @@ public final class AclEntry {
* permissions component of this builder is a copy of the permissions in * permissions component of this builder is a copy of the permissions in
* the given array. * the given array.
* *
* @param perms the permissions component
* @return this builder * @return this builder
*/ */
public Builder setPermissions(AclEntryPermission... perms) { public Builder setPermissions(AclEntryPermission... perms) {
...@@ -211,6 +215,7 @@ public final class AclEntry { ...@@ -211,6 +215,7 @@ public final class AclEntry {
* Sets the flags component of this builder. On return, the flags * Sets the flags component of this builder. On return, the flags
* component of this builder is a copy of the given set. * component of this builder is a copy of the given set.
* *
* @param flags the flags component
* @return this builder * @return this builder
* *
* @throws ClassCastException * @throws ClassCastException
...@@ -236,6 +241,7 @@ public final class AclEntry { ...@@ -236,6 +241,7 @@ public final class AclEntry {
* component of this builder is a copy of the flags in the given * component of this builder is a copy of the flags in the given
* array. * array.
* *
* @param flags the flags component
* @return this builder * @return this builder
*/ */
public Builder setFlags(AclEntryFlag... flags) { public Builder setFlags(AclEntryFlag... flags) {
...@@ -267,9 +273,7 @@ public final class AclEntry { ...@@ -267,9 +273,7 @@ public final class AclEntry {
/** /**
* Constructs a new builder with the components of an existing ACL entry. * Constructs a new builder with the components of an existing ACL entry.
* *
* @param entry * @param entry an ACL entry
* an ACL entry
*
* @return a new builder * @return a new builder
*/ */
public static Builder newBuilder(AclEntry entry) { public static Builder newBuilder(AclEntry entry) {
...@@ -278,6 +282,8 @@ public final class AclEntry { ...@@ -278,6 +282,8 @@ public final class AclEntry {
/** /**
* Returns the ACL entry type. * Returns the ACL entry type.
*
* @return the ACL entry type
*/ */
public AclEntryType type() { public AclEntryType type() {
return type; return type;
...@@ -285,6 +291,8 @@ public final class AclEntry { ...@@ -285,6 +291,8 @@ public final class AclEntry {
/** /**
* Returns the principal component. * Returns the principal component.
*
* @return the principal component
*/ */
public UserPrincipal principal() { public UserPrincipal principal() {
return who; return who;
...@@ -294,6 +302,8 @@ public final class AclEntry { ...@@ -294,6 +302,8 @@ public final class AclEntry {
* Returns a copy of the permissions component. * Returns a copy of the permissions component.
* *
* <p> The returned set is a modifiable copy of the permissions. * <p> The returned set is a modifiable copy of the permissions.
*
* @return the permissions component
*/ */
public Set<AclEntryPermission> permissions() { public Set<AclEntryPermission> permissions() {
return new HashSet<AclEntryPermission>(perms); return new HashSet<AclEntryPermission>(perms);
...@@ -303,6 +313,8 @@ public final class AclEntry { ...@@ -303,6 +313,8 @@ public final class AclEntry {
* Returns a copy of the flags component. * Returns a copy of the flags component.
* *
* <p> The returned set is a modifiable copy of the flags. * <p> The returned set is a modifiable copy of the flags.
*
* @return the flags component
*/ */
public Set<AclEntryFlag> flags() { public Set<AclEntryFlag> flags() {
return new HashSet<AclEntryFlag>(flags); return new HashSet<AclEntryFlag>(flags);
......
...@@ -54,7 +54,7 @@ import java.io.IOException; ...@@ -54,7 +54,7 @@ import java.io.IOException;
* supportsFileAttributeView} method can be used to test if a file system * supportsFileAttributeView} method can be used to test if a file system
* supports ACLs. * supports ACLs.
* *
* <a name="interop"><h4>Interoperability</h4></a> * <h2>Interoperability</h2>
* *
* RFC&nbsp;3530 allows for special user identities to be used on platforms that * RFC&nbsp;3530 allows for special user identities to be used on platforms that
* support the POSIX defined access permissions. The special user identities * support the POSIX defined access permissions. The special user identities
...@@ -65,7 +65,7 @@ import java.io.IOException; ...@@ -65,7 +65,7 @@ import java.io.IOException;
* UserPrincipalLookupService} may be used to obtain a {@link UserPrincipal} * UserPrincipalLookupService} may be used to obtain a {@link UserPrincipal}
* to represent these special identities by invoking the {@link * to represent these special identities by invoking the {@link
* UserPrincipalLookupService#lookupPrincipalByName lookupPrincipalByName} * UserPrincipalLookupService#lookupPrincipalByName lookupPrincipalByName}
* method. </p> * method.
* *
* <p> <b>Usage Example:</b> * <p> <b>Usage Example:</b>
* Suppose we wish to add an entry to an existing ACL to grant "joe" access: * Suppose we wish to add an entry to an existing ACL to grant "joe" access:
...@@ -90,11 +90,11 @@ import java.io.IOException; ...@@ -90,11 +90,11 @@ import java.io.IOException;
* view.setAcl(acl); * view.setAcl(acl);
* </pre> * </pre>
* *
* <h4> Dynamic Access </h4> * <h2> Dynamic Access </h2>
* <p> Where dynamic access to file attributes is required, the attributes * <p> Where dynamic access to file attributes is required, the attributes
* supported by this attribute view are as follows: * supported by this attribute view are as follows:
* <blockquote> * <blockquote>
* <table border="1" cellpadding="8"> * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr> * <tr>
* <th> Name </th> * <th> Name </th>
* <th> Type </th> * <th> Type </th>
...@@ -118,7 +118,7 @@ import java.io.IOException; ...@@ -118,7 +118,7 @@ import java.io.IOException;
* update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl} * update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl}
* or {@link #setOwner setOwner} methods. * or {@link #setOwner setOwner} methods.
* *
* <h4> Setting the ACL when creating a file </h4> * <h2> Setting the ACL when creating a file </h2>
* *
* <p> Implementations supporting this attribute view may also support setting * <p> Implementations supporting this attribute view may also support setting
* the initial ACL when creating a file or directory. The initial ACL * the initial ACL when creating a file or directory. The initial ACL
......
...@@ -38,6 +38,8 @@ package java.nio.file.attribute; ...@@ -38,6 +38,8 @@ package java.nio.file.attribute;
public interface AttributeView { public interface AttributeView {
/** /**
* Returns the name of the attribute view. * Returns the name of the attribute view.
*
* @return the name of the attribute view
*/ */
String name(); String name();
} }
...@@ -41,7 +41,7 @@ import java.io.IOException; ...@@ -41,7 +41,7 @@ import java.io.IOException;
* <p> Where dynamic access to file attributes is required, the attributes * <p> Where dynamic access to file attributes is required, the attributes
* supported by this attribute view have the following names and types: * supported by this attribute view have the following names and types:
* <blockquote> * <blockquote>
* <table border="1" cellpadding="8"> * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr> * <tr>
* <th> Name </th> * <th> Name </th>
* <th> Type </th> * <th> Type </th>
......
...@@ -87,22 +87,31 @@ public interface BasicFileAttributes { ...@@ -87,22 +87,31 @@ public interface BasicFileAttributes {
/** /**
* Tells whether the file is a regular file with opaque content. * Tells whether the file is a regular file with opaque content.
*
* @return {@code true} if the file is a regular file with opaque content
*/ */
boolean isRegularFile(); boolean isRegularFile();
/** /**
* Tells whether the file is a directory. * Tells whether the file is a directory.
*
* @return {@code true} if the file is a directory
*/ */
boolean isDirectory(); boolean isDirectory();
/** /**
* Tells whether the file is a symbolic link. * Tells whether the file is a symbolic link.
*
* @return {@code true} if the file is a symbolic link
*/ */
boolean isSymbolicLink(); boolean isSymbolicLink();
/** /**
* Tells whether the file is something other than a regular file, directory, * Tells whether the file is something other than a regular file, directory,
* or symbolic link. * or symbolic link.
*
* @return {@code true} if the file something other than a regular file,
* directory or symbolic link
*/ */
boolean isOther(); boolean isOther();
...@@ -138,6 +147,8 @@ public interface BasicFileAttributes { ...@@ -138,6 +147,8 @@ public interface BasicFileAttributes {
* and two files are the {@link java.nio.file.Files#isSameFile same} with * and two files are the {@link java.nio.file.Files#isSameFile same} with
* non-{@code null} file keys, then their file keys are equal. * non-{@code null} file keys, then their file keys are equal.
* *
* @return an object that uniquely identifies the given file, or {@code null}
*
* @see java.nio.file.Files#walkFileTree * @see java.nio.file.Files#walkFileTree
*/ */
Object fileKey(); Object fileKey();
......
...@@ -41,7 +41,7 @@ import java.io.IOException; ...@@ -41,7 +41,7 @@ import java.io.IOException;
* BasicFileAttributeView}, and in addition, the following attributes are * BasicFileAttributeView}, and in addition, the following attributes are
* supported: * supported:
* <blockquote> * <blockquote>
* <table border="1" cellpadding="8"> * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr> * <tr>
* <th> Name </th> * <th> Name </th>
* <th> Type </th> * <th> Type </th>
......
...@@ -40,11 +40,15 @@ package java.nio.file.attribute; ...@@ -40,11 +40,15 @@ package java.nio.file.attribute;
public interface FileAttribute<T> { public interface FileAttribute<T> {
/** /**
* Returns the attribute name. * Returns the attribute name.
*
* @return The attribute name
*/ */
String name(); String name();
/** /**
* Returns the attribute value. * Returns the attribute value.
*
* @return The attribute value
*/ */
T value(); T value();
} }
...@@ -68,13 +68,13 @@ import java.io.IOException; ...@@ -68,13 +68,13 @@ import java.io.IOException;
* PosixFilePermissions.toString(attrs.permissions())); * PosixFilePermissions.toString(attrs.permissions()));
* </pre> * </pre>
* *
* <h4> Dynamic Access </h4> * <h2> Dynamic Access </h2>
* <p> Where dynamic access to file attributes is required, the attributes * <p> Where dynamic access to file attributes is required, the attributes
* supported by this attribute view are as defined by {@link * supported by this attribute view are as defined by {@link
* BasicFileAttributeView} and {@link FileOwnerAttributeView}, and in addition, * BasicFileAttributeView} and {@link FileOwnerAttributeView}, and in addition,
* the following attributes are supported: * the following attributes are supported:
* <blockquote> * <blockquote>
* <table border="1" cellpadding="8"> * <table border="1" cellpadding="8" summary="Supported attributes">
* <tr> * <tr>
* <th> Name </th> * <th> Name </th>
* <th> Type </th> * <th> Type </th>
...@@ -102,7 +102,7 @@ import java.io.IOException; ...@@ -102,7 +102,7 @@ import java.io.IOException;
* #setPermissions setPermissions}, {@link #setOwner setOwner}, and {@link * #setPermissions setPermissions}, {@link #setOwner setOwner}, and {@link
* #setGroup setGroup} methods respectively. * #setGroup setGroup} methods respectively.
* *
* <h4> Setting Initial Permissions </h4> * <h2> Setting Initial Permissions </h2>
* <p> Implementations supporting this attribute view may also support setting * <p> Implementations supporting this attribute view may also support setting
* the initial permissions when creating a file or directory. The * the initial permissions when creating a file or directory. The
* initial permissions are provided to the {@link Files#createFile createFile} * initial permissions are provided to the {@link Files#createFile createFile}
......
...@@ -287,6 +287,8 @@ public abstract class FileSystemProvider { ...@@ -287,6 +287,8 @@ public abstract class FileSystemProvider {
* @param uri * @param uri
* The URI to convert * The URI to convert
* *
* @return The resulting {@code Path}
*
* @throws IllegalArgumentException * @throws IllegalArgumentException
* If the URI scheme does not identify this provider or other * If the URI scheme does not identify this provider or other
* preconditions on the uri parameter do not hold * preconditions on the uri parameter do not hold
...@@ -751,6 +753,8 @@ public abstract class FileSystemProvider { ...@@ -751,6 +753,8 @@ public abstract class FileSystemProvider {
* @param link * @param link
* the path to the symbolic link * the path to the symbolic link
* *
* @return The target of the symbolic link
*
* @throws UnsupportedOperationException * @throws UnsupportedOperationException
* if the implementation does not support symbolic links * if the implementation does not support symbolic links
* @throws NotLinkException * @throws NotLinkException
...@@ -984,6 +988,8 @@ public abstract class FileSystemProvider { ...@@ -984,6 +988,8 @@ public abstract class FileSystemProvider {
* exactly the manner specified by the {@link Files#getFileAttributeView} * exactly the manner specified by the {@link Files#getFileAttributeView}
* method. * method.
* *
* @param <V>
* The {@code FileAttributeView} type
* @param path * @param path
* the path to the file * the path to the file
* @param type * @param type
...@@ -1002,6 +1008,8 @@ public abstract class FileSystemProvider { ...@@ -1002,6 +1008,8 @@ public abstract class FileSystemProvider {
* exactly the manner specified by the {@link * exactly the manner specified by the {@link
* Files#readAttributes(Path,Class,LinkOption[])} method. * Files#readAttributes(Path,Class,LinkOption[])} method.
* *
* @param <A>
* The {@code BasicFileAttributes} type
* @param path * @param path
* the path to the file * the path to the file
* @param type * @param type
......
/* /*
* 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
...@@ -424,7 +424,7 @@ public class RMIClassLoader { ...@@ -424,7 +424,7 @@ public class RMIClassLoader {
* *
* <ul> * <ul>
* *
* <p><li>If the class loader is the system class loader (see * <li><p>If the class loader is the system class loader (see
* {@link ClassLoader#getSystemClassLoader}), a parent of the * {@link ClassLoader#getSystemClassLoader}), a parent of the
* system class loader such as the loader used for installed * system class loader such as the loader used for installed
* extensions, or the bootstrap class loader (which may be * extensions, or the bootstrap class loader (which may be
...@@ -433,7 +433,7 @@ public class RMIClassLoader { ...@@ -433,7 +433,7 @@ public class RMIClassLoader {
* earlier cached value) is returned, or * earlier cached value) is returned, or
* <code>null</code> is returned if that property is not set. * <code>null</code> is returned if that property is not set.
* *
* <p><li>Otherwise, if the class loader is an instance of * <li><p>Otherwise, if the class loader is an instance of
* <code>URLClassLoader</code>, then the returned string is a * <code>URLClassLoader</code>, then the returned string is a
* space-separated list of the external forms of the URLs returned * space-separated list of the external forms of the URLs returned
* by invoking the <code>getURLs</code> methods of the loader. If * by invoking the <code>getURLs</code> methods of the loader. If
...@@ -452,7 +452,7 @@ public class RMIClassLoader { ...@@ -452,7 +452,7 @@ public class RMIClassLoader {
* property (or possibly an earlier cached value) is returned, or * property (or possibly an earlier cached value) is returned, or
* <code>null</code> is returned if that property is not set. * <code>null</code> is returned if that property is not set.
* *
* <p><li>Finally, if the class loader is not an instance of * <li><p>Finally, if the class loader is not an instance of
* <code>URLClassLoader</code>, then the value of the * <code>URLClassLoader</code>, then the value of the
* <code>java.rmi.server.codebase</code> property (or possibly an * <code>java.rmi.server.codebase</code> property (or possibly an
* earlier cached value) is returned, or * earlier cached value) is returned, or
......
...@@ -36,10 +36,10 @@ import sun.security.util.SecurityConstants; ...@@ -36,10 +36,10 @@ import sun.security.util.SecurityConstants;
* based on the context it encapsulates. * based on the context it encapsulates.
* *
* <p>More specifically, it encapsulates a context and * <p>More specifically, it encapsulates a context and
* has a single method, <code>checkPermission</code>, * has a single method, {@code checkPermission},
* that is equivalent to the <code>checkPermission</code> method * that is equivalent to the {@code checkPermission} method
* in the AccessController class, with one difference: The AccessControlContext * in the AccessController class, with one difference: The AccessControlContext
* <code>checkPermission</code> method makes access decisions based on the * {@code checkPermission} method makes access decisions based on the
* context it encapsulates, * context it encapsulates,
* rather than that of the current execution thread. * rather than that of the current execution thread.
* *
...@@ -49,8 +49,8 @@ import sun.security.util.SecurityConstants; ...@@ -49,8 +49,8 @@ import sun.security.util.SecurityConstants;
* <i>different</i> context (for example, from within a worker thread). * <i>different</i> context (for example, from within a worker thread).
* *
* <p> An AccessControlContext is created by calling the * <p> An AccessControlContext is created by calling the
* <code>AccessController.getContext</code> method. * {@code AccessController.getContext} method.
* The <code>getContext</code> method takes a "snapshot" * The {@code getContext} method takes a "snapshot"
* of the current calling context, and places * of the current calling context, and places
* it in an AccessControlContext object, which it returns. A sample call is * it in an AccessControlContext object, which it returns. A sample call is
* the following: * the following:
...@@ -61,7 +61,7 @@ import sun.security.util.SecurityConstants; ...@@ -61,7 +61,7 @@ import sun.security.util.SecurityConstants;
* *
* <p> * <p>
* Code within a different context can subsequently call the * Code within a different context can subsequently call the
* <code>checkPermission</code> method on the * {@code checkPermission} method on the
* previously-saved AccessControlContext object. A sample call is the * previously-saved AccessControlContext object. A sample call is the
* following: * following:
* *
...@@ -121,7 +121,7 @@ public final class AccessControlContext { ...@@ -121,7 +121,7 @@ public final class AccessControlContext {
* @param context the ProtectionDomains associated with this context. * @param context the ProtectionDomains associated with this context.
* The non-duplicate domains are copied from the array. Subsequent * The non-duplicate domains are copied from the array. Subsequent
* changes to the array will not affect this AccessControlContext. * changes to the array will not affect this AccessControlContext.
* @throws NullPointerException if <code>context</code> is <code>null</code> * @throws NullPointerException if {@code context} is {@code null}
*/ */
public AccessControlContext(ProtectionDomain context[]) public AccessControlContext(ProtectionDomain context[])
{ {
...@@ -147,22 +147,22 @@ public final class AccessControlContext { ...@@ -147,22 +147,22 @@ public final class AccessControlContext {
} }
/** /**
* Create a new <code>AccessControlContext</code> with the given * Create a new {@code AccessControlContext} with the given
* <code>AccessControlContext</code> and <code>DomainCombiner</code>. * {@code AccessControlContext} and {@code DomainCombiner}.
* This constructor associates the provided * This constructor associates the provided
* <code>DomainCombiner</code> with the provided * {@code DomainCombiner} with the provided
* <code>AccessControlContext</code>. * {@code AccessControlContext}.
* *
* <p> * <p>
* *
* @param acc the <code>AccessControlContext</code> associated * @param acc the {@code AccessControlContext} associated
* with the provided <code>DomainCombiner</code>. * with the provided {@code DomainCombiner}.
* *
* @param combiner the <code>DomainCombiner</code> to be associated * @param combiner the {@code DomainCombiner} to be associated
* with the provided <code>AccessControlContext</code>. * with the provided {@code AccessControlContext}.
* *
* @exception NullPointerException if the provided * @exception NullPointerException if the provided
* <code>context</code> is <code>null</code>. * {@code context} is {@code null}.
* *
* @exception SecurityException if a security manager is installed and the * @exception SecurityException if a security manager is installed and the
* caller does not have the "createAccessControlContext" * caller does not have the "createAccessControlContext"
...@@ -320,13 +320,13 @@ public final class AccessControlContext { ...@@ -320,13 +320,13 @@ public final class AccessControlContext {
} }
/** /**
* Get the <code>DomainCombiner</code> associated with this * Get the {@code DomainCombiner} associated with this
* <code>AccessControlContext</code>. * {@code AccessControlContext}.
* *
* <p> * <p>
* *
* @return the <code>DomainCombiner</code> associated with this * @return the {@code DomainCombiner} associated with this
* <code>AccessControlContext</code>, or <code>null</code> * {@code AccessControlContext}, or {@code null}
* if there is none. * if there is none.
* *
* @exception SecurityException if a security manager is installed and * @exception SecurityException if a security manager is installed and
......
/* /*
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
...@@ -48,7 +48,7 @@ public class AccessControlException extends SecurityException { ...@@ -48,7 +48,7 @@ public class AccessControlException extends SecurityException {
private Permission perm; private Permission perm;
/** /**
* Constructs an <code>AccessControlException</code> with the * Constructs an {@code AccessControlException} with the
* specified, detailed message. * specified, detailed message.
* *
* @param s the detail message. * @param s the detail message.
...@@ -58,7 +58,7 @@ public class AccessControlException extends SecurityException { ...@@ -58,7 +58,7 @@ public class AccessControlException extends SecurityException {
} }
/** /**
* Constructs an <code>AccessControlException</code> with the * Constructs an {@code AccessControlException} with the
* specified, detailed message, and the requested permission that caused * specified, detailed message, and the requested permission that caused
* the exception. * the exception.
* *
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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,10 +28,10 @@ package java.security; ...@@ -28,10 +28,10 @@ package java.security;
import java.security.spec.AlgorithmParameterSpec; import java.security.spec.AlgorithmParameterSpec;
/** /**
* The <code>AlgorithmParameterGenerator</code> class is used to generate a * The {@code AlgorithmParameterGenerator} class is used to generate a
* set of * set of
* parameters to be used with a certain algorithm. Parameter generators * parameters to be used with a certain algorithm. Parameter generators
* are constructed using the <code>getInstance</code> factory methods * are constructed using the {@code getInstance} factory methods
* (static methods that return instances of a given class). * (static methods that return instances of a given class).
* *
* <P>The object that will generate the parameters can be initialized * <P>The object that will generate the parameters can be initialized
...@@ -61,17 +61,17 @@ import java.security.spec.AlgorithmParameterSpec; ...@@ -61,17 +61,17 @@ import java.security.spec.AlgorithmParameterSpec;
* *
* <P>In case the client does not explicitly initialize the * <P>In case the client does not explicitly initialize the
* AlgorithmParameterGenerator * AlgorithmParameterGenerator
* (via a call to an <code>init</code> method), each provider must supply (and * (via a call to an {@code init} method), each provider must supply (and
* document) a default initialization. For example, the Sun provider uses a * document) a default initialization. For example, the Sun provider uses a
* default modulus prime size of 1024 bits for the generation of DSA * default modulus prime size of 1024 bits for the generation of DSA
* parameters. * parameters.
* *
* <p> Every implementation of the Java platform is required to support the * <p> Every implementation of the Java platform is required to support the
* following standard <code>AlgorithmParameterGenerator</code> algorithms and * following standard {@code AlgorithmParameterGenerator} algorithms and
* keysizes in parentheses: * keysizes in parentheses:
* <ul> * <ul>
* <li><tt>DiffieHellman</tt> (1024)</li> * <li>{@code DiffieHellman} (1024)</li>
* <li><tt>DSA</tt> (1024)</li> * <li>{@code DSA} (1024)</li>
* </ul> * </ul>
* These algorithms are described in the <a href= * These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator"> * "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator">
...@@ -272,11 +272,11 @@ public class AlgorithmParameterGenerator { ...@@ -272,11 +272,11 @@ public class AlgorithmParameterGenerator {
/** /**
* Initializes this parameter generator for a certain size. * Initializes this parameter generator for a certain size.
* To create the parameters, the <code>SecureRandom</code> * To create the parameters, the {@code SecureRandom}
* implementation of the highest-priority installed provider is used as * implementation of the highest-priority installed provider is used as
* the source of randomness. * the source of randomness.
* (If none of the installed providers supply an implementation of * (If none of the installed providers supply an implementation of
* <code>SecureRandom</code>, a system-provided source of randomness is * {@code SecureRandom}, a system-provided source of randomness is
* used.) * used.)
* *
* @param size the size (number of bits). * @param size the size (number of bits).
...@@ -299,11 +299,11 @@ public class AlgorithmParameterGenerator { ...@@ -299,11 +299,11 @@ public class AlgorithmParameterGenerator {
/** /**
* Initializes this parameter generator with a set of algorithm-specific * Initializes this parameter generator with a set of algorithm-specific
* parameter generation values. * parameter generation values.
* To generate the parameters, the <code>SecureRandom</code> * To generate the parameters, the {@code SecureRandom}
* implementation of the highest-priority installed provider is used as * implementation of the highest-priority installed provider is used as
* the source of randomness. * the source of randomness.
* (If none of the installed providers supply an implementation of * (If none of the installed providers supply an implementation of
* <code>SecureRandom</code>, a system-provided source of randomness is * {@code SecureRandom}, a system-provided source of randomness is
* used.) * used.)
* *
* @param genParamSpec the set of algorithm-specific parameter generation values. * @param genParamSpec the set of algorithm-specific parameter generation values.
......
/* /*
* Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
...@@ -29,7 +29,7 @@ import java.security.spec.AlgorithmParameterSpec; ...@@ -29,7 +29,7 @@ import java.security.spec.AlgorithmParameterSpec;
/** /**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
* for the <code>AlgorithmParameterGenerator</code> class, which * for the {@code AlgorithmParameterGenerator} class, which
* is used to generate a set of parameters to be used with a certain algorithm. * is used to generate a set of parameters to be used with a certain algorithm.
* *
* <p> All the abstract methods in this class must be implemented by each * <p> All the abstract methods in this class must be implemented by each
...@@ -37,7 +37,7 @@ import java.security.spec.AlgorithmParameterSpec; ...@@ -37,7 +37,7 @@ import java.security.spec.AlgorithmParameterSpec;
* of a parameter generator for a particular algorithm. * of a parameter generator for a particular algorithm.
* *
* <p> In case the client does not explicitly initialize the * <p> In case the client does not explicitly initialize the
* AlgorithmParameterGenerator (via a call to an <code>engineInit</code> * AlgorithmParameterGenerator (via a call to an {@code engineInit}
* method), each provider must supply (and document) a default initialization. * method), each provider must supply (and document) a default initialization.
* For example, the Sun provider uses a default modulus prime size of 1024 * For example, the Sun provider uses a default modulus prime size of 1024
* bits for the generation of DSA parameters. * bits for the generation of DSA parameters.
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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,28 +32,28 @@ import java.security.spec.InvalidParameterSpecException; ...@@ -32,28 +32,28 @@ import java.security.spec.InvalidParameterSpecException;
/** /**
* This class is used as an opaque representation of cryptographic parameters. * This class is used as an opaque representation of cryptographic parameters.
* *
* <p>An <code>AlgorithmParameters</code> object for managing the parameters * <p>An {@code AlgorithmParameters} object for managing the parameters
* for a particular algorithm can be obtained by * for a particular algorithm can be obtained by
* calling one of the <code>getInstance</code> factory methods * calling one of the {@code getInstance} factory methods
* (static methods that return instances of a given class). * (static methods that return instances of a given class).
* *
* <p>Once an <code>AlgorithmParameters</code> object is obtained, it must be * <p>Once an {@code AlgorithmParameters} object is obtained, it must be
* initialized via a call to <code>init</code>, using an appropriate parameter * initialized via a call to {@code init}, using an appropriate parameter
* specification or parameter encoding. * specification or parameter encoding.
* *
* <p>A transparent parameter specification is obtained from an * <p>A transparent parameter specification is obtained from an
* <code>AlgorithmParameters</code> object via a call to * {@code AlgorithmParameters} object via a call to
* <code>getParameterSpec</code>, and a byte encoding of the parameters is * {@code getParameterSpec}, and a byte encoding of the parameters is
* obtained via a call to <code>getEncoded</code>. * obtained via a call to {@code getEncoded}.
* *
* <p> Every implementation of the Java platform is required to support the * <p> Every implementation of the Java platform is required to support the
* following standard <code>AlgorithmParameters</code> algorithms: * following standard {@code AlgorithmParameters} algorithms:
* <ul> * <ul>
* <li><tt>AES</tt></li> * <li>{@code AES}</li>
* <li><tt>DES</tt></li> * <li>{@code DES}</li>
* <li><tt>DESede</tt></li> * <li>{@code DESede}</li>
* <li><tt>DiffieHellman</tt></li> * <li>{@code DiffieHellman}</li>
* <li><tt>DSA</tt></li> * <li>{@code DSA}</li>
* </ul> * </ul>
* These algorithms are described in the <a href= * These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameters"> * "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameters">
...@@ -123,7 +123,7 @@ public class AlgorithmParameters { ...@@ -123,7 +123,7 @@ public class AlgorithmParameters {
* the {@link Security#getProviders() Security.getProviders()} method. * the {@link Security#getProviders() Security.getProviders()} method.
* *
* <p> The returned parameter object must be initialized via a call to * <p> The returned parameter object must be initialized via a call to
* <code>init</code>, using an appropriate parameter specification or * {@code init}, using an appropriate parameter specification or
* parameter encoding. * parameter encoding.
* *
* @param algorithm the name of the algorithm requested. * @param algorithm the name of the algorithm requested.
...@@ -165,7 +165,7 @@ public class AlgorithmParameters { ...@@ -165,7 +165,7 @@ public class AlgorithmParameters {
* the {@link Security#getProviders() Security.getProviders()} method. * the {@link Security#getProviders() Security.getProviders()} method.
* *
* <p>The returned parameter object must be initialized via a call to * <p>The returned parameter object must be initialized via a call to
* <code>init</code>, using an appropriate parameter specification or * {@code init}, using an appropriate parameter specification or
* parameter encoding. * parameter encoding.
* *
* @param algorithm the name of the algorithm requested. * @param algorithm the name of the algorithm requested.
...@@ -212,7 +212,7 @@ public class AlgorithmParameters { ...@@ -212,7 +212,7 @@ public class AlgorithmParameters {
* does not have to be registered in the provider list. * does not have to be registered in the provider list.
* *
* <p>The returned parameter object must be initialized via a call to * <p>The returned parameter object must be initialized via a call to
* <code>init</code>, using an appropriate parameter specification or * {@code init}, using an appropriate parameter specification or
* parameter encoding. * parameter encoding.
* *
* @param algorithm the name of the algorithm requested. * @param algorithm the name of the algorithm requested.
...@@ -259,7 +259,7 @@ public class AlgorithmParameters { ...@@ -259,7 +259,7 @@ public class AlgorithmParameters {
/** /**
* Initializes this parameter object using the parameters * Initializes this parameter object using the parameters
* specified in <code>paramSpec</code>. * specified in {@code paramSpec}.
* *
* @param paramSpec the parameter specification. * @param paramSpec the parameter specification.
* *
...@@ -295,9 +295,9 @@ public class AlgorithmParameters { ...@@ -295,9 +295,9 @@ public class AlgorithmParameters {
} }
/** /**
* Imports the parameters from <code>params</code> and decodes them * Imports the parameters from {@code params} and decodes them
* according to the specified decoding scheme. * according to the specified decoding scheme.
* If <code>format</code> is null, the * If {@code format} is null, the
* primary decoding format for parameters is used. The primary decoding * primary decoding format for parameters is used. The primary decoding
* format is ASN.1, if an ASN.1 specification for these parameters * format is ASN.1, if an ASN.1 specification for these parameters
* exists. * exists.
...@@ -318,11 +318,11 @@ public class AlgorithmParameters { ...@@ -318,11 +318,11 @@ public class AlgorithmParameters {
/** /**
* Returns a (transparent) specification of this parameter object. * Returns a (transparent) specification of this parameter object.
* <code>paramSpec</code> identifies the specification class in which * {@code paramSpec} identifies the specification class in which
* the parameters should be returned. It could, for example, be * the parameters should be returned. It could, for example, be
* <code>DSAParameterSpec.class</code>, to indicate that the * {@code DSAParameterSpec.class}, to indicate that the
* parameters should be returned in an instance of the * parameters should be returned in an instance of the
* <code>DSAParameterSpec</code> class. * {@code DSAParameterSpec} class.
* *
* @param paramSpec the specification class in which * @param paramSpec the specification class in which
* the parameters should be returned. * the parameters should be returned.
...@@ -363,7 +363,7 @@ public class AlgorithmParameters { ...@@ -363,7 +363,7 @@ public class AlgorithmParameters {
/** /**
* Returns the parameters encoded in the specified scheme. * Returns the parameters encoded in the specified scheme.
* If <code>format</code> is null, the * If {@code format} is null, the
* primary encoding format for parameters is used. The primary encoding * primary encoding format for parameters is used. The primary encoding
* format is ASN.1, if an ASN.1 specification for these parameters * format is ASN.1, if an ASN.1 specification for these parameters
* exists. * exists.
......
/* /*
* Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
...@@ -31,7 +31,7 @@ import java.security.spec.InvalidParameterSpecException; ...@@ -31,7 +31,7 @@ import java.security.spec.InvalidParameterSpecException;
/** /**
* This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
* for the <code>AlgorithmParameters</code> class, which is used to manage * for the {@code AlgorithmParameters} class, which is used to manage
* algorithm parameters. * algorithm parameters.
* *
* <p> All the abstract methods in this class must be implemented by each * <p> All the abstract methods in this class must be implemented by each
...@@ -52,7 +52,7 @@ public abstract class AlgorithmParametersSpi { ...@@ -52,7 +52,7 @@ public abstract class AlgorithmParametersSpi {
/** /**
* Initializes this parameters object using the parameters * Initializes this parameters object using the parameters
* specified in <code>paramSpec</code>. * specified in {@code paramSpec}.
* *
* @param paramSpec the parameter specification. * @param paramSpec the parameter specification.
* *
...@@ -77,9 +77,9 @@ public abstract class AlgorithmParametersSpi { ...@@ -77,9 +77,9 @@ public abstract class AlgorithmParametersSpi {
throws IOException; throws IOException;
/** /**
* Imports the parameters from <code>params</code> and * Imports the parameters from {@code params} and
* decodes them according to the specified decoding format. * decodes them according to the specified decoding format.
* If <code>format</code> is null, the * If {@code format} is null, the
* primary decoding format for parameters is used. The primary decoding * primary decoding format for parameters is used. The primary decoding
* format is ASN.1, if an ASN.1 specification for these parameters * format is ASN.1, if an ASN.1 specification for these parameters
* exists. * exists.
...@@ -96,11 +96,11 @@ public abstract class AlgorithmParametersSpi { ...@@ -96,11 +96,11 @@ public abstract class AlgorithmParametersSpi {
/** /**
* Returns a (transparent) specification of this parameters * Returns a (transparent) specification of this parameters
* object. * object.
* <code>paramSpec</code> identifies the specification class in which * {@code paramSpec} identifies the specification class in which
* the parameters should be returned. It could, for example, be * the parameters should be returned. It could, for example, be
* <code>DSAParameterSpec.class</code>, to indicate that the * {@code DSAParameterSpec.class}, to indicate that the
* parameters should be returned in an instance of the * parameters should be returned in an instance of the
* <code>DSAParameterSpec</code> class. * {@code DSAParameterSpec} class.
* *
* @param paramSpec the specification class in which * @param paramSpec the specification class in which
* the parameters should be returned. * the parameters should be returned.
...@@ -128,7 +128,7 @@ public abstract class AlgorithmParametersSpi { ...@@ -128,7 +128,7 @@ public abstract class AlgorithmParametersSpi {
/** /**
* Returns the parameters encoded in the specified format. * Returns the parameters encoded in the specified format.
* If <code>format</code> is null, the * If {@code format} is null, the
* primary encoding format for parameters is used. The primary encoding * primary encoding format for parameters is used. The primary encoding
* format is ASN.1, if an ASN.1 specification for these parameters * format is ASN.1, if an ASN.1 specification for these parameters
* exists. * exists.
......
/* /*
* Copyright (c) 1998, 2012, 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
...@@ -69,7 +69,7 @@ public final class AllPermission extends Permission { ...@@ -69,7 +69,7 @@ public final class AllPermission extends Permission {
/** /**
* Creates a new AllPermission object. This * Creates a new AllPermission object. This
* constructor exists for use by the <code>Policy</code> object * constructor exists for use by the {@code Policy} object
* to instantiate new Permission objects. * to instantiate new Permission objects.
* *
* @param name ignored * @param name ignored
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册