Java Code Examples for sun.invoke.util.ValueConversions#boxExact()
The following examples show how to use
sun.invoke.util.ValueConversions#boxExact() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValueConversionsTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 2
Source File: ValueConversionsTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 3
Source File: ValueConversionsTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 4
Source File: ValueConversionsTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 5
Source File: ValueConversionsTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 6
Source File: ValueConversionsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 7
Source File: ValueConversionsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 8
Source File: ValueConversionsTest.java From hottub with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 9
Source File: ValueConversionsTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 10
Source File: ValueConversionsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }
Example 11
Source File: ValueConversionsTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Test public void testBox() throws Throwable { for (Wrapper w : Wrapper.values()) { if (w == Wrapper.VOID) continue; // skip this; no unboxed form if (w == Wrapper.OBJECT) continue; // skip this; already unboxed for (int n = -5; n < 10; n++) { Object box = w.wrap(n); MethodHandle boxer = ValueConversions.boxExact(w); Object expResult = box; Object result = null; switch (w) { case INT: result = (Integer) boxer.invokeExact(/*int*/n); break; case LONG: result = (Long) boxer.invokeExact((long)n); break; case FLOAT: result = (Float) boxer.invokeExact((float)n); break; case DOUBLE: result = (Double) boxer.invokeExact((double)n); break; case CHAR: result = (Character) boxer.invokeExact((char)n); break; case BYTE: result = (Byte) boxer.invokeExact((byte)n); break; case SHORT: result = (Short) boxer.invokeExact((short)n); break; case BOOLEAN: result = (Boolean) boxer.invokeExact((n & 1) != 0); break; } assertEquals("(dst,src,n,box)="+Arrays.asList(w,w,n,box), expResult, result); } } }