Skip to content

Commit cdaf144

Browse files
author
Dan Smith
committed
8254275: [valhalla/jep390] Revise "value-based class" & apply to wrappers
Reviewed-by: mchung, rriggs
1 parent eec3823 commit cdaf144

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+238
-199
lines changed

src/java.base/share/classes/java/lang/Boolean.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,19 @@
4141
* {@code boolean} in an object. An object of type
4242
* {@code Boolean} contains a single field whose type is
4343
* {@code boolean}.
44-
* <p>
45-
* In addition, this class provides many methods for
44+
*
45+
* <p>In addition, this class provides many methods for
4646
* converting a {@code boolean} to a {@code String} and a
4747
* {@code String} to a {@code boolean}, as well as other
4848
* constants and methods useful when dealing with a
4949
* {@code boolean}.
5050
*
51+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
52+
* class; programmers should treat instances that are
53+
* {@linkplain #equals(Object) equal} as interchangeable and should not
54+
* use instances for synchronization, or unpredictable behavior may
55+
* occur.
56+
*
5157
* @author Arthur van Hoff
5258
* @since 1.0
5359
*/

src/java.base/share/classes/java/lang/Byte.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
* byte}, as well as other constants and methods useful when dealing
4949
* with a {@code byte}.
5050
*
51+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
52+
* class; programmers should treat instances that are
53+
* {@linkplain #equals(Object) equal} as interchangeable and should not
54+
* use instances for synchronization, or unpredictable behavior may
55+
* occur.
56+
*
5157
* @author Nakul Saraiya
5258
* @author Joseph D. Darcy
5359
* @see java.lang.Number

src/java.base/share/classes/java/lang/Character.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@
122122
* encoding. For more information on Unicode terminology, refer to the
123123
* <a href="http://www.unicode.org/glossary/">Unicode Glossary</a>.
124124
*
125+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
126+
* class; programmers should treat instances that are
127+
* {@linkplain #equals(Object) equal} as interchangeable and should not
128+
* use instances for synchronization, or unpredictable behavior may
129+
* occur.
130+
*
125131
* @author Lee Boynton
126132
* @author Guy Steele
127133
* @author Akira Tanaka

src/java.base/share/classes/java/lang/Double.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
* constants and methods useful when dealing with a
4747
* {@code double}.
4848
*
49+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
50+
* class; programmers should treat instances that are
51+
* {@linkplain #equals(Object) equal} as interchangeable and should not
52+
* use instances for synchronization, or unpredictable behavior may
53+
* occur.
54+
*
4955
* @author Lee Boynton
5056
* @author Arthur van Hoff
5157
* @author Joseph D. Darcy

src/java.base/share/classes/java/lang/Float.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
* constants and methods useful when dealing with a
4646
* {@code float}.
4747
*
48+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
49+
* class; programmers should treat instances that are
50+
* {@linkplain #equals(Object) equal} as interchangeable and should not
51+
* use instances for synchronization, or unpredictable behavior may
52+
* occur.
53+
*
4854
* @author Lee Boynton
4955
* @author Arthur van Hoff
5056
* @author Joseph D. Darcy

src/java.base/share/classes/java/lang/Integer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
* {@code int}, as well as other constants and methods useful when
5151
* dealing with an {@code int}.
5252
*
53+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
54+
* class; programmers should treat instances that are
55+
* {@linkplain #equals(Object) equal} as interchangeable and should not
56+
* use instances for synchronization, or unpredictable behavior may
57+
* occur.
58+
*
5359
* <p>Implementation note: The implementations of the "bit twiddling"
5460
* methods (such as {@link #highestOneBit(int) highestOneBit} and
5561
* {@link #numberOfTrailingZeros(int) numberOfTrailingZeros}) are

src/java.base/share/classes/java/lang/Long.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
* long}, as well as other constants and methods useful when dealing
5151
* with a {@code long}.
5252
*
53+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
54+
* class; programmers should treat instances that are
55+
* {@linkplain #equals(Object) equal} as interchangeable and should not
56+
* use instances for synchronization, or unpredictable behavior may
57+
* occur.
58+
*
5359
* <p>Implementation note: The implementations of the "bit twiddling"
5460
* methods (such as {@link #highestOneBit(long) highestOneBit} and
5561
* {@link #numberOfTrailingZeros(long) numberOfTrailingZeros}) are

src/java.base/share/classes/java/lang/ProcessHandle.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@
8181
* <p>
8282
* The {@code ProcessHandle} static factory methods return instances that are
8383
* <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>,
84-
* immutable and thread-safe.
85-
* Use of identity-sensitive operations (including reference equality
86-
* ({@code ==}), identity hash code, or synchronization) on these instances of
87-
* {@code ProcessHandle} may have unpredictable results and should be avoided.
88-
* Use {@link #equals(Object) equals} or
89-
* {@link #compareTo(ProcessHandle) compareTo} methods to compare ProcessHandles.
84+
* immutable and thread-safe. Programmers should treat instances that are
85+
* {@linkplain #equals(Object) equal} as interchangeable and should not
86+
* use instances for synchronization, or unpredictable behavior may occur.
87+
* Use the {@code equals} or {@link #compareTo(ProcessHandle) compareTo} methods
88+
* to compare ProcessHandles.
9089
*
9190
* @see Process
9291
* @since 9

src/java.base/share/classes/java/lang/Runtime.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -941,11 +941,11 @@ public static Version version() {
941941
* $VNUM(-$PRE)?
942942
* </pre></blockquote>
943943
*
944-
* <p>This is a <a href="./doc-files/ValueBased.html">value-based</a>
945-
* class; use of identity-sensitive operations (including reference equality
946-
* ({@code ==}), identity hash code, or synchronization) on instances of
947-
* {@code Version} may have unpredictable results and should be avoided.
948-
* </p>
944+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
945+
* class; programmers should treat instances that are
946+
* {@linkplain #equals(Object) equal} as interchangeable and should not
947+
* use instances for synchronization, or unpredictable behavior may
948+
* occur.</p>
949949
*
950950
* @since 9
951951
*/

src/java.base/share/classes/java/lang/Short.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
* {@code short}, as well as other constants and methods useful when
4848
* dealing with a {@code short}.
4949
*
50+
* <p>This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
51+
* class; programmers should treat instances that are
52+
* {@linkplain #equals(Object) equal} as interchangeable and should not
53+
* use instances for synchronization, or unpredictable behavior may
54+
* occur.
55+
*
5056
* @author Nakul Saraiya
5157
* @author Joseph D. Darcy
5258
* @see java.lang.Number

0 commit comments

Comments
 (0)