Bug fixes: incorrect keep directive, race condition, and improve logging#88
Merged
eed3si9n merged 4 commits intoeed3si9n:developfrom Jan 20, 2026
Merged
Conversation
…classes. This matches previous jarjar `keep` directive behaviour
Owner
|
Thanks! |
eed3si9n
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr: Fixes a set of bugs we encountered when attempting to update to the latest version internally. Also added some additional logging that was useful when debugging jarjar in Bazel.
1) Incorrect
keepdirectiveAs mentioned in #55, the
keepdirective is not correctly including the transitive deps of a class. Due to the addedreturn false;inKeepProcessor#process, any class that did not explicitly match the keep pattern would be removed from the final jar. This differs from the original expected behavior which collects the final class exclusion via thegetExcludesmethod to be removed after processing rather than during.To fix this, I've removed the
return false. (And for readability, replaced thereturn truein the pattern loop with abreak.2) Race condition
Stacktrace:
The only possible way that the backing map for a HashSet can be null is if it is accessed before its
initupdates themapreference. To fix this, I have simply wrapped the assignment and accesses ofcurrentDependenciesSetusing a Mutex. (This error was surfaced from the logging changes as well.)Let me know if you would like anything changed!