src/java.base/share/classes/java/lang/Float.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.HotSpotIntrinsicCandidate;
 
 /**
  * The {@code Float} class wraps a value of primitive type

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

@@ -976,8 +979,14 @@
      */
     public static float min(float a, float b) {
         return Math.min(a, b);
     }
 
+
+    @Override
+    public Float resolveConstant(MethodHandles.Lookup lookup) {
+        return this;
+    }
+
     /** use serialVersionUID from JDK 1.0.2 for interoperability */
     private static final long serialVersionUID = -2671257302660747028L;
 }