Skip to content

Concrete references to com.google.re2j.* classes means re2j is non-optional or the android r8 shrinker throws an error #2459

@mikehardy

Description

@mikehardy

( 👋 originally posted directly as a comment on the PR so that it could be tied directly with a click to the code referenced - ideally as a help for maintainer(s) - thank you for jsoup, we appreciate the library!)


This was discovered while attempting to adopt the new jsoup version in the AnkiDroid project, where we have at a non-trivial development cost implemented "release mode" emulator testing after having shrinker errors in the past. It surfaced the problem

ankidroid/Anki-Android#19985
https://github.com/ankidroid/Anki-Android/actions/runs/20636686551/job/59315193515#step:8:298

An initial attempt to solve the issue was made by simply adding the observationally-non-optional re2j transitive but that is unsatisfactory as we have also implemented an APK size comparison tool to see the impact of such changes, and re2j appears to add approximately 70 kilobytes to our APK size. That is not huge but is best avoided for something that is in our use case not going to result in a user-perceivable benefit

Can this intended-to-be-optional transitive be made actually optional here? Perhaps through reflective usage in the Re2jRegex helper similar to the "has re2j" detection elsewhere?

Thanks!

Originally posted by @mikehardy in #2407

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedAn {bug|improvement} that has been {fixed|implemented}

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions