Skip to content

Feature/nullaway util#8

Merged
Apisapple merged 8 commits intomainfrom
feature/nullaway-util
Apr 8, 2026
Merged

Feature/nullaway util#8
Apisapple merged 8 commits intomainfrom
feature/nullaway-util

Conversation

@Apisapple
Copy link
Copy Markdown
Owner

PR description

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

Add org.jspecify:jspecify as a compileOnly dependency to util/build.gradle. This brings JSpecify annotations into the module for static nullness/type-checking without introducing a runtime dependency.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Update acceptance tests to call BesuVersionUtils.shortVersion() directly instead of using orElse("unknown"). In StackTraceMatchFilter, mark the Throwable parameter as @nullable and simplify toString() to return stackContains directly. These changes clarify nullability and streamline version usage/representation.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Update Javadoc in util/src/main/java/org/hyperledger/besu/util/BesuVersionUtils.java to use {@value #UNKNOWN} instead of {@value UNKNOWN} in shortVersion() and commit() docs so the UNKNOWN field is referenced correctly. No behavioral changes.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Delete verification-metadata entries for com.uber.nullaway:nullaway:0.12.4 and org.checkerframework:dataflow-nullaway:3.48.0 (their artifact SHA entries were removed). These versions are superseded in the file by nullaway:0.13.1 and dataflow-nullaway:3.53.0, so the stale metadata was cleaned up.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Replace hardcoded "UNKNOWN" literal in regex assertions with BesuVersionUtils.UNKNOWN constant in three unit tests (versionStringIsEthstatsFriendly, noIdentityNodeNameIsEthstatsFriendly, userIdentityNodeNameIsEthstatsFriendly) in BesuVersionUtilsTest. This keeps the tests consistent with the source constant and avoids duplicating the literal value; no behavioral change.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Remove the local BESU_VERSION_UNKNOWN constant and use BesuVersionUtils.UNKNOWN instead. Simplify getRuntimeVersionString() to return BesuVersionUtils.shortVersion() directly, construct VersionMetadata with BesuVersionUtils.UNKNOWN on FileNotFoundException, and compare metadata versions against BesuVersionUtils.UNKNOWN. Centralizes the unknown-version sentinel in BesuVersionUtils.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Update Javadoc for ExceptionUtils.rootCause to state it returns the root cause or {@code null} when the input throwable is {@code null}. This documents the method's existing behavior, which already returns null for a null input.

Signed-off-by: mykim <kimminyong2034@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes “unknown” version handling by reusing BesuVersionUtils.UNKNOWN, tightens nullness annotations in util, and aligns tests/usages with BesuVersionUtils.shortVersion() returning a non-null String.

Changes:

  • Centralize unknown-version sentinel usage via BesuVersionUtils.UNKNOWN (removing ad-hoc "UNKNOWN" constants/handling).
  • Add org.jspecify:jspecify as a compileOnly dependency for util and annotate nullable throwable handling.
  • Update unit/acceptance tests to use the shared sentinel constant and updated shortVersion() API behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
util/src/test/java/org/hyperledger/besu/util/BesuVersionUtilsTest.java Use BesuVersionUtils.UNKNOWN in regex expectations.
util/src/main/java/org/hyperledger/besu/util/log4j/plugin/StackTraceMatchFilter.java Mark throwable input as @Nullable and simplify toString().
util/src/main/java/org/hyperledger/besu/util/ExceptionUtils.java Clarify null-return behavior in Javadoc for rootCause.
util/src/main/java/org/hyperledger/besu/util/BesuVersionUtils.java Javadoc touch-ups and reference #UNKNOWN in {@value ...}.
util/build.gradle Add compileOnly 'org.jspecify:jspecify' for nullness annotations.
gradle/verification-metadata.xml Remove verification entries for older NullAway/dataflow-nullaway versions.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/VersionMetadata.java Remove local unknown constant and rely on BesuVersionUtils.UNKNOWN; remove redundant null check.
acceptance-tests/tests/src/acceptanceTest/java/org/hyperledger/besu/tests/acceptance/plugins/OutdatedPluginTest.java Stop treating shortVersion() as Optional; compare directly to returned string.

*
* @return Besu version in format such as "v23.1.0" or "v23.1.1-dev-ac23d311", or {@value UNKNOWN}
* if not available
* @return Besu version in format such as "v23.1.0" or "v23.1.1-dev-ac23d311", or {@value
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The Javadoc for shortVersion() says the returned version includes a leading "v" (e.g., "v23.1.0"), but the implementation returns the raw manifest Implementation-Version (and other APIs like version() add the "v" prefix themselves). Please update the examples/format in this Javadoc to match the actual output to avoid misleading callers.

Suggested change
* @return Besu version in format such as "v23.1.0" or "v23.1.1-dev-ac23d311", or {@value
* @return Besu version in format such as "23.1.0" or "23.1.1-dev-ac23d311", or {@value

Copilot uses AI. Check for mistakes.
Reformat the long regex in userIdentityNodeNameIsEthstatsFriendly test to improve readability by splitting the string across lines. This is a purely formatting change in util/src/test/java/org/hyperledger/besu/util/BesuVersionUtilsTest.java and does not alter test behavior.

Signed-off-by: mykim <kimminyong2034@gmail.com>
@Apisapple Apisapple merged commit ee34253 into main Apr 8, 2026
23 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants