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

Generalizing MoreTypes.isTypeOf() #1314

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Dec 11, 2023

  1. Generalized MoreTypes.isTypeOf(), added MoreTypes.isExactTypeOf()`

    Previously, `MoreTypes.isTypeOf(Class<?> clazz, TypeMirror type)` checked if the `type` represents the exact same type as the given class.
    
    The shortcomings were:
    1. The hierarchy of types were ignored. For example, if the `type` represents the type of `ArrayList`, then `isTypeOf(Collection.class, type)` will return false.
    2. If the `type` is of `TypeVariable` type, `IllegalArgumentException` is thrown.
    3. If the `type` is of `Wildcard` type, `IllegalArgumentException` is thrown.
    
    The new generalized implementation addresses these shortcomings.
    
    If the previous behavior for checking the exact type is required, `MoreTypes.isExactTypeOf()` can be used.
    AriaAdibi committed Dec 11, 2023
    Configuration menu
    Copy the full SHA
    0626a89 View commit details
    Browse the repository at this point in the history
  2. SuperficialValidation::isTypeOf() --> isExactTypeOf()

    With the generalization of `isTypeOf()`, in `SuperficialValidation` is makes sense to use `isExactTypeOf()` instead.
    AriaAdibi committed Dec 11, 2023
    Configuration menu
    Copy the full SHA
    b7d3232 View commit details
    Browse the repository at this point in the history
  3. Enhances UnitTests for MoreTypes.isTypeOf()

    The `MoreTypesIsTypeOfTest` is enhanced to adapt to the  generalization of `MoreTypes.isTypeOf()`.
    AriaAdibi committed Dec 11, 2023
    Configuration menu
    Copy the full SHA
    90e383e View commit details
    Browse the repository at this point in the history