Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Java 21 for build and runtime #7177

Merged
merged 15 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ orbs:
executors:
besu_executor_med: # 2cpu, 4G ram
docker:
- image: cimg/openjdk:17.0
- image: cimg/openjdk:21.0
resource_class: medium
working_directory: ~/project
environment:
Expand All @@ -24,7 +24,7 @@ executors:

besu_executor_xl: # 8cpu, 16G ram
docker:
- image: cimg/openjdk:17.0
- image: cimg/openjdk:21.0
resource_class: xlarge
working_directory: ~/project
environment:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: Install required packages
run: sudo apt-get install -y xmlstarlet
- name: setup gradle
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: 17
java-version: 21
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@2f93e4319b2f04a2efc38fa7f78bd681bc3f7b2f
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pre-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand All @@ -65,7 +65,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: Install required packages
run: sudo apt-get install -y xmlstarlet
- name: Setup Gradle
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reference-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: adopt-openj9
java-version: 17
distribution: semeru # IBM Semeru with OpenJ9
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up JDK 17
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
distribution: temurin
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -60,8 +60,8 @@ jobs:
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: adopt
java-version: 17
distribution: temurin
java-version: 21
- name: Download zip
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe
with:
Expand Down Expand Up @@ -108,11 +108,11 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up JDK 17
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
distribution: temurin
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand All @@ -132,7 +132,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: temurin
java-version: 17
java-version: 21
- name: setup gradle
uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1
with:
Expand Down Expand Up @@ -248,8 +248,8 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
distribution: temurin
java-version: 21
cache: gradle
- name: login to ${{ env.registry }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up JDK 17
- name: Set up Java
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
distribution: 'temurin'
java-version: '17'
distribution: temurin
java-version: 21
- name: Cache SonarCloud packages
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Next Release

### Breaking Changes
- Java 21 has been enforced as minimum version to build and run Besu.

### Additions and Improvements
- Add two counters to DefaultBlockchain in order to be able to calculate TPS and Mgas/s [#7105](https://github.com/hyperledger/besu/pull/7105)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class BlockchainServiceImpl implements BlockchainService {
private ProtocolSchedule protocolSchedule;
private MutableBlockchain blockchain;

/** Instantiates a new Blockchain service implementation. */
public BlockchainServiceImpl() {}

/**
* Instantiates a new Blockchain service.
*
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ sonarqube {

project.tasks["sonarqube"].dependsOn "jacocoRootReport"

if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
throw new GradleException("Java 17 or later is required to build Besu.\n" +
if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
throw new GradleException("Java 21 or later is required to build Besu.\n" +
" Detected version ${JavaVersion.current()}")
}

Expand Down Expand Up @@ -125,7 +125,7 @@ allprojects {
version = calculateVersion()

jacoco {
toolVersion = '0.8.8'
toolVersion = '0.8.11'
if (project.tasks.findByName('referenceTests')) {
applyTo referenceTests
}
Expand All @@ -144,8 +144,8 @@ allprojects {
tasks.build {
dependsOn 'javadoc'
}
sourceCompatibility = 17
targetCompatibility = 17
sourceCompatibility = 21
targetCompatibility = 21

repositories {
maven {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
* word, a method like {@link #readLongScalar()} does not expect an encoded value of exactly 8 bytes
* (by opposition to {@link #readLong}), but rather one that is "up to" 8 bytes.
*
* @see BytesValueRLPInput for a {@link RLPInput} that decode an RLP encoded value stored in a
* {@link Bytes}.
* @see BytesValueRLPInput
*/
public interface RLPInput {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,9 @@ public static class Builder {

private Optional<List<VersionedHash>> versionedHashes = Optional.empty();

/** Instantiates a new Builder. */
public Builder() {}

/**
* The "parent" message frame. When present some fields will be populated from the parent and
* ignored if passed in via builder
Expand Down
53 changes: 53 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4746,6 +4746,14 @@
<sha256 value="f1c00e59fb8e446f0710bdc1719e61952f27c1614ae478452c2f0011035322ae" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.agent" version="0.8.11">
<artifact name="org.jacoco.agent-0.8.11.jar">
<sha256 value="d3ed85dea78a9ed55846a7738e3a0ca15c702c661ee4bc8cbfe02a8b9f4a99c0" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.agent-0.8.11.pom">
<sha256 value="16e05e9f49621b87c53e69350140f3c46d42d966c67a933bdf4b063a2b1c8fc5" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.agent" version="0.8.8">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the old jacoco entry be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

done!

<artifact name="org.jacoco.agent-0.8.8.jar">
<sha256 value="072ecbd496896623899a696fff12c01c1615f737616d2792e6d0e10cdf8a610d" origin="Generated by Gradle"/>
Expand All @@ -4754,6 +4762,14 @@
<sha256 value="7dd13c80aff315032983357c650a887d6fdb4c8a8870b207bb4802c49809e7b4" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.ant" version="0.8.11">
<artifact name="org.jacoco.ant-0.8.11.jar">
<sha256 value="81d7eb8890d9be30a939612c295603541063529cdd03a53265aba74474b70b7c" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.ant-0.8.11.pom">
<sha256 value="7ed103d959d0cee7babfb1307fa6e451b1696ffd3527061553b550de55201d85" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.ant" version="0.8.8">
<artifact name="org.jacoco.ant-0.8.8.jar">
<sha256 value="02e33bd2c48dc0be67c2fea84d43beececfd400da6797c58153253d4c30aca15" origin="Generated by Gradle"/>
Expand All @@ -4762,11 +4778,24 @@
<sha256 value="fafff75819609030f4626509313c0861428c2c26c8d36e9a8938334a04478909" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.11">
<artifact name="org.jacoco.build-0.8.11.pom">
<sha256 value="5b84b15cf2eef3e59eb91bc22784833100b09df9911e3319030c3bc648bd8b0b" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.build" version="0.8.8">
<artifact name="org.jacoco.build-0.8.8.pom">
<sha256 value="f4ce0b1285fd24fc6c772f42857298315904dde8fd5677267a0fad5ff9ce2aef" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.11">
<artifact name="org.jacoco.core-0.8.11.jar">
<sha256 value="fcd188c688473fc8dcc0c6caaf355e7b389502243527c33b9597a3ec28791f47" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.core-0.8.11.pom">
<sha256 value="bb6135f10a36349cb84a5600fd8cf73fc1296a135b2f14adcd83de8cf24cabb1" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.core" version="0.8.8">
<artifact name="org.jacoco.core-0.8.8.jar">
<sha256 value="474c782f809d88924713dfdbf0acb79d330f904be576484803463d0465611643" origin="Generated by Gradle"/>
Expand All @@ -4775,6 +4804,14 @@
<sha256 value="f5fab5a48df823b83c0ea35026032368cc9b81800efb257cc7a5928298fee225" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.11">
<artifact name="org.jacoco.report-0.8.11.jar">
<sha256 value="8393295ae24680ed10cad8333907040f928b871332491581ca5bc784e2cb4fbe" origin="Generated by Gradle"/>
</artifact>
<artifact name="org.jacoco.report-0.8.11.pom">
<sha256 value="8e3b734779d5e3fd683ec015413d52f961984c50cb9045fda2b23bff5eb42381" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jacoco" name="org.jacoco.report" version="0.8.8">
<artifact name="org.jacoco.report-0.8.8.jar">
<sha256 value="2c129110f3e3fcaa1f8179578ea3894586199cb0826be5c7790278084c9622a9" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -5637,6 +5674,14 @@
<sha256 value="02824e839f2a2f0e72959fdd30b4897240f05afc43de42d7ba0b18437601c070" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-commons" version="9.6">
<artifact name="asm-commons-9.6.jar">
<sha256 value="7aefd0d5c0901701c69f7513feda765fb6be33af2ce7aa17c5781fc87657c511" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-commons-9.6.pom">
<sha256 value="a98ae4895334baf8ff86bd66516210dbd9a03f1a6e15e47dda82afcf6b53d77c" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-tree" version="9.2">
<artifact name="asm-tree-9.2.jar">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the old asm-tree entry be removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

apparently they are still referenced ....

Copy link
Contributor

Choose a reason for hiding this comment

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

so both versions are being used?

Copy link
Member Author

Choose a reason for hiding this comment

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

looks like it, I removed it and gradle started complaining about missing metadata.

<sha256 value="aabf9bd23091a4ebfc109c1f3ee7cf3e4b89f6ba2d3f51c5243f16b3cffae011" origin="Generated by Gradle"/>
Expand All @@ -5645,6 +5690,14 @@
<sha256 value="f61f3ebea5520ddf19f452b03c426c7231bdd8a81d7ac28765cb5271225ac378" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-tree" version="9.6">
<artifact name="asm-tree-9.6.jar">
<sha256 value="c43ecf17b539c777e15da7b5b86553b377e2d39a683de6285567d5283888e7ef" origin="Generated by Gradle"/>
</artifact>
<artifact name="asm-tree-9.6.pom">
<sha256 value="1bcb481d7fc16b955bb60ca07c8cfa2424bcee78bdc405bba31c7d6f5dc2d113" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.ow2.asm" name="asm-util" version="9.2">
<artifact name="asm-util-9.2.jar">
<sha256 value="ff5b3cd331ae8a9a804768280da98f50f424fef23dd3c788bb320e08c94ee598" origin="Generated by Gradle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class InMemoryTaskQueue<T> implements TaskCollection<T> {
private final Set<InMemoryTask<T>> unfinishedOutstandingTasks = new HashSet<>();
private final AtomicBoolean closed = new AtomicBoolean(false);

/** Default constructor. */
public InMemoryTaskQueue() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there a need for a default constructor here ? it should be implicit or there're changes related to generics in Java 21 that makes them mandatory ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ahamlat Hi Ameziane, We have javadoc lint enabled in our gradle build and fail our build on lint warnings. One of the "lint" warning that has been enabled since Java 19 is to provide javadoc on default constructors.

https://bugs.openjdk.org/browse/JDK-8249634

To avoid adding such empty constructors, we have to disable gradle build failure on javadoc lint warnings.

Copy link
Contributor

Choose a reason for hiding this comment

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

My opinion would to disable gradle build failure on javadoc lint warnings, and not add "dead code", but this is not blocking.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had a look, looks like we have -Werror in java compile task, this seems to apply to javadoc task as well.


@Override
public synchronized void add(final T taskData) {
assertNotClosed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
public class EndianUtils {
// next two methods adopted from:
// https://github.com/bcgit/bc-java/blob/master/core/src/main/java/org/bouncycastle/util/Pack.java
private EndianUtils() {}

/**
* Long to big endian.
Expand Down
2 changes: 2 additions & 0 deletions util/src/main/java/org/hyperledger/besu/util/FutureUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
/** The Future utils. */
public class FutureUtils {

private FutureUtils() {}

/**
* Returns a new CompletionStage that, when the provided stage completes exceptionally, is
* executed with the provided stage's exception as the argument to the supplied function.
Expand Down
Loading
Loading