Skip to content

Avoid printing "Some()" in Server messages #5207

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lolgab
Copy link
Member

@lolgab lolgab commented May 27, 2025

No description provided.

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

USing .orNull when we assume it can't be a null (because we checked above) is a bit misleading. We could use .get and make our assumption explicit. (Which could lead to failure after the next refactoring, though)

The .orNull is probably "safer", but I'd add a comment.

@lolgab
Copy link
Member Author

lolgab commented May 27, 2025

I think we check if they are the same as before, not if they are not null, so we may print null there. I wouldn't comment only because it's a debug print.

@lefou
Copy link
Member

lefou commented May 27, 2025

If the option might be null, lets use .getOrElse("_"). We replace the unset-value with a _. Or use none if you prefer a word.

I wouldn't comment only because it's a debug print.

IMHO, that doesn't matter. The code must be read and understood nevertheless.

@lolgab
Copy link
Member Author

lolgab commented May 27, 2025

If the option might be null, lets use .getOrElse("_"). We replace the unset-value with a _. Or use none if you prefer a word.

Consider we are already printing null for the other argument:

Java version changed (Some(/opt/homebrew/opt/openjdk@17) -> null), re-starting server

@lefou
Copy link
Member

lefou commented May 27, 2025

IMHO, I would fallback to the real used ones on the rhs, e.g. BuildInfo.millVersion and system.

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