Skip to content

feat: added sealed keyword#3

Open
opensourcevk wants to merge 1 commit intoMastercard:mainfrom
opensourcevk:main
Open

feat: added sealed keyword#3
opensourcevk wants to merge 1 commit intoMastercard:mainfrom
opensourcevk:main

Conversation

@opensourcevk
Copy link
Contributor

  1. DPoPKeyProvider.java (core/dpop/)

    • Converted DPoPKeyProvider interface to a sealed interface
    • Permits: StaticDPoPKeyProvider
    • Purpose: Restricts DPoP key provider implementations to explicitly permitted classes
  2. AccessTokenStore.java (core/access_token/)

    • Converted AccessTokenStore interface to a sealed interface
    • Permits: InMemoryAccessTokenStore
    • Purpose: Restricts access token storage implementations to explicitly permitted classes

@jaaufauvre
Copy link
Member

jaaufauvre commented Mar 10, 2026

Thanks for the contribution.

I understand the intent of restricting implementations but converting interfaces to sealed interfaces breaks the library's public extension points (see README.md). Existing code that implements these interfaces will fail to compile after this change.

Also, please ensure all tests are passing before pushing changes:

Mockito cannot mock this class: interface com.mastercard.developer.oauth2.core.access_token.AccessTokenStore.
Sealed interfaces or abstract classes can't be mocked. Interfaces cannot be instantiated and cannot be subclassed for mocking purposes.

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 this pull request may close these issues.

2 participants