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

Fix IllegalAccessException in MODERN_ASYNC_TASK_EXTRACTOR #1000

Merged
merged 1 commit into from
Jul 12, 2021

Commits on Jul 12, 2021

  1. Fix IllegalAccessException in MODERN_ASYNC_TASK_EXTRACTOR

    Due to Robolectric not instrumenting androidx.* classes by default any more
    (which makes all classes public), the following error started appearing during
    Robolectric tests that use Espresso:
    
        cannot access a member of class androidx.loader.content.ModernAsyncTask
        with modifiers "public static final"
    
    Update `MODERN_ASYNC_TASK_EXTRACTOR` to use `getDeclaredField` and
    `setAccessible(true)` when accessing the final `THREAD_POOL_EXECUTOR` field.
    
    The problem is that ModernAsyncTask is not a public class, it's package
    private. Trying to access members of a package private class outside of the
    package is not allowed (JLS §6.6.1).
    
    PiperOrigin-RevId: 384244512
    hoisie authored and copybara-androidxtest committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    15342dd View commit details
    Browse the repository at this point in the history