Conversation
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>
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>
There was a problem hiding this comment.
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:jspecifyas acompileOnlydependency 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 |
There was a problem hiding this comment.
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 |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description
Fixed Issue(s)
Thanks for sending a pull request! Have you done the following?
doc-change-requiredlabel to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply./gradlew build./gradlew acceptanceTest./gradlew integrationTest./gradlew ethereum:referenceTests:referenceTests