From d8e5138897670d7fc56903574f3827e24dda5ce1 Mon Sep 17 00:00:00 2001 From: Gayan Weerakutti Date: Sun, 27 May 2018 14:50:38 +0530 Subject: [PATCH 1/2] Replace Number constructor calls with valueOf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace attempts to instantiate a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument, with more efficient static method valueOf() (introduced in Java 5), which will cache objects for values between -128 and 127 inclusive. We can't use assertEquals(42, obj.i); in gov.nasa.jpf.test.vm.reflection.ConstructorTest#testConstructorCallInteger as both assertEquals (Object, Object) and assertEquals (int, int) in TestJPF match (Ambiguous method call) Issue: #47 --- src/tests/gov/nasa/jpf/test/vm/reflection/ConstructorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/gov/nasa/jpf/test/vm/reflection/ConstructorTest.java b/src/tests/gov/nasa/jpf/test/vm/reflection/ConstructorTest.java index eff4e3b5..546a007b 100644 --- a/src/tests/gov/nasa/jpf/test/vm/reflection/ConstructorTest.java +++ b/src/tests/gov/nasa/jpf/test/vm/reflection/ConstructorTest.java @@ -85,7 +85,7 @@ public void testConstructorCallInteger() { I obj = ctor.newInstance(42); assertNotNull(obj); - assertEquals(new Integer(42), obj.i); + assertEquals(Integer.valueOf(42), obj.i); } catch (Throwable t) { fail("ctor invocation with Integer failed: " + t); } From 5feccf62de29ca887ca8eaa9a2d409c6fe4d4c49 Mon Sep 17 00:00:00 2001 From: Gayan Weerakutti Date: Sun, 27 May 2018 15:06:37 +0530 Subject: [PATCH 2/2] Fixup for ddd3c52 This is a fixup for the commit ddd3c52 Issue: #47 --- src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java b/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java index dba4f751..833311fd 100644 --- a/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java +++ b/src/tests/gov/nasa/jpf/util/SparseClusterArrayTest.java @@ -180,6 +180,7 @@ public void testClone() { Cloner cloner = new Cloner() { @Override + @SuppressWarnings("deprecation") public Integer clone (Integer other) { return new Integer(other); }