From 57daa3e833021dd94728aa730fafa2a957d75387 Mon Sep 17 00:00:00 2001 From: Volodymyr Kravets Date: Wed, 24 Jul 2024 15:16:17 +0300 Subject: [PATCH] chore: add java21 support --- build.gradle | 17 +- gradle/verification-metadata.xml | 395 ++++++++---------- gradle/wrapper/gradle-wrapper.properties | 3 +- .../co/rsk/federate/BtcToRskClientTest.java | 24 +- 4 files changed, 195 insertions(+), 244 deletions(-) diff --git a/build.gradle b/build.gradle index d41ac79cb..3165a444f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ import java.util.jar.JarOutputStream plugins { id 'application' id "jacoco" - id "org.sonarqube" version "2.7.1" + id "org.sonarqube" version "5.1.0.4882" } def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL()) @@ -70,9 +70,10 @@ ext { jacksonDatabindVersion = '2.15.4' typesafeVersion = '1.4.2' logbackVersion = '1.2.11' - junitVersion = '5.8.1' - junitSuiteVersion = '1.9.0' - mockitoVersion = '4.6.1' + junitVersion = '5.10.3' + junitSuiteVersion = '1.10.3' + mockitoInlineVer = '5.2.0' + mockitoJupiterVer = '5.12.0' rskjcoreVersion = '6.4.0-SNAPSHOT' } @@ -95,8 +96,8 @@ dependencies { testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" testImplementation "org.junit.platform:junit-platform-suite:${junitSuiteVersion}" - testImplementation "org.mockito:mockito-inline:${mockitoVersion}" - testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}" + testImplementation "org.mockito:mockito-inline:${mockitoInlineVer}" + testImplementation "org.mockito:mockito-junit-jupiter:${mockitoJupiterVer}" } javadoc { @@ -107,12 +108,12 @@ javadoc { } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } task javadocJar(type: Jar) { - classifier = "javadoc" + archiveClassifier = 'javadoc' from javadoc } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 34ec001dd..891438c14 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -1,5 +1,5 @@ - + true false @@ -69,14 +69,6 @@ - - - - - - - - @@ -807,25 +799,25 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -1086,41 +1078,41 @@ - - - + + + - - + + - - - + + + - - + + - - - + + + - - - + + + - - + + - - - + + + - - + + @@ -1176,6 +1168,14 @@ + + + + + + + + @@ -1192,14 +1192,6 @@ - - - - - - - - @@ -1208,14 +1200,6 @@ - - - - - - - - @@ -1224,127 +1208,97 @@ - - - + + + - - - - - - - + + - - - + + + - - - + + + - - - - + + - - - + + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - + + - - - + + + - - - - - - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + @@ -1371,41 +1325,46 @@ - - - + + + - - + + - - + + + + + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -1429,12 +1388,12 @@ - - - + + + - - + + @@ -1442,12 +1401,9 @@ - - - - - - + + + @@ -1458,12 +1414,12 @@ - - - + + + - - + + @@ -1474,12 +1430,9 @@ - - - - - - + + + @@ -1490,12 +1443,12 @@ - - - + + + - - + + @@ -1506,6 +1459,14 @@ + + + + + + + + @@ -1551,35 +1512,35 @@ - - - + + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + - - + + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fcea..6e3d0903f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ 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-8.6-bin.zip +distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/test/java/co/rsk/federate/BtcToRskClientTest.java b/src/test/java/co/rsk/federate/BtcToRskClientTest.java index 4e4be033f..269f4e345 100644 --- a/src/test/java/co/rsk/federate/BtcToRskClientTest.java +++ b/src/test/java/co/rsk/federate/BtcToRskClientTest.java @@ -485,10 +485,8 @@ void onBlock_without_txs_waiting_for_proofs() throws Exception { Transaction coinbaseTx = getCoinbaseTx(true, witnessRoot, Sha256Hash.ZERO_HASH.getBytes()); Sha256Hash merkleRoot = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(coinbaseTx.getTxId().getReversedBytes(), segwitTx.getTxId().getReversedBytes())); - EnumSet flags = mock(EnumSet.class); - when(flags.contains(any())).thenReturn(false); Block block = new Block(networkParameters, 2L, Sha256Hash.ZERO_HASH, merkleRoot, 0L,0L,0L, Arrays.asList(coinbaseTx, segwitTx)); - block.verifyTransactions(0, flags); + block.verifyTransactions(0, EnumSet.noneOf(Block.VerifyFlag.class)); BtcToRskClientFileData btcToRskClientFileData = new BtcToRskClientFileData(); @@ -511,10 +509,8 @@ void onBlock_including_segwit_tx_registers_coinbase() throws Exception { Transaction coinbaseTx = getCoinbaseTx(true, witnessRoot, Sha256Hash.ZERO_HASH.getBytes()); Sha256Hash merkleRoot = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(coinbaseTx.getTxId().getReversedBytes(), segwitTx.getTxId().getReversedBytes())); - EnumSet flags = mock(EnumSet.class); - when(flags.contains(any())).thenReturn(false); Block block = new Block(networkParameters, 2L, Sha256Hash.ZERO_HASH, merkleRoot, 0L,0L,0L, Arrays.asList(coinbaseTx, segwitTx)); - block.verifyTransactions(0, flags); + block.verifyTransactions(0, EnumSet.noneOf(Block.VerifyFlag.class)); BtcToRskClientFileData btcToRskClientFileData = new BtcToRskClientFileData(); btcToRskClientFileData.getTransactionProofs().put(segwitTx.getWTxId(), new ArrayList<>()); @@ -556,10 +552,8 @@ void onBlock_without_segwit_tx_doesnt_register_coinbase() throws Exception { Transaction coinbaseTx = getCoinbaseTx(true, witnessRoot, Sha256Hash.ZERO_HASH.getBytes()); Sha256Hash merkleRoot = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(coinbaseTx.getTxId().getReversedBytes(), tx.getTxId().getReversedBytes())); - EnumSet flags = mock(EnumSet.class); - when(flags.contains(any())).thenReturn(false); Block block = new Block(networkParameters, 2L, Sha256Hash.ZERO_HASH, merkleRoot, 0L,0L,0L, Arrays.asList(coinbaseTx, tx)); - block.verifyTransactions(0, flags); + block.verifyTransactions(0, EnumSet.noneOf(Block.VerifyFlag.class)); BtcToRskClientFileData btcToRskClientFileData = new BtcToRskClientFileData(); btcToRskClientFileData.getTransactionProofs().put(tx.getWTxId(), new ArrayList<>()); @@ -583,10 +577,8 @@ void onBlock_coinbase_invalid_witness_reserved_value() throws Exception { Transaction coinbaseTx = getCoinbaseTx(true, witnessRoot, new byte[]{1,2,3}); Sha256Hash merkleRoot = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(coinbaseTx.getTxId().getReversedBytes(), segwitTx.getTxId().getReversedBytes())); - EnumSet flags = mock(EnumSet.class); - when(flags.contains(any())).thenReturn(false); Block block = new Block(networkParameters, 2L, Sha256Hash.ZERO_HASH, merkleRoot, 0L,0L,0L, Arrays.asList(coinbaseTx, segwitTx)); - block.verifyTransactions(0, flags); + block.verifyTransactions(0, EnumSet.noneOf(Block.VerifyFlag.class)); BtcToRskClientFileData btcToRskClientFileData = new BtcToRskClientFileData(); btcToRskClientFileData.getTransactionProofs().put(segwitTx.getWTxId(), new ArrayList<>()); @@ -610,10 +602,8 @@ void onBlock_including_segwit_tx_coinbase_without_witness() throws Exception { Transaction coinbaseTx = getCoinbaseTx(false, witnessRoot, Sha256Hash.ZERO_HASH.getBytes()); Sha256Hash merkleRoot = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(coinbaseTx.getTxId().getReversedBytes(), segwitTx.getTxId().getReversedBytes())); - EnumSet flags = mock(EnumSet.class); - when(flags.contains(any())).thenReturn(false); Block block = new Block(networkParameters, 2L, Sha256Hash.ZERO_HASH, merkleRoot, 0L,0L,0L, Arrays.asList(coinbaseTx, segwitTx)); - block.verifyTransactions(0, flags); + block.verifyTransactions(0, EnumSet.noneOf(Block.VerifyFlag.class)); BtcToRskClientFileData btcToRskClientFileData = new BtcToRskClientFileData(); btcToRskClientFileData.getTransactionProofs().put(segwitTx.getWTxId(), new ArrayList<>()); @@ -637,10 +627,8 @@ void onBlock_including_segwit_tx_coinbase_witness_commitment_doesnt_match() thro Transaction coinbaseTx = getCoinbaseTx(true, witnessRoot, Sha256Hash.ZERO_HASH.getBytes(), Sha256Hash.of(new byte[]{6,6,6}).getBytes()); Sha256Hash merkleRoot = Sha256Hash.wrapReversed(Sha256Hash.hashTwice(coinbaseTx.getTxId().getReversedBytes(), segwitTx.getTxId().getReversedBytes())); - EnumSet flags = mock(EnumSet.class); - when(flags.contains(any())).thenReturn(false); Block block = new Block(networkParameters, 2L, Sha256Hash.ZERO_HASH, merkleRoot, 0L,0L,0L, Arrays.asList(coinbaseTx, segwitTx)); - block.verifyTransactions(0, flags); + block.verifyTransactions(0, EnumSet.noneOf(Block.VerifyFlag.class)); BtcToRskClientFileData btcToRskClientFileData = new BtcToRskClientFileData(); btcToRskClientFileData.getTransactionProofs().put(segwitTx.getWTxId(), new ArrayList<>());