From 780e2043399bf4168f2dee12e47f52f9f6c49700 Mon Sep 17 00:00:00 2001 From: David Marquis Date: Sun, 29 Apr 2018 08:44:11 -0400 Subject: [PATCH] Housekeeping - update libs and get rid of compilation warnings - JUnit updated to `4.12` - Hamcrest updated to `1.10.19` - Fixed a few compilation warnings in reflection code --- pom.xml | 4 ++-- .../java/com/fluentinterface/beans/reflect/Property.java | 8 ++++---- src/test/java/com/fluentinterface/BuilderProxyTest.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 4aa91a3..2c74e2e 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ junit junit - 4.10 + 4.12 test @@ -63,7 +63,7 @@ org.mockito mockito-all - 1.9.0 + 1.10.19 test diff --git a/src/main/java/com/fluentinterface/beans/reflect/Property.java b/src/main/java/com/fluentinterface/beans/reflect/Property.java index 23ad75c..4f253a0 100644 --- a/src/main/java/com/fluentinterface/beans/reflect/Property.java +++ b/src/main/java/com/fluentinterface/beans/reflect/Property.java @@ -182,7 +182,7 @@ public final class Property implements AnnotatedElement { */ @Override public Annotation[] getAnnotations() { - return annotations.values().toArray(new Annotation[annotations.size()]); + return annotations.values().toArray(new Annotation[0]); } /** @@ -202,7 +202,7 @@ public Annotation[] getAnnotations() { */ @Override public Annotation[] getDeclaredAnnotations() { - return declaredAnnotations.values().toArray(new Annotation[declaredAnnotations.size()]); + return declaredAnnotations.values().toArray(new Annotation[0]); } /** @@ -403,7 +403,7 @@ public boolean isWritable() { public Object get(Object obj) throws ReflectionException { try { if (isPublic(readMethod)) { - return readMethod.invoke(obj, null); + return readMethod.invoke(obj); } else { throw new ReflectionException("Cannot get the value of " + this + ", as it is write-only."); } @@ -431,7 +431,7 @@ public Object get(Object obj) throws ReflectionException { public void set(Object obj, Object value) throws ReflectionException { try { if (isPublic(writeMethod)) { - writeMethod.invoke(obj, new Object[]{value}); + writeMethod.invoke(obj, value); } else { throw new ReflectionException("Cannot set the value of " + this + ", as it is read-only."); } diff --git a/src/test/java/com/fluentinterface/BuilderProxyTest.java b/src/test/java/com/fluentinterface/BuilderProxyTest.java index 413c8a9..12ec1e9 100644 --- a/src/test/java/com/fluentinterface/BuilderProxyTest.java +++ b/src/test/java/com/fluentinterface/BuilderProxyTest.java @@ -15,9 +15,9 @@ import static java.util.Arrays.asList; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.assertThat; -import static org.junit.internal.matchers.IsCollectionContaining.hasItem; @RunWith(Parameterized.class) public class BuilderProxyTest {