Skip to content

Commit

Permalink
Merge pull request #21652 from Sanne/ArcOpt
Browse files Browse the repository at this point in the history
ArC: simplify Resolvable constructor
  • Loading branch information
geoand authored Nov 24, 2021
2 parents ef7c2c7 + a7e6cf2 commit 48baa69
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 48baa69

Please sign in to comment.