8186052: Fix a11y and HTML issues in the java.base/java.lang[.*] packages

Reviewed-by: smarks
This commit is contained in:
Jonathan Gibbons 2017-08-10 15:23:03 -07:00
parent 330008fbf2
commit c79d52b103
12 changed files with 186 additions and 162 deletions

View file

@ -9566,18 +9566,23 @@ class Character implements java.io.Serializable, Comparable<Character> {
* Determines if the specified character is ISO-LATIN-1 white space. * Determines if the specified character is ISO-LATIN-1 white space.
* This method returns {@code true} for the following five * This method returns {@code true} for the following five
* characters only: * characters only:
* <table class="borderless"> * <table class="striped">
* <caption style="display:none">truechars</caption> * <caption style="display:none">truechars</caption>
* <thead>
* <tr><th scope="col">Character
* <th scope="col">Code
* <th scope="col">Name
* </thead>
* <tbody> * <tbody>
* <tr><td>{@code '\t'}</td> <td>{@code U+0009}</td> * <tr><th scope="row">{@code '\t'}</th> <td>{@code U+0009}</td>
* <td>{@code HORIZONTAL TABULATION}</td></tr> * <td>{@code HORIZONTAL TABULATION}</td></tr>
* <tr><td>{@code '\n'}</td> <td>{@code U+000A}</td> * <tr><th scope="row">{@code '\n'}</th> <td>{@code U+000A}</td>
* <td>{@code NEW LINE}</td></tr> * <td>{@code NEW LINE}</td></tr>
* <tr><td>{@code '\f'}</td> <td>{@code U+000C}</td> * <tr><th scope="row">{@code '\f'}</th> <td>{@code U+000C}</td>
* <td>{@code FORM FEED}</td></tr> * <td>{@code FORM FEED}</td></tr>
* <tr><td>{@code '\r'}</td> <td>{@code U+000D}</td> * <tr><th scope="row">{@code '\r'}</th> <td>{@code U+000D}</td>
* <td>{@code CARRIAGE RETURN}</td></tr> * <td>{@code CARRIAGE RETURN}</td></tr>
* <tr><td>{@code ' '}</td> <td>{@code U+0020}</td> * <tr><th scope="row">{@code ' '}</th> <td>{@code U+0020}</td>
* <td>{@code SPACE}</td></tr> * <td>{@code SPACE}</td></tr>
* </tbody> * </tbody>
* </table> * </table>

View file

@ -728,22 +728,22 @@ public final class Class<T> implements java.io.Serializable,
* one or more '{@code [}' characters representing the depth of the array * one or more '{@code [}' characters representing the depth of the array
* nesting. The encoding of element type names is as follows: * nesting. The encoding of element type names is as follows:
* *
* <blockquote><table class="borderless"> * <blockquote><table class="striped">
* <caption style="display:none">Element types and encodings</caption> * <caption style="display:none">Element types and encodings</caption>
* <thead> * <thead>
* <tr><th style="padding-right:3em;"> Element Type <th> Encoding * <tr><th scope="col"> Element Type <th scope="col"> Encoding
* </thead> * </thead>
* <tbody> * <tbody style="text-align:left">
* <tr><td> boolean <td style="text-align:center"> Z * <tr><th scope="row"> boolean <td style="text-align:center"> Z
* <tr><td> byte <td style="text-align:center"> B * <tr><th scope="row"> byte <td style="text-align:center"> B
* <tr><td> char <td style="text-align:center"> C * <tr><th scope="row"> char <td style="text-align:center"> C
* <tr><td> class or interface * <tr><th scope="row"> class or interface
* <td style="text-align:center"> L<i>classname</i>; * <td style="text-align:center"> L<i>classname</i>;
* <tr><td> double <td style="text-align:center"> D * <tr><th scope="row"> double <td style="text-align:center"> D
* <tr><td> float <td style="text-align:center"> F * <tr><th scope="row"> float <td style="text-align:center"> F
* <tr><td> int <td style="text-align:center"> I * <tr><th scope="row"> int <td style="text-align:center"> I
* <tr><td> long <td style="text-align:center"> J * <tr><th scope="row"> long <td style="text-align:center"> J
* <tr><td> short <td style="text-align:center"> S * <tr><th scope="row"> short <td style="text-align:center"> S
* </tbody> * </tbody>
* </table></blockquote> * </table></blockquote>
* *

View file

@ -255,25 +255,25 @@ public final class Double extends Number implements Comparable<Double> {
* *
* </ul> * </ul>
* *
* <table class="plain"> * <table class="striped">
* <caption>Examples</caption> * <caption>Examples</caption>
* <thead> * <thead>
* <tr><th>Floating-point Value</th><th>Hexadecimal String</th> * <tr><th scope="col">Floating-point Value</th><th scope="col">Hexadecimal String</th>
* </thead> * </thead>
* <tbody> * <tbody style="text-align:right">
* <tr><td>{@code 1.0}</td> <td>{@code 0x1.0p0}</td> * <tr><th scope="row">{@code 1.0}</th> <td>{@code 0x1.0p0}</td>
* <tr><td>{@code -1.0}</td> <td>{@code -0x1.0p0}</td> * <tr><th scope="row">{@code -1.0}</th> <td>{@code -0x1.0p0}</td>
* <tr><td>{@code 2.0}</td> <td>{@code 0x1.0p1}</td> * <tr><th scope="row">{@code 2.0}</th> <td>{@code 0x1.0p1}</td>
* <tr><td>{@code 3.0}</td> <td>{@code 0x1.8p1}</td> * <tr><th scope="row">{@code 3.0}</th> <td>{@code 0x1.8p1}</td>
* <tr><td>{@code 0.5}</td> <td>{@code 0x1.0p-1}</td> * <tr><th scope="row">{@code 0.5}</th> <td>{@code 0x1.0p-1}</td>
* <tr><td>{@code 0.25}</td> <td>{@code 0x1.0p-2}</td> * <tr><th scope="row">{@code 0.25}</th> <td>{@code 0x1.0p-2}</td>
* <tr><td>{@code Double.MAX_VALUE}</td> * <tr><th scope="row">{@code Double.MAX_VALUE}</th>
* <td>{@code 0x1.fffffffffffffp1023}</td> * <td>{@code 0x1.fffffffffffffp1023}</td>
* <tr><td>{@code Minimum Normal Value}</td> * <tr><th scope="row">{@code Minimum Normal Value}</th>
* <td>{@code 0x1.0p-1022}</td> * <td>{@code 0x1.0p-1022}</td>
* <tr><td>{@code Maximum Subnormal Value}</td> * <tr><th scope="row">{@code Maximum Subnormal Value}</th>
* <td>{@code 0x0.fffffffffffffp-1022}</td> * <td>{@code 0x0.fffffffffffffp-1022}</td>
* <tr><td>{@code Double.MIN_VALUE}</td> * <tr><th scope="row">{@code Double.MIN_VALUE}</th>
* <td>{@code 0x0.0000000000001p-1022}</td> * <td>{@code 0x0.0000000000001p-1022}</td>
* </tbody> * </tbody>
* </table> * </table>

View file

@ -256,25 +256,25 @@ public final class Float extends Number implements Comparable<Float> {
* *
* </ul> * </ul>
* *
* <table class="plain"> * <table class="striped">
* <caption>Examples</caption> * <caption>Examples</caption>
* <thead> * <thead>
* <tr><th>Floating-point Value</th><th>Hexadecimal String</th> * <tr><th scope="col">Floating-point Value</th><th scope="col">Hexadecimal String</th>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr><td>{@code 1.0}</td> <td>{@code 0x1.0p0}</td> * <tr><th scope="row">{@code 1.0}</th> <td>{@code 0x1.0p0}</td>
* <tr><td>{@code -1.0}</td> <td>{@code -0x1.0p0}</td> * <tr><th scope="row">{@code -1.0}</th> <td>{@code -0x1.0p0}</td>
* <tr><td>{@code 2.0}</td> <td>{@code 0x1.0p1}</td> * <tr><th scope="row">{@code 2.0}</th> <td>{@code 0x1.0p1}</td>
* <tr><td>{@code 3.0}</td> <td>{@code 0x1.8p1}</td> * <tr><th scope="row">{@code 3.0}</th> <td>{@code 0x1.8p1}</td>
* <tr><td>{@code 0.5}</td> <td>{@code 0x1.0p-1}</td> * <tr><th scope="row">{@code 0.5}</th> <td>{@code 0x1.0p-1}</td>
* <tr><td>{@code 0.25}</td> <td>{@code 0x1.0p-2}</td> * <tr><th scope="row">{@code 0.25}</th> <td>{@code 0x1.0p-2}</td>
* <tr><td>{@code Float.MAX_VALUE}</td> * <tr><th scope="row">{@code Float.MAX_VALUE}</th>
* <td>{@code 0x1.fffffep127}</td> * <td>{@code 0x1.fffffep127}</td>
* <tr><td>{@code Minimum Normal Value}</td> * <tr><th scope="row">{@code Minimum Normal Value}</th>
* <td>{@code 0x1.0p-126}</td> * <td>{@code 0x1.0p-126}</td>
* <tr><td>{@code Maximum Subnormal Value}</td> * <tr><th scope="row">{@code Maximum Subnormal Value}</th>
* <td>{@code 0x0.fffffep-126}</td> * <td>{@code 0x0.fffffep-126}</td>
* <tr><td>{@code Float.MIN_VALUE}</td> * <tr><th scope="row">{@code Float.MIN_VALUE}</th>
* <td>{@code 0x0.000002p-126}</td> * <td>{@code 0x0.000002p-126}</td>
* </tbody> * </tbody>
* </table> * </table>

View file

@ -2208,29 +2208,29 @@ public final class String
* <caption style="display:none">Split example showing regex, limit, and result</caption> * <caption style="display:none">Split example showing regex, limit, and result</caption>
* <thead> * <thead>
* <tr> * <tr>
* <th>Regex</th> * <th scope="col">Regex</th>
* <th>Limit</th> * <th scope="col">Limit</th>
* <th>Result</th> * <th scope="col">Result</th>
* </tr> * </tr>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr><td style="text-align:center">:</td> * <tr><th scope="row" rowspan="3" style="font-weight:normal">:</th>
* <td style="text-align:center">2</td> * <th scope="row" style="font-weight:normal; text-align:right; padding-right:1em">2</th>
* <td>{@code { "boo", "and:foo" }}</td></tr> * <td>{@code { "boo", "and:foo" }}</td></tr>
* <tr><td style="text-align:center">:</td> * <tr><!-- : -->
* <td style="text-align:center">5</td> * <th scope="row" style="font-weight:normal; text-align:right; padding-right:1em">5</th>
* <td>{@code { "boo", "and", "foo" }}</td></tr> * <td>{@code { "boo", "and", "foo" }}</td></tr>
* <tr><td style="text-align:center">:</td> * <tr><!-- : -->
* <td style="text-align:center">-2</td> * <th scope="row" style="font-weight:normal; text-align:right; padding-right:1em">-2</th>
* <td>{@code { "boo", "and", "foo" }}</td></tr> * <td>{@code { "boo", "and", "foo" }}</td></tr>
* <tr><td style="text-align:center">o</td> * <tr><th scope="row" rowspan="3" style="font-weight:normal">o</th>
* <td style="text-align:center">5</td> * <th scope="row" style="font-weight:normal; text-align:right; padding-right:1em">5</th>
* <td>{@code { "b", "", ":and:f", "", "" }}</td></tr> * <td>{@code { "b", "", ":and:f", "", "" }}</td></tr>
* <tr><td style="text-align:center">o</td> * <tr><!-- o -->
* <td style="text-align:center">-2</td> * <th scope="row" style="font-weight:normal; text-align:right; padding-right:1em">-2</th>
* <td>{@code { "b", "", ":and:f", "", "" }}</td></tr> * <td>{@code { "b", "", ":and:f", "", "" }}</td></tr>
* <tr><td style="text-align:center">o</td> * <tr><!-- o -->
* <td style="text-align:center">0</td> * <th scope="row" style="font-weight:normal; text-align:right; padding-right:1em">0</th>
* <td>{@code { "b", "", ":and:f" }}</td></tr> * <td>{@code { "b", "", ":and:f" }}</td></tr>
* </tbody> * </tbody>
* </table></blockquote> * </table></blockquote>
@ -2336,14 +2336,14 @@ public final class String
* <caption style="display:none">Split examples showing regex and result</caption> * <caption style="display:none">Split examples showing regex and result</caption>
* <thead> * <thead>
* <tr> * <tr>
* <th>Regex</th> * <th scope="col">Regex</th>
* <th>Result</th> * <th scope="col">Result</th>
* </tr> * </tr>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr><td style="text-align:center">:</td> * <tr><th scope="row" style="text-weight:normal">:</th>
* <td>{@code { "boo", "and", "foo" }}</td></tr> * <td>{@code { "boo", "and", "foo" }}</td></tr>
* <tr><td style="text-align:center">o</td> * <tr><th scope="row" style="text-weight:normal">o</th>
* <td>{@code { "b", "", ":and:f" }}</td></tr> * <td>{@code { "b", "", ":and:f" }}</td></tr>
* </tbody> * </tbody>
* </table></blockquote> * </table></blockquote>
@ -2460,36 +2460,37 @@ public final class String
* <caption style="display:none">Lowercase mapping examples showing language code of locale, upper case, lower case, and description</caption> * <caption style="display:none">Lowercase mapping examples showing language code of locale, upper case, lower case, and description</caption>
* <thead> * <thead>
* <tr> * <tr>
* <th>Language Code of Locale</th> * <th scope="col">Language Code of Locale</th>
* <th>Upper Case</th> * <th scope="col">Upper Case</th>
* <th>Lower Case</th> * <th scope="col">Lower Case</th>
* <th>Description</th> * <th scope="col">Description</th>
* </tr> * </tr>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr> * <tr>
* <td>tr (Turkish)</td> * <td>tr (Turkish)</td>
* <td>&#92;u0130</td> * <th scope="row" style="font-weight:normal; text-align:left">&#92;u0130</th>
* <td>&#92;u0069</td> * <td>&#92;u0069</td>
* <td>capital letter I with dot above -&gt; small letter i</td> * <td>capital letter I with dot above -&gt; small letter i</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>tr (Turkish)</td> * <td>tr (Turkish)</td>
* <td>&#92;u0049</td> * <th scope="row" style="font-weight:normal; text-align:left">&#92;u0049</th>
* <td>&#92;u0131</td> * <td>&#92;u0131</td>
* <td>capital letter I -&gt; small letter dotless i </td> * <td>capital letter I -&gt; small letter dotless i </td>
* </tr> * </tr>
* <tr> * <tr>
* <td>(all)</td> * <td>(all)</td>
* <td>French Fries</td> * <th scope="row" style="font-weight:normal; text-align:left">French Fries</th>
* <td>french fries</td> * <td>french fries</td>
* <td>lowercased all chars in String</td> * <td>lowercased all chars in String</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>(all)</td> * <td>(all)</td>
* <td><img src="doc-files/capiota.gif" alt="capiota"><img src="doc-files/capchi.gif" alt="capchi"> * <th scope="row" style="font-weight:normal; text-align:left">
* <img src="doc-files/capiota.gif" alt="capiota"><img src="doc-files/capchi.gif" alt="capchi">
* <img src="doc-files/captheta.gif" alt="captheta"><img src="doc-files/capupsil.gif" alt="capupsil"> * <img src="doc-files/captheta.gif" alt="captheta"><img src="doc-files/capupsil.gif" alt="capupsil">
* <img src="doc-files/capsigma.gif" alt="capsigma"></td> * <img src="doc-files/capsigma.gif" alt="capsigma"></th>
* <td><img src="doc-files/iota.gif" alt="iota"><img src="doc-files/chi.gif" alt="chi"> * <td><img src="doc-files/iota.gif" alt="iota"><img src="doc-files/chi.gif" alt="chi">
* <img src="doc-files/theta.gif" alt="theta"><img src="doc-files/upsilon.gif" alt="upsilon"> * <img src="doc-files/theta.gif" alt="theta"><img src="doc-files/upsilon.gif" alt="upsilon">
* <img src="doc-files/sigma1.gif" alt="sigma"></td> * <img src="doc-files/sigma1.gif" alt="sigma"></td>
@ -2546,34 +2547,34 @@ public final class String
* <caption style="display:none">Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.</caption> * <caption style="display:none">Examples of locale-sensitive and 1:M case mappings. Shows Language code of locale, lower case, upper case, and description.</caption>
* <thead> * <thead>
* <tr> * <tr>
* <th>Language Code of Locale</th> * <th scope="col">Language Code of Locale</th>
* <th>Lower Case</th> * <th scope="col">Lower Case</th>
* <th>Upper Case</th> * <th scope="col">Upper Case</th>
* <th>Description</th> * <th scope="col">Description</th>
* </tr> * </tr>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr> * <tr>
* <td>tr (Turkish)</td> * <td>tr (Turkish)</td>
* <td>&#92;u0069</td> * <th scope="row" style="font-weight:normal; text-align:left">&#92;u0069</th>
* <td>&#92;u0130</td> * <td>&#92;u0130</td>
* <td>small letter i -&gt; capital letter I with dot above</td> * <td>small letter i -&gt; capital letter I with dot above</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>tr (Turkish)</td> * <td>tr (Turkish)</td>
* <td>&#92;u0131</td> * <th scope="row" style="font-weight:normal; text-align:left">&#92;u0131</th>
* <td>&#92;u0049</td> * <td>&#92;u0049</td>
* <td>small letter dotless i -&gt; capital letter I</td> * <td>small letter dotless i -&gt; capital letter I</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>(all)</td> * <td>(all)</td>
* <td>&#92;u00df</td> * <th scope="row" style="font-weight:normal; text-align:left">&#92;u00df</th>
* <td>&#92;u0053 &#92;u0053</td> * <td>&#92;u0053 &#92;u0053</td>
* <td>small letter sharp s -&gt; two letters: SS</td> * <td>small letter sharp s -&gt; two letters: SS</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>(all)</td> * <td>(all)</td>
* <td>Fahrvergn&uuml;gen</td> * <th scope="row" style="font-weight:normal; text-align:left">Fahrvergn&uuml;gen</th>
* <td>FAHRVERGN&Uuml;GEN</td> * <td>FAHRVERGN&Uuml;GEN</td>
* <td></td> * <td></td>
* </tr> * </tr>

View file

@ -583,7 +583,7 @@ public final class System {
* system properties, a set of system properties is first created and * system properties, a set of system properties is first created and
* initialized. This set of system properties always includes values * initialized. This set of system properties always includes values
* for the following keys: * for the following keys:
* <table class="striped"> * <table class="striped" style="text-align:left">
* <caption style="display:none">Shows property keys and associated values</caption> * <caption style="display:none">Shows property keys and associated values</caption>
* <thead> * <thead>
* <tr><th scope="col">Key</th> * <tr><th scope="col">Key</th>
@ -1049,26 +1049,28 @@ public final class System {
* of corresponding severity. * of corresponding severity.
* <br>The mapping is as follows: * <br>The mapping is as follows:
* <br><br> * <br><br>
* <table border="1"> * <table class="striped">
* <caption>System.Logger Severity Level Mapping</caption> * <caption>System.Logger Severity Level Mapping</caption>
* <tr><td><b>System.Logger Levels</b></td> * <thead>
* <td>{@link Logger.Level#ALL ALL}</td> * <tr><th scope="col">System.Logger Levels</th>
* <td>{@link Logger.Level#TRACE TRACE}</td> * <th scope="col">java.util.logging Levels</th>
* <td>{@link Logger.Level#DEBUG DEBUG}</td> * </thead>
* <td>{@link Logger.Level#INFO INFO}</td> * <tbody>
* <td>{@link Logger.Level#WARNING WARNING}</td> * <tr><th scope="row">{@link Logger.Level#ALL ALL}</th>
* <td>{@link Logger.Level#ERROR ERROR}</td> * <td>{@link java.util.logging.Level#ALL ALL}</td>
* <td>{@link Logger.Level#OFF OFF}</td> * <tr><th scope="row">{@link Logger.Level#TRACE TRACE}</th>
* </tr> * <td>{@link java.util.logging.Level#FINER FINER}</td>
* <tr><td><b>java.util.logging Levels</b></td> * <tr><th scope="row">{@link Logger.Level#DEBUG DEBUG}</th>
* <td>{@link java.util.logging.Level#ALL ALL}</td> * <td>{@link java.util.logging.Level#FINE FINE}</td>
* <td>{@link java.util.logging.Level#FINER FINER}</td> * <tr><th scope="row">{@link Logger.Level#INFO INFO}</th>
* <td>{@link java.util.logging.Level#FINE FINE}</td> * <td>{@link java.util.logging.Level#INFO INFO}</td>
* <td>{@link java.util.logging.Level#INFO INFO}</td> * <tr><th scope="row">{@link Logger.Level#WARNING WARNING}</th>
* <td>{@link java.util.logging.Level#WARNING WARNING}</td> * <td>{@link java.util.logging.Level#WARNING WARNING}</td>
* <td>{@link java.util.logging.Level#SEVERE SEVERE}</td> * <tr><th scope="row">{@link Logger.Level#ERROR ERROR}</th>
* <td>{@link java.util.logging.Level#OFF OFF}</td> * <td>{@link java.util.logging.Level#SEVERE SEVERE}</td>
* </tr> * <tr><th scope="row">{@link Logger.Level#OFF OFF}</th>
* <td>{@link java.util.logging.Level#OFF OFF}</td>
* </tbody>
* </table> * </table>
* *
* @since 9 * @since 9

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2017, 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
@ -347,7 +347,7 @@ class Thread implements Runnable {
* the calling thread indicates to the runtime that it is busy-waiting. * the calling thread indicates to the runtime that it is busy-waiting.
* The runtime may take action to improve the performance of invoking * The runtime may take action to improve the performance of invoking
* spin-wait loop constructions. * spin-wait loop constructions.
* <p> *
* @apiNote * @apiNote
* As an example consider a method in a class that spins in a loop until * As an example consider a method in a class that spins in a loop until
* some flag is set outside of that method. A call to the {@code onSpinWait} * some flag is set outside of that method. A call to the {@code onSpinWait}
@ -373,7 +373,7 @@ class Thread implements Runnable {
* method was not called at all. However on some architectures the Java * method was not called at all. However on some architectures the Java
* Virtual Machine may issue the processor instructions to address such * Virtual Machine may issue the processor instructions to address such
* code patterns in a more beneficial way. * code patterns in a more beneficial way.
* <p> *
* @since 9 * @since 9
*/ */
@HotSpotIntrinsicCandidate @HotSpotIntrinsicCandidate

View file

@ -149,24 +149,24 @@ import java.util.Arrays;
* capture argument (corresponding to the receiver) must be non-null. * capture argument (corresponding to the receiver) must be non-null.
* *
* <p>A type Q is considered adaptable to S as follows: * <p>A type Q is considered adaptable to S as follows:
* <table class="borderless"> * <table class="striped">
* <caption style="display:none">adaptable types</caption> * <caption style="display:none">adaptable types</caption>
* <thead> * <thead>
* <tr><th>Q</th><th>S</th><th>Link-time checks</th><th>Invocation-time checks</th></tr> * <tr><th scope="col">Q</th><th scope="col">S</th><th scope="col">Link-time checks</th><th scope="col">Invocation-time checks</th></tr>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr> * <tr>
* <td>Primitive</td><td>Primitive</td> * <th scope="row">Primitive</th><th scope="row">Primitive</th>
* <td>Q can be converted to S via a primitive widening conversion</td> * <td>Q can be converted to S via a primitive widening conversion</td>
* <td>None</td> * <td>None</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>Primitive</td><td>Reference</td> * <th scope="row">Primitive</th><th scope="row">Reference</th>
* <td>S is a supertype of the Wrapper(Q)</td> * <td>S is a supertype of the Wrapper(Q)</td>
* <td>Cast from Wrapper(Q) to S</td> * <td>Cast from Wrapper(Q) to S</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>Reference</td><td>Primitive</td> * <th scope="row">Reference</th><th scope="row">Primitive</th>
* <td>for parameter types: Q is a primitive wrapper and Primitive(Q) * <td>for parameter types: Q is a primitive wrapper and Primitive(Q)
* can be widened to S * can be widened to S
* <br>for return types: If Q is a primitive wrapper, check that * <br>for return types: If Q is a primitive wrapper, check that
@ -175,7 +175,7 @@ import java.util.Arrays;
* for example Number for numeric types</td> * for example Number for numeric types</td>
* </tr> * </tr>
* <tr> * <tr>
* <td>Reference</td><td>Reference</td> * <th scope="row">Reference</th><th scope="row">Reference</th>
* <td>for parameter types: S is a supertype of Q * <td>for parameter types: S is a supertype of Q
* <br>for return types: none</td> * <br>for return types: none</td>
* <td>Cast from Q to S</td> * <td>Cast from Q to S</td>

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2017, 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
@ -889,7 +889,7 @@ assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray
* <p> * <p>
* This method behaves very much like {@link #asSpreader(Class, int)}, but accepts an additional {@code spreadArgPos} * This method behaves very much like {@link #asSpreader(Class, int)}, but accepts an additional {@code spreadArgPos}
* argument to indicate at which position in the parameter list the spreading should take place. * argument to indicate at which position in the parameter list the spreading should take place.
* <p> *
* @apiNote Example: * @apiNote Example:
* <blockquote><pre>{@code * <blockquote><pre>{@code
MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class)); MethodHandle compare = LOOKUP.findStatic(Objects.class, "compare", methodType(int.class, Object.class, Object.class, Comparator.class));
@ -1094,7 +1094,7 @@ assertEquals("[123]", (String) longsToString.invokeExact((long)123));
* This method behaves very much like {@link #asCollector(Class, int)}, but differs in that its {@code * This method behaves very much like {@link #asCollector(Class, int)}, but differs in that its {@code
* collectArgPos} argument indicates at which position in the parameter list arguments should be collected. This * collectArgPos} argument indicates at which position in the parameter list arguments should be collected. This
* index is zero-based. * index is zero-based.
* <p> *
* @apiNote Examples: * @apiNote Examples:
* <blockquote><pre>{@code * <blockquote><pre>{@code
StringWriter swr = new StringWriter(); StringWriter swr = new StringWriter();

View file

@ -3353,7 +3353,7 @@ assert((int)twice.invokeExact(21) == 42);
* That is, it returns a zero primitive value, a {@code null}, or {@code void}. * That is, it returns a zero primitive value, a {@code null}, or {@code void}.
* <p>The returned method handle is equivalent to * <p>The returned method handle is equivalent to
* {@code dropArguments(zero(type.returnType()), 0, type.parameterList())}. * {@code dropArguments(zero(type.returnType()), 0, type.parameterList())}.
* <p> *
* @apiNote Given a predicate and target, a useful "if-then" construct can be produced as * @apiNote Given a predicate and target, a useful "if-then" construct can be produced as
* {@code guardWithTest(pred, target, empty(target.type())}. * {@code guardWithTest(pred, target, empty(target.type())}.
* @param type the type of the desired method handle * @param type the type of the desired method handle
@ -3676,7 +3676,7 @@ assertEquals("xz", (String) d12.invokeExact("x", 12, true, "z"));
* Given these assumptions, the result of an invocation of {@code dropArgumentsToMatch} will have the parameter type * Given these assumptions, the result of an invocation of {@code dropArgumentsToMatch} will have the parameter type
* list {@code S..., P..., M..., A...}, with the {@code P} and {@code A} types inserted as if by * list {@code S..., P..., M..., A...}, with the {@code P} and {@code A} types inserted as if by
* {@link #dropArguments(MethodHandle, int, Class[])}. * {@link #dropArguments(MethodHandle, int, Class[])}.
* <p> *
* @apiNote * @apiNote
* Two method handles whose argument lists are "effectively identical" (i.e., identical in a common prefix) may be * Two method handles whose argument lists are "effectively identical" (i.e., identical in a common prefix) may be
* mutually converted to a common type by two calls to {@code dropArgumentsToMatch}, as follows: * mutually converted to a common type by two calls to {@code dropArgumentsToMatch}, as follows:
@ -4169,7 +4169,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* position in the parameter list at which folding takes place. The argument controlling this, {@code pos}, is a * position in the parameter list at which folding takes place. The argument controlling this, {@code pos}, is a
* zero-based index. The aforementioned method {@link #foldArguments(MethodHandle, MethodHandle)} assumes position * zero-based index. The aforementioned method {@link #foldArguments(MethodHandle, MethodHandle)} assumes position
* 0. * 0.
* <p> *
* @apiNote Example: * @apiNote Example:
* <blockquote><pre>{@code * <blockquote><pre>{@code
import static java.lang.invoke.MethodHandles.*; import static java.lang.invoke.MethodHandles.*;
@ -4698,7 +4698,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* Note that the parameter type lists {@code (V...)} and {@code (A...)} have been expanded * Note that the parameter type lists {@code (V...)} and {@code (A...)} have been expanded
* to their full length, even though individual clause functions may neglect to take them all. * to their full length, even though individual clause functions may neglect to take them all.
* As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch}. * As noted above, missing parameters are filled in as if by {@link #dropArgumentsToMatch}.
* <p> *
* @apiNote Example: * @apiNote Example:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* // iterative implementation of the factorial function as a loop handle * // iterative implementation of the factorial function as a loop handle
@ -4991,7 +4991,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* return v; * return v;
* } * }
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example: * @apiNote Example:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* // implement the zip function for lists as a loop handle * // implement the zip function for lists as a loop handle
@ -5010,7 +5010,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* assertEquals(zipped, (List<String>) loop.invoke(a.iterator(), b.iterator())); * assertEquals(zipped, (List<String>) loop.invoke(a.iterator(), b.iterator()));
* }</pre></blockquote> * }</pre></blockquote>
* *
* <p> *
* @apiNote The implementation of this method can be expressed as follows: * @apiNote The implementation of this method can be expressed as follows:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* MethodHandle whileLoop(MethodHandle init, MethodHandle pred, MethodHandle body) { * MethodHandle whileLoop(MethodHandle init, MethodHandle pred, MethodHandle body) {
@ -5104,7 +5104,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* return v; * return v;
* } * }
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example: * @apiNote Example:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* // int i = 0; while (i < limit) { ++i; } return i; => limit * // int i = 0; while (i < limit) { ++i; } return i; => limit
@ -5116,7 +5116,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* assertEquals(23, loop.invoke(23)); * assertEquals(23, loop.invoke(23));
* }</pre></blockquote> * }</pre></blockquote>
* *
* <p> *
* @apiNote The implementation of this method can be expressed as follows: * @apiNote The implementation of this method can be expressed as follows:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* MethodHandle doWhileLoop(MethodHandle init, MethodHandle body, MethodHandle pred) { * MethodHandle doWhileLoop(MethodHandle init, MethodHandle body, MethodHandle pred) {
@ -5248,7 +5248,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* return v; * return v;
* } * }
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example with a fully conformant body method: * @apiNote Example with a fully conformant body method:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s; * // String s = "Lambdaman!"; for (int i = 0; i < 13; ++i) { s = "na " + s; } return s;
@ -5260,7 +5260,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* MethodHandle loop = MethodHandles.countedLoop(fit13, start, MH_step); * MethodHandle loop = MethodHandles.countedLoop(fit13, start, MH_step);
* assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!")); * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("Lambdaman!"));
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example with the simplest possible body method type, * @apiNote Example with the simplest possible body method type,
* and passing the number of iterations to the loop invocation: * and passing the number of iterations to the loop invocation:
* <blockquote><pre>{@code * <blockquote><pre>{@code
@ -5273,7 +5273,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* MethodHandle loop = MethodHandles.countedLoop(count, start, MH_step); // (v, i) -> "na " + v * MethodHandle loop = MethodHandles.countedLoop(count, start, MH_step); // (v, i) -> "na " + v
* assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke(13, "Lambdaman!")); * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke(13, "Lambdaman!"));
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example that treats the number of iterations, string to append to, and string to append * @apiNote Example that treats the number of iterations, string to append to, and string to append
* as loop parameters: * as loop parameters:
* <blockquote><pre>{@code * <blockquote><pre>{@code
@ -5286,7 +5286,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* MethodHandle loop = MethodHandles.countedLoop(count, start, MH_step); // (v, i, _, pre, _) -> pre + " " + v * MethodHandle loop = MethodHandles.countedLoop(count, start, MH_step); // (v, i, _, pre, _) -> pre + " " + v
* assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke(13, "na", "Lambdaman!")); * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke(13, "na", "Lambdaman!"));
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example that illustrates the usage of {@link #dropArgumentsToMatch(MethodHandle, int, List, int)} * @apiNote Example that illustrates the usage of {@link #dropArgumentsToMatch(MethodHandle, int, List, int)}
* to enforce a loop type: * to enforce a loop type:
* <blockquote><pre>{@code * <blockquote><pre>{@code
@ -5301,7 +5301,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* MethodHandle loop = MethodHandles.countedLoop(count, start, body); // (v, i, pre, _, _) -> pre + " " + v * MethodHandle loop = MethodHandles.countedLoop(count, start, body); // (v, i, pre, _, _) -> pre + " " + v
* assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("na", 13, "Lambdaman!")); * assertEquals("na na na na na na na na na na na na na Lambdaman!", loop.invoke("na", 13, "Lambdaman!"));
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote The implementation of this method can be expressed as follows: * @apiNote The implementation of this method can be expressed as follows:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* MethodHandle countedLoop(MethodHandle iterations, MethodHandle init, MethodHandle body) { * MethodHandle countedLoop(MethodHandle iterations, MethodHandle init, MethodHandle body) {
@ -5406,7 +5406,6 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* } * }
* }</pre></blockquote> * }</pre></blockquote>
* *
* <p>
* @apiNote The implementation of this method can be expressed as follows: * @apiNote The implementation of this method can be expressed as follows:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) { * MethodHandle countedLoop(MethodHandle start, MethodHandle end, MethodHandle init, MethodHandle body) {
@ -5607,7 +5606,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* return v; * return v;
* } * }
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote Example: * @apiNote Example:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* // get an iterator from a list * // get an iterator from a list
@ -5622,7 +5621,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* List<String> reversedList = Arrays.asList("e", "d", "c", "b", "a"); * List<String> reversedList = Arrays.asList("e", "d", "c", "b", "a");
* assertEquals(reversedList, (List<String>) loop.invoke(list)); * assertEquals(reversedList, (List<String>) loop.invoke(list));
* }</pre></blockquote> * }</pre></blockquote>
* <p> *
* @apiNote The implementation of this method can be expressed approximately as follows: * @apiNote The implementation of this method can be expressed approximately as follows:
* <blockquote><pre>{@code * <blockquote><pre>{@code
* MethodHandle iteratedLoop(MethodHandle iterator, MethodHandle init, MethodHandle body) { * MethodHandle iteratedLoop(MethodHandle iterator, MethodHandle init, MethodHandle body) {

View file

@ -165,28 +165,33 @@
* <p> * <p>
* Given these rules, here are examples of legal bootstrap method declarations, * Given these rules, here are examples of legal bootstrap method declarations,
* given various numbers {@code N} of extra arguments. * given various numbers {@code N} of extra arguments.
* The first rows (marked {@code *}) will work for any number of extra arguments. * The first row (marked {@code *}) will work for any number of extra arguments.
* <table class="plain"> * <table class="plain" style="vertical-align:top">
* <caption style="display:none">Static argument types</caption> * <caption style="display:none">Static argument types</caption>
* <tr><th>N</th><th>Sample bootstrap method</th></tr> * <thead>
* <tr><td>*</td> * <tr><th scope="col">N</th><th scope="col">Sample bootstrap method</th></tr>
* <td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code></td></tr> * </thead>
* <tr><td>*</td><td> * <tbody>
* <code>CallSite bootstrap(Object... args)</code></td></tr> * <tr><th scope="row" style="font-weight:normal; vertical-align:top">*</th><td>
* <tr><td>*</td><td> * <ul style="list-style:none; padding-left: 0; margin:0">
* <code>CallSite bootstrap(Object caller, Object... nameAndTypeWithArgs)</code></td></tr> * <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code>
* <tr><td>0</td><td> * <li><code>CallSite bootstrap(Object... args)</code>
* <code>CallSite bootstrap(Lookup caller, String name, MethodType type)</code></td></tr> * <li><code>CallSite bootstrap(Object caller, Object... nameAndTypeWithArgs)</code>
* <tr><td>0</td><td> * </ul></td></tr>
* <code>CallSite bootstrap(Lookup caller, Object... nameAndType)</code></td></tr> * <tr><th scope="row" style="font-weight:normal; vertical-align:top">0</th><td>
* <tr><td>1</td><td> * <ul style="list-style:none; padding-left: 0; margin:0">
* <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type)</code>
* <li><code>CallSite bootstrap(Lookup caller, Object... nameAndType)</code>
* </ul></td></tr>
* <tr><th scope="row" style="font-weight:normal; vertical-align:top">1</th><td>
* <code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object arg)</code></td></tr> * <code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object arg)</code></td></tr>
* <tr><td>2</td><td> * <tr><th scope="row" style="font-weight:normal; vertical-align:top">2</th><td>
* <code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code></td></tr> * <ul style="list-style:none; padding-left: 0; margin:0">
* <tr><td>2</td><td> * <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, Object... args)</code>
* <code>CallSite bootstrap(Lookup caller, String name, MethodType type, String... args)</code></td></tr> * <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String... args)</code>
* <tr><td>2</td> * <li><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String x, int y)</code>
* <td><code>CallSite bootstrap(Lookup caller, String name, MethodType type, String x, int y)</code></td></tr> * </ul></td></tr>
* </tbody>
* </table> * </table>
* The last example assumes that the extra arguments are of type * The last example assumes that the extra arguments are of type
* {@code CONSTANT_String} and {@code CONSTANT_Integer}, respectively. * {@code CONSTANT_String} and {@code CONSTANT_Integer}, respectively.

View file

@ -108,27 +108,39 @@ import sun.reflect.annotation.AnnotationType;
* <table class="plain"> * <table class="plain">
* <caption>Overview of kind of presence detected by different AnnotatedElement methods</caption> * <caption>Overview of kind of presence detected by different AnnotatedElement methods</caption>
* <thead> * <thead>
* <tr><th colspan=2></th><th colspan=4>Kind of Presence</th> * <tr><th colspan=2 scope="col">Method</th>
* <tr><th colspan=2>Method</th><th>Directly Present</th><th>Indirectly Present</th><th>Present</th><th>Associated</th> * <th colspan=4 scope="col">Kind of Presence</th>
* <tr><th scope="col">Return Type</th>
* <th scope="col">Signature</th>
* <th scope="col">Directly Present</th>
* <th scope="col">Indirectly Present</th>
* <th scope="col">Present</th>
* <th scope="col">Associated</th>
* </thead> * </thead>
* <tbody> * <tbody>
* <tr><td style="text-align:right">{@code T}</td><td>{@link #getAnnotation(Class) getAnnotation(Class&lt;T&gt;)} * <tr><td style="text-align:right">{@code T}</td>
* <td></td><td></td><td>X</td><td></td> * <th scope="row" style="font-weight:normal; text-align:left">{@link #getAnnotation(Class) getAnnotation(Class&lt;T&gt;)}
* <td></td><td></td><td style="text-align:center">X</td><td></td>
* </tr> * </tr>
* <tr><td style="text-align:right">{@code Annotation[]}</td><td>{@link #getAnnotations getAnnotations()} * <tr><td style="text-align:right">{@code Annotation[]}</td>
* <td></td><td></td><td>X</td><td></td> * <th scope="row" style="font-weight:normal; text-align:left">{@link #getAnnotations getAnnotations()}
* <td></td><td></td><td style="text-align:center">X</td><td></td>
* </tr> * </tr>
* <tr><td style="text-align:right">{@code T[]}</td><td>{@link #getAnnotationsByType(Class) getAnnotationsByType(Class&lt;T&gt;)} * <tr><td style="text-align:right">{@code T[]}</td>
* <td></td><td></td><td></td><td>X</td> * <th scope="row" style="font-weight:normal; text-align:left">{@link #getAnnotationsByType(Class) getAnnotationsByType(Class&lt;T&gt;)}
* <td></td><td></td><td></td><td style="text-align:center">X</td>
* </tr> * </tr>
* <tr><td style="text-align:right">{@code T}</td><td>{@link #getDeclaredAnnotation(Class) getDeclaredAnnotation(Class&lt;T&gt;)} * <tr><td style="text-align:right">{@code T}</td>
* <td>X</td><td></td><td></td><td></td> * <th scope="row" style="font-weight:normal; text-align:left">{@link #getDeclaredAnnotation(Class) getDeclaredAnnotation(Class&lt;T&gt;)}
* <td style="text-align:center">X</td><td></td><td></td><td></td>
* </tr> * </tr>
* <tr><td style="text-align:right">{@code Annotation[]}</td><td>{@link #getDeclaredAnnotations getDeclaredAnnotations()} * <tr><td style="text-align:right">{@code Annotation[]}</td>
* <td>X</td><td></td><td></td><td></td> * <th scope="row" style="font-weight:normal; text-align:left">{@link #getDeclaredAnnotations getDeclaredAnnotations()}
* <td style="text-align:center">X</td><td></td><td></td><td></td>
* </tr> * </tr>
* <tr><td style="text-align:right">{@code T[]}</td><td>{@link #getDeclaredAnnotationsByType(Class) getDeclaredAnnotationsByType(Class&lt;T&gt;)} * <tr><td style="text-align:right">{@code T[]}</td>
* <td>X</td><td>X</td><td></td><td></td> * <th scope="row" style="font-weight:normal; text-align:left">{@link #getDeclaredAnnotationsByType(Class) getDeclaredAnnotationsByType(Class&lt;T&gt;)}
* <td style="text-align:center">X</td><td style="text-align:center">X</td><td></td><td></td>
* </tr> * </tr>
* </tbody> * </tbody>
* </table> * </table>