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

acceptable jakarta versions are erroneously replaced #25

Closed
bjlaub opened this issue Feb 8, 2023 · 0 comments · Fixed by #26
Closed

acceptable jakarta versions are erroneously replaced #25

bjlaub opened this issue Feb 8, 2023 · 0 comments · Fixed by #26

Comments

@bjlaub
Copy link
Contributor

bjlaub commented Feb 8, 2023

It is possible for an acceptable version of a Jakarta lib (e.g. one with a version that already uses the jakarta namespace) to erroneously be replaced if a known "bad" version also exists on the classpath.

Consider:

dependencies {
    implementation "org:foo"
    implementation "jakarta.ws.rs:jakarta.ws.rs-api"
}

with a versions.props that reads:

org:foo = 1.0.0
jakarta.ws.rs:jakarta.ws.rs-api = 3.1.0

If org:foo:1.0.0 contains a dependency on jakarta.ws.rs:jakarta.ws.rs-api:2.1.6, we incorrectly also substitute jakarta.ws.rs:jakarta.ws.rs-api:3.1.0 with javax.ws.rs:javax.ws.rs-api:2.1.1, which is likely to cause a compile failure if e.g. this project uses classes from the jakarta namespace (which is completely valid.

bjlaub pushed a commit that referenced this issue Feb 8, 2023
It is possible that JakartaPackageAlignmentPlugin will call
getReplacement with an empty string for the version. Previously, this
code would erroneously return a replacement version because the
comparator for ComparableVersion returns -1 when an empty string is
compared with the maximum Jakarta version.

To address that, only look for a replacement when the version is
non-null and non-empty.

Fixes #25
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