6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package jdk.vm.ci.hotspot.test;
25
26 import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
27 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
28
29 import java.util.LinkedList;
30
31 import jdk.vm.ci.meta.JavaConstant;
32 import org.testng.annotations.DataProvider;
33
34 public class UnboxPrimitiveDataProvider {
35
36 @DataProvider(name = "unboxPrimitiveDataProvider")
37 public static Object[][] unboxPrimitiveDataProvider() {
38 LinkedList<Object[]> cfgSet = new LinkedList<>();
39 // Testing boolean
40 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
41 true), JavaConstant.forBoolean(true)});
42 cfgSet.add(new Object[]{JavaConstant.forBoolean(true), null});
43 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(false),
44 JavaConstant.forBoolean(false)});
45 cfgSet.add(new Object[]{JavaConstant.forBoolean(false), null});
46 for (byte number : new byte[]{-128, 0, 1, 127}) {
47 // Testing boxed primitives
48 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number)),
49 JavaConstant.forByte(number)});
50 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number)),
51 JavaConstant.forShort(number)});
52 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number)),
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package jdk.vm.ci.hotspot.test;
25
26 import jdk.vm.ci.meta.JavaConstant;
27 import org.testng.annotations.DataProvider;
28
29 import java.util.LinkedList;
30
31 import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
32 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
33
34 public class UnboxPrimitiveDataProvider {
35
36 @DataProvider(name = "unboxPrimitiveDataProvider")
37 public static Object[][] unboxPrimitiveDataProvider() {
38 LinkedList<Object[]> cfgSet = new LinkedList<>();
39 // Testing boolean
40 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(
41 true), JavaConstant.forBoolean(true)});
42 cfgSet.add(new Object[]{JavaConstant.forBoolean(true), null});
43 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(false),
44 JavaConstant.forBoolean(false)});
45 cfgSet.add(new Object[]{JavaConstant.forBoolean(false), null});
46 for (byte number : new byte[]{-128, 0, 1, 127}) {
47 // Testing boxed primitives
48 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number)),
49 JavaConstant.forByte(number)});
50 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number)),
51 JavaConstant.forShort(number)});
52 cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(Integer.valueOf(number)),
|