Skip to content

Implement Pair, UserHandle, and Color resolvers #79

Closed

Description

@MessiasLima

Description

Add resolvers for android.util.Pair, android.os.UserHandle, and android.graphics.Color. Each resolver lives in dev.appoutlet.some.android.resolver.

  • Scope and constraints

    • PairResolver — Pair(first, second) where first and second are resolved by delegating to the chain for generic type arguments. Constructor receives random: Random only; type args are extracted from KType.arguments in resolve().
    • UserHandleResolver — guarded by Build.VERSION.SDK_INT >= 24; generates via UserHandle.of(uid) with random non-system UID (≥ 10000). Falls back to null on API < 24. Constructor receives random: Random only.
    • ColorResolver (for android.graphics.Color) — guarded by Build.VERSION.SDK_INT >= 26; generates via Color.valueOf(red, green, blue) with randomized RGB values. Falls back to null on API < 26. Constructor receives random: Random only.
    • Each canResolve() uses exact type matching via typeOf<T>().
    • Each resolver has its own JVM unit test class. UserHandle and Color tests verify type matching and API-level guard logic. Pair tests verify both generic args are resolved via chain delegation.
    • Follows the same patterns as simple resolvers from :core.
  • References

Scope

In scope: 3 resolver classes + 3 test classes.
Out of scope: Account and Location (handled by existing ClassResolver), registering resolvers in AndroidTypeResolverProvider (ticket #14).

Acceptance criteria

  • PairResolver generates pairs where first and second are resolved via chain delegation for generic type args
  • UserHandleResolver generates a UserHandle when Build.VERSION.SDK_INT >= 24, returns null otherwise
  • ColorResolver generates an android.graphics.Color when Build.VERSION.SDK_INT >= 26, returns null otherwise
  • Each resolver's canResolve returns true for its own type and false for other types
  • All tests compile against android.jar and run as plain JVM unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions