diff --git a/common/src/test/java/io/druid/collections/ReferenceCountingResourceHolderTest.java b/common/src/test/java/io/druid/collections/ReferenceCountingResourceHolderTest.java index ba73fe6cd16..087860e1724 100644 --- a/common/src/test/java/io/druid/collections/ReferenceCountingResourceHolderTest.java +++ b/common/src/test/java/io/druid/collections/ReferenceCountingResourceHolderTest.java @@ -91,12 +91,6 @@ public class ReferenceCountingResourceHolderTest @Test(timeout = 60_000) public void testResourceHandlerClearedByJVM() throws InterruptedException { - if (System.getProperty("java.version").startsWith("1.7")) { - // This test is unreliable on Java 7, probably GC is not triggered by System.gc(). It is not a problem because - // this test should ever pass on any version of Java to prove that ReferenceCountingResourceHolder doesn't - // introduce leaks itself and actually cleans the leaked resources. - return; - } long initialLeakedResources = ReferenceCountingResourceHolder.leakedResources(); final AtomicBoolean released = new AtomicBoolean(false); makeReleasingHandler(released); // Don't store the handler in a variable and don't close it, the object leaked @@ -106,12 +100,6 @@ public class ReferenceCountingResourceHolderTest @Test(timeout = 60_000) public void testResourceHandlerWithReleaserClearedByJVM() throws InterruptedException { - if (System.getProperty("java.version").startsWith("1.7")) { - // This test is unreliable on Java 7, probably GC is not triggered by System.gc(). It is not a problem because - // this test should ever pass on any version of Java to prove that ReferenceCountingResourceHolder doesn't - // introduce leaks itself and actually cleans the leaked resources. - return; - } long initialLeakedResources = ReferenceCountingResourceHolder.leakedResources(); final AtomicBoolean released = new AtomicBoolean(false); // createDanglingReleaser() need to be a separate method because otherwise JVM preserves a ref to Holder on stack diff --git a/common/src/test/java/io/druid/collections/StupidPoolTest.java b/common/src/test/java/io/druid/collections/StupidPoolTest.java index 7d3eedd0846..df31c7afb8c 100644 --- a/common/src/test/java/io/druid/collections/StupidPoolTest.java +++ b/common/src/test/java/io/druid/collections/StupidPoolTest.java @@ -73,12 +73,6 @@ public class StupidPoolTest @Test(timeout = 60_000) public void testResourceHandlerClearedByJVM() throws InterruptedException { - if (System.getProperty("java.version").startsWith("1.7")) { - // This test is unreliable on Java 7, probably GC is not triggered by System.gc(). It is not a problem because - // this test should ever pass on any version of Java to prove that StupidPool doesn't introduce leaks itself and - // actually cleans the leaked objects. - return; - } String leakedString = createDanglingObjectHandler(); // Wait until dangling object string is returned to the pool for (int i = 0; i < 6000 && poolOfString.leakedObjectsCount() == 0; i++) { diff --git a/extensions-core/caffeine-cache/pom.xml b/extensions-core/caffeine-cache/pom.xml index 3370b09b359..12fbe0f0f82 100644 --- a/extensions-core/caffeine-cache/pom.xml +++ b/extensions-core/caffeine-cache/pom.xml @@ -65,38 +65,4 @@ test - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - - - - check-java-api - test - - check - - - - org.codehaus.mojo.signature - - java18 - 1.0 - - - - - - - diff --git a/pom.xml b/pom.xml index a8bbdff1350..cb7cdf700e4 100644 --- a/pom.xml +++ b/pom.xml @@ -647,7 +647,7 @@ org.easymock easymock - 3.3 + 3.4 test @@ -811,7 +811,7 @@ org.codehaus.mojo.signature - java17 + java18 1.0 @@ -977,6 +977,14 @@ true + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + diff --git a/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryTest.java b/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryTest.java index 7740712500b..1c332fb23dc 100644 --- a/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryTest.java +++ b/processing/src/test/java/io/druid/query/timeboundary/TimeBoundaryQueryTest.java @@ -78,7 +78,7 @@ public class TimeBoundaryQueryTest ); - Assert.assertEquals(1, serdeQuery.getContextValue("priority")); + Assert.assertEquals(new Integer(1), serdeQuery.getContextValue("priority")); Assert.assertEquals(true, serdeQuery.getContextValue("useCache")); Assert.assertEquals(true, serdeQuery.getContextValue("populateCache")); Assert.assertEquals(true, serdeQuery.getContextValue("finalize")); diff --git a/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java b/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java index bba412f58bc..a7e7b98cf42 100644 --- a/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java +++ b/processing/src/test/java/io/druid/segment/serde/LargeColumnSupportedComplexColumnSerializerTest.java @@ -56,35 +56,33 @@ public class LargeColumnSupportedComplexColumnSerializerTest 2500 * Longs.BYTES }; - for (int k = 0; k < columnSizes.length; k++) { - for (int j = 0; j < cases.length; j++) { - IOPeon peon = new TmpFileIOPeon(); + for (int columnSize : columnSizes) { + for (int aCase : cases) { File tmpFile = FileUtils.getTempDirectory(); - final FileSmoosher v9Smoosher = new FileSmoosher(tmpFile); - - LargeColumnSupportedComplexColumnSerializer serializer = LargeColumnSupportedComplexColumnSerializer - .createWithColumnSize(peon, "test", serde.getObjectStrategy(), columnSizes[k]); HyperLogLogCollector baseCollector = HyperLogLogCollector.makeLatestCollector(); + try (IOPeon peon = new TmpFileIOPeon(); + FileSmoosher v9Smoosher = new FileSmoosher(tmpFile)) { - serializer.open(); - for (int i = 0; i < cases[j]; i++) { - HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); - byte[] hashBytes = fn.hashLong(i).asBytes(); - collector.add(hashBytes); - baseCollector.fold(collector); - serializer.serialize(collector); + LargeColumnSupportedComplexColumnSerializer serializer = LargeColumnSupportedComplexColumnSerializer + .createWithColumnSize(peon, "test", serde.getObjectStrategy(), columnSize); + + serializer.open(); + for (int i = 0; i < aCase; i++) { + HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); + byte[] hashBytes = fn.hashLong(i).asBytes(); + collector.add(hashBytes); + baseCollector.fold(collector); + serializer.serialize(collector); + } + serializer.close(); + + try (final SmooshedWriter channel = v9Smoosher.addWithSmooshedWriter( + "test", + serializer.getSerializedSize() + )) { + serializer.writeToChannel(channel, v9Smoosher); + } } - serializer.close(); - - final SmooshedWriter channel = v9Smoosher.addWithSmooshedWriter( - "test", - serializer.getSerializedSize() - ); - serializer.writeToChannel(channel, v9Smoosher); - - channel.close(); - peon.close(); - v9Smoosher.close(); SmooshedFileMapper mapper = Smoosh.map(tmpFile); final ColumnBuilder builder = new ColumnBuilder() @@ -97,7 +95,7 @@ public class LargeColumnSupportedComplexColumnSerializerTest ComplexColumn complexColumn = column.getComplexColumn(); HyperLogLogCollector collector = HyperLogLogCollector.makeLatestCollector(); - for (int i = 0; i < cases[j]; i++) { + for (int i = 0; i < aCase; i++) { collector.fold((HyperLogLogCollector) complexColumn.getRowValue(i)); } Assert.assertEquals(baseCollector.estimateCardinality(), collector.estimateCardinality(), 0.0); diff --git a/server/src/test/java/io/druid/client/CachingClusteredClientTest.java b/server/src/test/java/io/druid/client/CachingClusteredClientTest.java index 6cd7dcfa774..b81f1ee1b9a 100644 --- a/server/src/test/java/io/druid/client/CachingClusteredClientTest.java +++ b/server/src/test/java/io/druid/client/CachingClusteredClientTest.java @@ -395,7 +395,7 @@ public class CachingClusteredClientTest } return task instanceof Callable ? delegate.submit((Callable) task) : - delegate.submit((Runnable) task); + (ListenableFuture) delegate.submit((Runnable) task); } @Override diff --git a/server/src/test/java/io/druid/client/cache/MemcacheClientPoolTest.java b/server/src/test/java/io/druid/client/cache/MemcacheClientPoolTest.java index 0ce83617a33..022bc319d97 100644 --- a/server/src/test/java/io/druid/client/cache/MemcacheClientPoolTest.java +++ b/server/src/test/java/io/druid/client/cache/MemcacheClientPoolTest.java @@ -57,12 +57,6 @@ public class MemcacheClientPoolTest @Test public void testClientLeakDetected() throws InterruptedException { - if (System.getProperty("java.version").startsWith("1.7")) { - // This test is unreliable on Java 7, probably GC is not triggered by System.gc(). It is not a problem because - // this test should ever pass on any version of Java to prove that MemcacheClientPool doesn't introduce leaks - // itself. - return; - } long initialLeakedClients = MemcacheClientPool.leakedClients(); createDanglingClient(); // Wait until Closer runs