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

Migrate the Preconditions utility to its own package #515

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

carterkozak
Copy link
Contributor

Before this PR

Previously preconditions reused the same package as safe-logging
API, which is not allowed by the java platform module system.
While this change will impact a lot of code, we can automate the
transition in a relatively straightforward way, and eventually shift
the legacy jar to a runtime dependency to prevent new uses.

After this PR

==COMMIT_MSG==
Migrate the Preconditions utility to its own com.palantir.logsafe.preconditions package
==COMMIT_MSG==

Possible downsides?

Deprecation warnings (or build failures) when this library is upgraded.

Previously preconditions reused the same package as safe-logging
API, which is not allowed by the java platform module system.
While this change will impact a lot of code, we can automate the
transition in a relatively straightforward way, and eventualy shift
the legacy jar to a runtime dependency to prevent new uses.
@changelog-app
Copy link

changelog-app bot commented Jan 26, 2021

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Migrate the Preconditions utility to its own com.palantir.logsafe.preconditions package

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from jkozlowski January 26, 2021 19:00
@carterkozak
Copy link
Contributor Author

Moving the exceptions to their own jar makes it easier to justify adding the SafeUnsupportedOperationException I've always dreamed of...

carterkozak added a commit to palantir/gradle-baseline that referenced this pull request Jan 26, 2021
See palantir/safe-logging#515

This change does two things:
* The existing errorprone checks which reference preconditions
  have been updated to suggest the new package name
* A new `SafeLoggingPreconditionsMigration` check has been added
  to automatically migrate code to the new package when a
  sufficiently new `safe-logging` version is available.
Copy link
Contributor

@jkozlowski jkozlowski left a comment

Choose a reason for hiding this comment

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

Let's gooo. I'm assuming there's no alternative

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