From 20511375de9b57740ea56349e203992815f07d2f Mon Sep 17 00:00:00 2001 From: Robbie Gemmell Date: Wed, 29 Sep 2021 11:55:40 +0100 Subject: [PATCH] NO-JIRA: update to errorprone 2.9.0, fix errors, enable it when running on Java 17+ --- .../utils/TypedPropertiesConcurrencyTest.java | 16 ++++------------ .../core/config/impl/ConfigurationImplTest.java | 3 ++- pom.xml | 6 +++--- .../integration/cluster/bridge/BridgeTest.java | 2 +- .../artemis/tests/unit/util/LinkedListTest.java | 2 +- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java index 9e9e86ac71c..ceeb733d6b1 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/TypedPropertiesConcurrencyTest.java @@ -16,6 +16,8 @@ */ package org.apache.activemq.artemis.utils; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.ConcurrentModificationException; import java.util.concurrent.CountDownLatch; @@ -26,18 +28,10 @@ import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.utils.collections.TypedProperties; import org.junit.Assert; -import static org.junit.Assert.assertEquals; import org.junit.Test; public class TypedPropertiesConcurrencyTest { - // Constructors -------------------------------------------------- - - // Public -------------------------------------------------------- - - - private SimpleString key = SimpleString.toSimpleString("key"); - @Test public void testClearAndToString() throws Exception { TypedProperties props = new TypedProperties(); @@ -67,7 +61,7 @@ public void testClearAndToString() throws Exception { try { countDownLatch.await(); for (int k = 0; k < 1000; k++) { - props.toString(); + assertNotNull(props.toString()); } } catch (ConcurrentModificationException t) { hasError.set(true); @@ -86,7 +80,6 @@ public void testClearAndToString() throws Exception { Assert.assertFalse(hasError.get()); } - @Test public void testGetPropertyNamesClearAndToString() throws Exception { TypedProperties props = new TypedProperties(); @@ -118,7 +111,7 @@ public void testGetPropertyNamesClearAndToString() throws Exception { try { countDownLatch.await(); for (int k = 0; k < 1000; k++) { - props.toString(); + assertNotNull(props.toString()); } } catch (ConcurrentModificationException t) { hasError.set(true); @@ -137,7 +130,6 @@ public void testGetPropertyNamesClearAndToString() throws Exception { Assert.assertFalse(hasError.get()); } - @Test public void testEncodedSizeAfterClearIsSameAsNewTypedProperties() throws Exception { TypedProperties props = new TypedProperties(); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java index de47b462400..146386d02e0 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java @@ -99,7 +99,8 @@ public void testDefaults() { public void testNullMaskPassword() { ConfigurationImpl impl = new ConfigurationImpl(); impl.setMaskPassword(null); - impl.hashCode(); + + Assert.assertEquals(impl.hashCode(), impl.hashCode()); } @Test diff --git a/pom.xml b/pom.xml index 5c621d4a6a8..27cd5d9b96c 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,7 @@ 3.4.2.Final 9.4.43.v20210629 3.6.13.Final - 2.6.0 + 2.9.0 3.0.0-M3 5.1.2 3.1.1 @@ -1028,10 +1028,10 @@ - jdk16-errorprone + jdk16on-errorprone - 16 + [16,) errorprone diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java index 96b0446f391..3946933f68b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java @@ -871,7 +871,7 @@ public void testWithDuplicates() throws Exception { LinkedListIterator iterator = queue.iterator(); for (int i = 0; i < 100; i++) { - iterator.hasNext(); + assertTrue(iterator.hasNext()); ids[i] = iterator.next().getMessage().getMessageID(); } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java index 5d755c90cf5..be4619cc561 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java @@ -1091,7 +1091,7 @@ public void testRepeat() { iter.next(); iter.next(); iter.next(); - iter.hasNext(); + assertTrue(iter.hasNext()); assertEquals(4, iter.next().intValue()); iter.repeat();