NO-JIRA: update to errorprone 2.9.0, fix errors, enable it when running on Java 17+

This commit is contained in:
Robbie Gemmell 2021-09-29 11:55:40 +01:00
parent e37175784c
commit 20511375de
5 changed files with 11 additions and 18 deletions

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.utils; 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.ConcurrentModificationException;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -26,18 +28,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.utils.collections.TypedProperties; import org.apache.activemq.artemis.utils.collections.TypedProperties;
import org.junit.Assert; import org.junit.Assert;
import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Test;
public class TypedPropertiesConcurrencyTest { public class TypedPropertiesConcurrencyTest {
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
private SimpleString key = SimpleString.toSimpleString("key");
@Test @Test
public void testClearAndToString() throws Exception { public void testClearAndToString() throws Exception {
TypedProperties props = new TypedProperties(); TypedProperties props = new TypedProperties();
@ -67,7 +61,7 @@ public class TypedPropertiesConcurrencyTest {
try { try {
countDownLatch.await(); countDownLatch.await();
for (int k = 0; k < 1000; k++) { for (int k = 0; k < 1000; k++) {
props.toString(); assertNotNull(props.toString());
} }
} catch (ConcurrentModificationException t) { } catch (ConcurrentModificationException t) {
hasError.set(true); hasError.set(true);
@ -86,7 +80,6 @@ public class TypedPropertiesConcurrencyTest {
Assert.assertFalse(hasError.get()); Assert.assertFalse(hasError.get());
} }
@Test @Test
public void testGetPropertyNamesClearAndToString() throws Exception { public void testGetPropertyNamesClearAndToString() throws Exception {
TypedProperties props = new TypedProperties(); TypedProperties props = new TypedProperties();
@ -118,7 +111,7 @@ public class TypedPropertiesConcurrencyTest {
try { try {
countDownLatch.await(); countDownLatch.await();
for (int k = 0; k < 1000; k++) { for (int k = 0; k < 1000; k++) {
props.toString(); assertNotNull(props.toString());
} }
} catch (ConcurrentModificationException t) { } catch (ConcurrentModificationException t) {
hasError.set(true); hasError.set(true);
@ -137,7 +130,6 @@ public class TypedPropertiesConcurrencyTest {
Assert.assertFalse(hasError.get()); Assert.assertFalse(hasError.get());
} }
@Test @Test
public void testEncodedSizeAfterClearIsSameAsNewTypedProperties() throws Exception { public void testEncodedSizeAfterClearIsSameAsNewTypedProperties() throws Exception {
TypedProperties props = new TypedProperties(); TypedProperties props = new TypedProperties();

View File

@ -99,7 +99,8 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
public void testNullMaskPassword() { public void testNullMaskPassword() {
ConfigurationImpl impl = new ConfigurationImpl(); ConfigurationImpl impl = new ConfigurationImpl();
impl.setMaskPassword(null); impl.setMaskPassword(null);
impl.hashCode();
Assert.assertEquals(impl.hashCode(), impl.hashCode());
} }
@Test @Test

View File

@ -100,7 +100,7 @@
<jboss.logging.version>3.4.2.Final</jboss.logging.version> <jboss.logging.version>3.4.2.Final</jboss.logging.version>
<jetty.version>9.4.43.v20210629</jetty.version> <jetty.version>9.4.43.v20210629</jetty.version>
<jgroups.version>3.6.13.Final</jgroups.version> <jgroups.version>3.6.13.Final</jgroups.version>
<errorprone.version>2.6.0</errorprone.version> <errorprone.version>2.9.0</errorprone.version>
<maven.enforcer.plugin.version>3.0.0-M3</maven.enforcer.plugin.version> <maven.enforcer.plugin.version>3.0.0-M3</maven.enforcer.plugin.version>
<maven.bundle.plugin.version>5.1.2</maven.bundle.plugin.version> <maven.bundle.plugin.version>5.1.2</maven.bundle.plugin.version>
<maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version> <maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version>
@ -1028,10 +1028,10 @@
</build> </build>
</profile> </profile>
<profile> <profile>
<id>jdk16-errorprone</id> <id>jdk16on-errorprone</id>
<!-- TODO: MissingOverride check only warns in this profile for now, as JDK15+ added a toString method to CharSequence --> <!-- TODO: MissingOverride check only warns in this profile for now, as JDK15+ added a toString method to CharSequence -->
<activation> <activation>
<jdk>16</jdk> <jdk>[16,)</jdk>
<property> <property>
<name>errorprone</name> <name>errorprone</name>
</property> </property>

View File

@ -871,7 +871,7 @@ public class BridgeTest extends ActiveMQTestBase {
LinkedListIterator<MessageReference> iterator = queue.iterator(); LinkedListIterator<MessageReference> iterator = queue.iterator();
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
iterator.hasNext(); assertTrue(iterator.hasNext());
ids[i] = iterator.next().getMessage().getMessageID(); ids[i] = iterator.next().getMessage().getMessageID();
} }

View File

@ -1091,7 +1091,7 @@ public class LinkedListTest extends ActiveMQTestBase {
iter.next(); iter.next();
iter.next(); iter.next();
iter.next(); iter.next();
iter.hasNext(); assertTrue(iter.hasNext());
assertEquals(4, iter.next().intValue()); assertEquals(4, iter.next().intValue());
iter.repeat(); iter.repeat();