Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8254797: [Development] Define & apply annotation jdk.internal.ValueBased #233

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Boolean.java
Original file line number Diff line number Diff line change
@@ -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
{
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Byte.java
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@
* @see java.lang.Number
* @since 1.1
*/
@jdk.internal.ValueBased
public final class Byte extends Number implements Comparable<Byte>, Constable {

/**
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Character.java
Original file line number Diff line number Diff line change
@@ -129,6 +129,7 @@
* @author Ulf Zibis
* @since 1.0
*/
@jdk.internal.ValueBased
public final
class Character implements java.io.Serializable, Comparable<Character>, Constable {
/**
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Double.java
Original file line number Diff line number Diff line change
@@ -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 {
/**
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Float.java
Original file line number Diff line number Diff line change
@@ -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 {
/**
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Integer.java
Original file line number Diff line number Diff line change
@@ -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 {
/**
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/Long.java
Original file line number Diff line number Diff line change
@@ -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 {
/**
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/lang/ProcessHandle.java
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@
* @see Process
* @since 9
*/
@jdk.internal.ValueBased
public interface ProcessHandle extends Comparable<ProcessHandle> {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class HijrahDate
extends ChronoLocalDateImpl<HijrahDate>
implements ChronoLocalDate, Serializable {
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class JapaneseDate
extends ChronoLocalDateImpl<JapaneseDate>
implements ChronoLocalDate, Serializable {
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class MinguoDate
extends ChronoLocalDateImpl<MinguoDate>
implements ChronoLocalDate, Serializable {
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class ThaiBuddhistDate
extends ChronoLocalDateImpl<ThaiBuddhistDate>
implements ChronoLocalDate, Serializable {
Original file line number Diff line number Diff line change
@@ -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
*/
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/KeyValueHolder.java
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/Optional.java
Original file line number Diff line number Diff line change
@@ -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()}.
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/OptionalDouble.java
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OptionalDouble {
/**
* Common instance for {@code empty()}.
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/OptionalInt.java
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OptionalInt {
/**
* Common instance for {@code empty()}.
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/util/OptionalLong.java
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@
*
* @since 1.8
*/
@jdk.internal.ValueBased
public final class OptionalLong {
/**
* Common instance for {@code empty()}.
44 changes: 44 additions & 0 deletions src/java.base/share/classes/jdk/internal/ValueBased.java
Original file line number Diff line number Diff line change
@@ -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.
*
* @since 16
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(value={TYPE})
public @interface ValueBased {
}