From 3bf8356b8d3ce38757eb561fa8e4649d581dc4d3 Mon Sep 17 00:00:00 2001 From: Johno Crawford Date: Sat, 23 Jul 2016 05:11:11 +0200 Subject: [PATCH] Implement List directly instead of extending ArrayList. (#680) * Implement List directly instead of extending ArrayList. * Remove transient dependencies. * Support serialization. --- pom.xml | 21 +++++---------- .../java/com/zaxxer/hikari/util/FastList.java | 26 +++---------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/pom.xml b/pom.xml index d18dbbb9..0cdf58e2 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,6 @@ 2.6.1 1.4 1.4.192 - 1.3 4.12 @@ -101,15 +100,15 @@ org.mockito - mockito-all + mockito-core ${mockito.version} test - - - org.hamcrest - hamcrest-core - ${hamcrest.version} - test + + + org.hamcrest + hamcrest-core + + junit @@ -117,12 +116,6 @@ ${junit.version} test - - org.hamcrest - hamcrest-library - ${hamcrest.version} - test - org.javassist javassist diff --git a/src/main/java/com/zaxxer/hikari/util/FastList.java b/src/main/java/com/zaxxer/hikari/util/FastList.java index 6b6c6dd5..302ed7c4 100644 --- a/src/main/java/com/zaxxer/hikari/util/FastList.java +++ b/src/main/java/com/zaxxer/hikari/util/FastList.java @@ -16,14 +16,15 @@ package com.zaxxer.hikari.util; +import java.io.Serializable; import java.lang.reflect.Array; -import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; +import java.util.RandomAccess; import java.util.Spliterator; import java.util.function.Consumer; import java.util.function.Predicate; @@ -34,7 +35,7 @@ import java.util.function.UnaryOperator; * * @author Brett Wooldridge */ -public final class FastList extends ArrayList +public final class FastList implements List, RandomAccess, Serializable { private static final long serialVersionUID = -4598088075242913858L; @@ -323,20 +324,6 @@ public final class FastList extends ArrayList throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ - @Override - public void trimToSize() - { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - @Override - public void ensureCapacity(int minCapacity) - { - throw new UnsupportedOperationException(); - } - /** {@inheritDoc} */ @Override public Object clone() @@ -344,13 +331,6 @@ public final class FastList extends ArrayList throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ - @Override - protected void removeRange(int fromIndex, int toIndex) - { - throw new UnsupportedOperationException(); - } - /** {@inheritDoc} */ public void forEach(Consumer action) {