< prev index next >

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

Print this page
rev 52865 : [mq]: 8210031

*** 23,32 **** --- 23,37 ---- * questions. */ package java.lang; + import java.lang.invoke.MethodHandles; + import java.lang.constant.Constable; + import java.lang.constant.ConstantDesc; + import java.util.Optional; + import jdk.internal.math.FloatingDecimal; import jdk.internal.math.DoubleConsts; import jdk.internal.HotSpotIntrinsicCandidate; /**
*** 44,54 **** * @author Lee Boynton * @author Arthur van Hoff * @author Joseph D. Darcy * @since 1.0 */ ! public final class Double extends Number implements Comparable<Double> { /** * A constant holding the positive infinity of type * {@code double}. It is equal to the value returned by * {@code Double.longBitsToDouble(0x7ff0000000000000L)}. */ --- 49,60 ---- * @author Lee Boynton * @author Arthur van Hoff * @author Joseph D. Darcy * @since 1.0 */ ! public final class Double extends Number ! implements Comparable<Double>, ConstantDesc, Constable { /** * A constant holding the positive infinity of type * {@code double}. It is equal to the value returned by * {@code Double.longBitsToDouble(0x7ff0000000000000L)}. */
*** 1068,1075 **** --- 1074,1106 ---- */ public static double min(double a, double b) { return Math.min(a, b); } + /** + * Returns a nominal descriptor for this instance, which is the instance + * itself. + * + * @return an {@link Optional} describing the {@linkplain Double} instance + * @since 12 + */ + @Override + public Optional<Double> describeConstable() { + return Optional.of(this); + } + + /** + * Resolves this instance as a {@link ConstantDesc}, the result of which is + * the instance itself. + * + * @param lookup ignored + * @return the {@linkplain Double} instance + * @since 12 + */ + @Override + public Double resolveConstantDesc(MethodHandles.Lookup lookup) { + return this; + } + /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = -9172774392245257468L; }
< prev index next >