Skip to content

Commit

Permalink
8255125: [Development] copy jdk.internal.ValueBased to jep390 branch
Browse files Browse the repository at this point in the history
Reviewed-by: mchung
  • Loading branch information
Roger Riggs committed Oct 21, 2020
1 parent 6bc4931 commit f2f03c8
Show file tree
Hide file tree
Showing 37 changed files with 79 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Boolean.java
Expand Up @@ -51,6 +51,7 @@
* @author Arthur van Hoff
* @since 1.0
*/
@jdk.internal.ValueBased
public final class Boolean implements java.io.Serializable,
Comparable<Boolean>, Constable
{
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Byte.java
Expand Up @@ -53,6 +53,7 @@
* @see java.lang.Number
* @since 1.1
*/
@jdk.internal.ValueBased
public final class Byte extends Number implements Comparable<Byte>, Constable {

/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Character.java
Expand Up @@ -129,6 +129,7 @@
* @author Ulf Zibis
* @since 1.0
*/
@jdk.internal.ValueBased
public final
class Character implements java.io.Serializable, Comparable<Character>, Constable {
/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Double.java
Expand Up @@ -51,6 +51,7 @@
* @author Joseph D. Darcy
* @since 1.0
*/
@jdk.internal.ValueBased
public final class Double extends Number
implements Comparable<Double>, Constable, ConstantDesc {
/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Float.java
Expand Up @@ -50,6 +50,7 @@
* @author Joseph D. Darcy
* @since 1.0
*/
@jdk.internal.ValueBased
public final class Float extends Number
implements Comparable<Float>, Constable, ConstantDesc {
/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Integer.java
Expand Up @@ -62,6 +62,7 @@
* @author Joseph D. Darcy
* @since 1.0
*/
@jdk.internal.ValueBased
public final class Integer extends Number
implements Comparable<Integer>, Constable, ConstantDesc {
/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Long.java
Expand Up @@ -62,6 +62,7 @@
* @author Joseph D. Darcy
* @since 1.0
*/
@jdk.internal.ValueBased
public final class Long extends Number
implements Comparable<Long>, Constable, ConstantDesc {
/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/ProcessHandle.java
Expand Up @@ -91,6 +91,7 @@
* @see Process
* @since 9
*/
@jdk.internal.ValueBased
public interface ProcessHandle extends Comparable<ProcessHandle> {

/**
Expand Down
Expand Up @@ -48,6 +48,7 @@
* @see Process
* @since 9
*/
@jdk.internal.ValueBased
final class ProcessHandleImpl implements ProcessHandle {
/**
* Default size of stack for reaper processes.
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Runtime.java
Expand Up @@ -950,6 +950,7 @@ public static Version version() {
*
* @since 9
*/
@jdk.internal.ValueBased
public static final class Version
implements Comparable<Version>
{
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Short.java
Expand Up @@ -52,6 +52,7 @@
* @see java.lang.Number
* @since 1.1
*/
@jdk.internal.ValueBased
public final class Short extends Number implements Comparable<Short>, Constable {

/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Duration.java
Expand Up @@ -130,6 +130,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class Duration
implements TemporalAmount, Comparable<Duration>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Instant.java
Expand Up @@ -204,6 +204,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class Instant
implements Temporal, TemporalAdjuster, Comparable<Instant>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/LocalDate.java
Expand Up @@ -136,6 +136,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class LocalDate
implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/LocalDateTime.java
Expand Up @@ -132,6 +132,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class LocalDateTime
implements Temporal, TemporalAdjuster, ChronoLocalDateTime<LocalDate>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/LocalTime.java
Expand Up @@ -122,6 +122,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class LocalTime
implements Temporal, TemporalAdjuster, Comparable<LocalTime>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/MonthDay.java
Expand Up @@ -124,6 +124,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class MonthDay
implements TemporalAccessor, TemporalAdjuster, Comparable<MonthDay>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/OffsetDateTime.java
Expand Up @@ -125,6 +125,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OffsetDateTime
implements Temporal, TemporalAdjuster, Comparable<OffsetDateTime>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/OffsetTime.java
Expand Up @@ -115,6 +115,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OffsetTime
implements Temporal, TemporalAdjuster, Comparable<OffsetTime>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Period.java
Expand Up @@ -130,6 +130,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class Period
implements ChronoPeriod, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Year.java
Expand Up @@ -132,6 +132,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class Year
implements Temporal, TemporalAdjuster, Comparable<Year>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/YearMonth.java
Expand Up @@ -128,6 +128,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class YearMonth
implements Temporal, TemporalAdjuster, Comparable<YearMonth>, Serializable {

Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/ZoneId.java
Expand Up @@ -175,6 +175,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public abstract class ZoneId implements Serializable {

/**
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/ZoneOffset.java
Expand Up @@ -127,6 +127,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class ZoneOffset
extends ZoneId
implements TemporalAccessor, TemporalAdjuster, Comparable<ZoneOffset>, Serializable {
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/ZonedDateTime.java
Expand Up @@ -161,6 +161,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class ZonedDateTime
implements Temporal, ChronoZonedDateTime<LocalDate>, Serializable {

Expand Down
Expand Up @@ -116,6 +116,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class HijrahDate
extends ChronoLocalDateImpl<HijrahDate>
implements ChronoLocalDate, Serializable {
Expand Down
Expand Up @@ -123,6 +123,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class JapaneseDate
extends ChronoLocalDateImpl<JapaneseDate>
implements ChronoLocalDate, Serializable {
Expand Down
Expand Up @@ -103,6 +103,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class MinguoDate
extends ChronoLocalDateImpl<MinguoDate>
implements ChronoLocalDate, Serializable {
Expand Down
Expand Up @@ -72,7 +72,6 @@
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.time.temporal.ValueRange;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
Expand Down
Expand Up @@ -103,6 +103,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class ThaiBuddhistDate
extends ChronoLocalDateImpl<ThaiBuddhistDate>
implements ChronoLocalDate, Serializable {
Expand Down
Expand Up @@ -81,7 +81,7 @@
* to the word used for month in association with a day and year in a date.
*
* @implSpec
* This is immutable and thread-safe enum.
* This is an immutable and thread-safe enum.
*
* @since 1.8
*/
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/KeyValueHolder.java
Expand Up @@ -49,6 +49,7 @@
* @see Map#ofEntries Map.ofEntries()
* @since 9
*/
@jdk.internal.ValueBased
final class KeyValueHolder<K,V> implements Map.Entry<K,V> {
@Stable
final K key;
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/Optional.java
Expand Up @@ -57,6 +57,7 @@
* @param <T> the type of value
* @since 1.8
*/
@jdk.internal.ValueBased
public final class Optional<T> {
/**
* Common instance for {@code empty()}.
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/OptionalDouble.java
Expand Up @@ -54,6 +54,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OptionalDouble {
/**
* Common instance for {@code empty()}.
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/OptionalInt.java
Expand Up @@ -54,6 +54,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OptionalInt {
/**
* Common instance for {@code empty()}.
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/OptionalLong.java
Expand Up @@ -54,6 +54,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OptionalLong {
/**
* Common instance for {@code empty()}.
Expand Down
44 changes: 44 additions & 0 deletions src/java.base/share/classes/jdk/internal/ValueBased.java
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.internal;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.TYPE;

/**
* Indicates the API declaration in question is associated with a Value Based class.
* References to <a href="../lang/doc-files/ValueBased.html">value-based classes</a>
* should produce warnings about behavior that is inconsistent with value based semantics.