Skip to content

Commit

Permalink
ArC: simplify Resolvable constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed Nov 23, 2021
1 parent 32c7ae2 commit a7e6cf2
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -844,18 +844,17 @@ private void requireRunning() {

private static final class Resolvable {

private static final Set<Type> BUILT_IN_TYPES = Set.of(Event.class, Instance.class);
private static final Annotation[] ANY_QUALIFIER = { Any.Literal.INSTANCE };

final Type requiredType;

final Annotation[] qualifiers;

Resolvable(Type requiredType, Annotation[] qualifiers) {
// if the type is any of BUILT_IN_TYPES, the resolution simplifies type to raw type and ignores qualifiers
// if the type is Event or Instance (the built-in types), the resolution simplifies type to raw type and ignores qualifiers
// this is so that every injection point matches the bean we provide for that type
Type rawType = Reflections.getRawType(requiredType);
if (BUILT_IN_TYPES.contains(rawType)) {
if (Event.class.equals(rawType) || Instance.class.equals(rawType)) {
this.requiredType = rawType;
this.qualifiers = ANY_QUALIFIER;
} else {
Expand Down

0 comments on commit a7e6cf2

Please sign in to comment.