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

Unify usage of Optional instances #406

Closed
guillermocalvo opened this issue Aug 24, 2024 · 0 comments · Fixed by #407
Closed

Unify usage of Optional instances #406

guillermocalvo opened this issue Aug 24, 2024 · 0 comments · Fixed by #407
Assignees

Comments

@guillermocalvo
Copy link
Collaborator

While most of the codebase uses japicmp's custom Optional type, some other parts rely on Guava's Optional implementation. This duality is somewhat confusing and may make the code hard to maintain long-term.

Since the minimum supported Java version is 8, I propose to only use Java's Optional type for simplicity. This allows for further improvements in the business logic.

Important

This refactor would be a major change in terms of backward compatibility, because the Optional type is exposed in the API.

These are some of the differences between the Optional types currently being used:

  • Optional.absent() becomes Optional.empty().
  • Optional.fromNullable(T) becomes Optional.ofNullable(T).
  • Optional.or(T) becomes Optional.orElse(T).
  • Guava's Optional type is serializable; the other implementations aren't.
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 a pull request may close this issue.

1 participant