Skip to content

ARTEMIS-5534 use Objects.requireNonNullElse() where sensible#5771

Merged
tabish121 merged 1 commit intoapache:mainfrom
jbertram:ARTEMIS-5534
Jun 16, 2025
Merged

ARTEMIS-5534 use Objects.requireNonNullElse() where sensible#5771
tabish121 merged 1 commit intoapache:mainfrom
jbertram:ARTEMIS-5534

Conversation

@jbertram
Copy link
Copy Markdown
Contributor

@jbertram jbertram commented Jun 11, 2025

The code-base is littered with uses of Java's ternary operator to check for null and fallback to a default value. Many of these can be replaced with either Objects.requireNonNullElse or Objects.requireNonNullElseGet. The latter is used where appropriate to essentially match the short-circuit semantics provided by the ternary operator.

@jbertram jbertram force-pushed the ARTEMIS-5534 branch 7 times, most recently from b3c00a2 to 8e7e37e Compare June 12, 2025 19:15
}
}
} catch (Exception e) {
e.printStackTrace();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems like it was added and then forgotten about ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

The code-base is littered with uses of Java's ternary operator to check
for null and fallback to a default value. Many of these can be replaced
with either `Objects.requireNonNullElse` or
`Objects.requireNonNullElseGet`. The latter is used where appropriate
to essentially match the short-circuit semantics provided by the
ternary operator.
@tabish121 tabish121 merged commit a2009d1 into apache:main Jun 16, 2025
6 checks passed
@jbertram jbertram deleted the ARTEMIS-5534 branch July 2, 2025 21:36
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