< prev index next >

src/java.base/share/classes/sun/invoke/util/Wrapper.java

Print this page
rev 15320 : 8163370: Reduce number of classes loaded by common usage of java.lang.invoke
Reviewed-by: igerasim, psandoz

@@ -40,10 +40,12 @@
     OBJECT (   Object.class,  Object.class, 'L', new  Object[0], Format.other(    1)),
     // VOID must be the last type, since it is "assignable" from any other type:
     VOID   (     Void.class,    void.class, 'V',           null, Format.other(    0)),
     ;
 
+    public static final int COUNT = 10;
+
     private final Class<?> wrapperType;
     private final Class<?> primitiveType;
     private final char     basicTypeChar;
     private final Object   emptyArray;
     private final int      format;

@@ -158,11 +160,14 @@
         assert(this.isFloating() || this.isSigned());
         assert(source.isFloating() || source.isSigned());
         return true;
     }
 
-    static { assert(checkConvertibleFrom()); }
+    static {
+        assert(checkConvertibleFrom());
+        assert(COUNT == Wrapper.values().length);
+    }
     private static boolean checkConvertibleFrom() {
         // Check the matrix for correct classification of widening conversions.
         for (Wrapper w : values()) {
             assert(w.isConvertibleFrom(w));
             assert(VOID.isConvertibleFrom(w));
< prev index next >