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: Swap arguments of isAssignableFrom #872

Merged
merged 3 commits into from
Apr 28, 2021

Conversation

aababilov
Copy link
Collaborator

Consider we want to inject a ChildCurrentDateTime class. This assignment
is invalid:

ChildCurrentDateTime param = new CurrentDateTime();

It may be only the other way:

CurrentDateTime param = new ChildCurrentDateTime();

See also the valid implementation:

  private static boolean isInjectableFromContext(Class<?> parameterType) {
    return parameterType.isAssignableFrom(CurrentDateTime.class)
        || parameterType.isAssignableFrom(CountryCode.class);
  }

Consider we want to inject a ChildCurrentDateTime class. This assignment
is invalid:

  ChildCurrentDateTime param = new CurrentDateTime();

It may be only the other way:

  CurrentDateTime param = new ChildCurrentDateTime();

See also the valid implementation:

```
  private static boolean isInjectableFromContext(Class<?> parameterType) {
    return parameterType.isAssignableFrom(CurrentDateTime.class)
        || parameterType.isAssignableFrom(CountryCode.class);
  }
```
Copy link
Member

@barbeau barbeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@barbeau barbeau merged commit cf62243 into MobilityData:master Apr 28, 2021
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.

None yet

2 participants