Skip to content
This repository was archived by the owner on Nov 14, 2024. It is now read-only.

Run tests on Java 17 #5753

Closed
wants to merge 19 commits into from
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
build:
docker:
- image: cimg/openjdk:11.0.10-node
- image: cimg/openjdk:17.0.2-node
resource_class: xlarge
environment:
GRADLE_OPTS: -Dorg.gradle.console=plain -Dorg.gradle.internal.launcher.welcomeMessageEnabled=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ public Namespace getNamespace() {
*
* @param srcDir root source directory where code generation is performed.
*/
@SuppressWarnings("DangerousIdentityKey")
public void renderTables(File srcDir) throws IOException {
com.palantir.logsafe.Preconditions.checkNotNull(name, "schema name not set");
com.palantir.logsafe.Preconditions.checkNotNull(packageName, "package name not set");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static <T> T copy(T orig) {
return copy(orig, (is, codebase) -> new ObjectInputStream(is));
}

@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "DangerousJavaDeserialization"})
public static <T> T copy(T orig, ObjectInputStreamFactory factory) {
T obj = null;

Expand Down
1 change: 0 additions & 1 deletion atlasdb-ete-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,3 @@ distribution {
args 'server', 'var/conf/atlasdb-ete.yml'
defaultJvmOpts '-Xmx768M'
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package com.palantir.atlasdb.sweep.queue;

import static com.google.common.base.Preconditions.checkState;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -48,6 +46,7 @@
import com.palantir.atlasdb.sweep.queue.id.SweepTableIndices;
import com.palantir.atlasdb.transaction.impl.TransactionConstants;
import com.palantir.atlasdb.transaction.service.TransactionService;
import com.palantir.logsafe.Preconditions;
import com.palantir.logsafe.SafeArg;
import com.palantir.logsafe.logger.SafeLogger;
import com.palantir.logsafe.logger.SafeLoggerFactory;
Expand Down Expand Up @@ -180,7 +179,8 @@ private DedicatedRows getDedicatedRowsToClear(List<SweepableCellsRow> rows, Time
.filter(row -> {
TargetedSweepMetadata metadata =
TargetedSweepMetadata.BYTES_HYDRATOR.hydrateFromBytes(row.getMetadata());
checkState(metadata.dedicatedRow(), "Row not a dedicated row", SafeArg.of("row", row));
Preconditions.checkState(
metadata.dedicatedRow(), "Row not a dedicated row", SafeArg.of("row", row));
return tsToSweep.timestampsDescending().contains(row.getTimestampPartition());
})
.collect(Collectors.toList()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ private void writeToQuorum(Cell cell, Set<Node> quorumNodes, byte[] value) {
});
}

@SuppressWarnings("DangerousIdentityKey")
private Set<Node> getQuorumNodes() {
return nodes.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(ArrayList::new), list -> {
Collections.shuffle(list);
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
dependencies {
classpath 'com.netflix.nebula:gradle-info-plugin:11.3.3'
classpath 'com.netflix.nebula:nebula-publishing-plugin:18.4.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.53.0'
classpath 'com.palantir.baseline:gradle-baseline-java:4.95.0'
classpath 'com.palantir.gradle.conjure:gradle-conjure:5.22.0'
classpath 'com.palantir.gradle.docker:gradle-docker:0.32.0'
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.11.0'
Expand All @@ -35,6 +35,11 @@ apply plugin: 'com.palantir.git-version'
apply plugin: 'com.palantir.external-publish'
apply plugin: 'com.palantir.baseline-java-versions'

javaVersions {
libraryTarget = 11
runtime = 17
}
Comment on lines +38 to +41
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this to fail if atlasdb still sets javaVersions {... in gradle/versions.gradle.


apply from: 'gradle/versions.gradle'

group = 'com.palantir.atlasdb'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public void finalizeReferent() {

// We maintain hard references to the custom weak references since
// otherwise they themselves can get collected and thus never enqueued.
@SuppressWarnings("DangerousIdentityKey")
private static final Set<MyReference<?>> destructorReferences =
Sets.newSetFromMap(new ConcurrentHashMap<MyReference<?>, Boolean>());

private static final FinalizableReferenceQueue destructorQueue = new FinalizableReferenceQueue();
}
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static byte[] getBlobArray(Object obj) throws IOException {
/**
* Takes a byte array, deserializes it and returns an Object
*/
@SuppressWarnings("BanSerializableRead")
@SuppressWarnings({"BanSerializableRead", "DangerousJavaDeserialization"})
static Object getBlobObject(InputStream stream) throws IOException, ClassNotFoundException {
ObjectInputStream ois = new ObjectInputStream(stream);
Object object = ois.readObject();
Expand Down
1 change: 0 additions & 1 deletion gradle/shared.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ apply plugin: 'com.palantir.external-publish-jar'

apply from: "${rootDir}/gradle/versions.gradle"


version = rootProject.version
group = rootProject.group

Expand Down
4 changes: 0 additions & 4 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,3 @@ ext.libVersions =
ant: '1.9.4',
postgresql: '42.3.3'
]

javaVersions {
libraryTarget = 11
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.UUID;
import java.util.stream.Collectors;

@SuppressWarnings("DangerousIdentityKey")
public class LockLeaseService implements AutoCloseable {
private final NamespacedConjureTimelockService delegate;
private final UUID clientId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private static Set<LockToken> unlock(
return ImmutableSet.copyOf(Sets.union(resultLockTokenShares, resultLockTokens));
}

@SuppressWarnings("DangerousIdentityKey")
static Set<LockTokenShare> filterLockTokenShares(Set<LockToken> tokens) {
return tokens.stream()
.filter(TransactionStarterHelper::isLockTokenShare)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

@SuppressWarnings("DangerousIdentityKey")
public class PaxosRemoteClientsTest {
@Rule
public final TemporaryFolder temporaryFolder = new TemporaryFolder();
Expand Down