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

Print this page

        

@@ -23,10 +23,13 @@
  * questions.
  */
 
 package java.lang;
 
+import java.lang.invoke.Constable;
+import java.lang.invoke.MethodHandles;
+
 import jdk.internal.math.FloatingDecimal;
 import jdk.internal.math.DoubleConsts;
 import jdk.internal.HotSpotIntrinsicCandidate;
 
 /**

@@ -44,11 +47,11 @@
  * @author  Lee Boynton
  * @author  Arthur van Hoff
  * @author  Joseph D. Darcy
  * @since 1.0
  */
-public final class Double extends Number implements Comparable<Double> {
+public final class Double extends Number implements Comparable<Double>, Constable<Double> {
     /**
      * A constant holding the positive infinity of type
      * {@code double}. It is equal to the value returned by
      * {@code Double.longBitsToDouble(0x7ff0000000000000L)}.
      */

@@ -1064,8 +1067,13 @@
      */
     public static double min(double a, double b) {
         return Math.min(a, b);
     }
 
+    @Override
+    public Double resolveConstant(MethodHandles.Lookup lookup) {
+        return this;
+    }
+
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
     private static final long serialVersionUID = -9172774392245257468L;
 }