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

Deployment performance improvement #20262

Merged
merged 1 commit into from
Sep 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ static boolean matches(BeanInfo bean, TypeAndQualifiers typeAndQualifiers) {

static boolean matches(BeanInfo bean, Type requiredType, Set<AnnotationInstance> requiredQualifiers) {
// Bean has all the required qualifiers and a bean type that matches the required type
return hasQualifiers(bean, requiredQualifiers) && matchesType(bean, requiredType);
return matchesType(bean, requiredType) && hasQualifiers(bean, requiredQualifiers);
}

static boolean matchesType(BeanInfo bean, Type requiredType) {
Expand Down Expand Up @@ -682,18 +682,24 @@ static boolean hasQualifier(BeanInfo bean, AnnotationInstance required) {
static boolean hasQualifier(BeanDeployment beanDeployment, AnnotationInstance requiredQualifier,
Collection<AnnotationInstance> qualifiers) {
ClassInfo requiredClazz = beanDeployment.getQualifier(requiredQualifier.name());
List<AnnotationValue> values = new ArrayList<>();
Set<String> nonBindingFields = beanDeployment.getQualifierNonbindingMembers(requiredQualifier.name());
for (AnnotationValue val : requiredQualifier.valuesWithDefaults(beanDeployment.getBeanArchiveIndex())) {
if (!requiredClazz.method(val.name()).hasAnnotation(DotNames.NONBINDING)
&& !nonBindingFields.contains(val.name())) {
values.add(val);
}
}
List<AnnotationValue> values = null;
for (AnnotationInstance qualifier : qualifiers) {
if (requiredQualifier.name().equals(qualifier.name())) {
// Must have the same annotation member value for each member which is not annotated @Nonbinding
boolean matches = true;

if (values == null) {
//this list is relatively expensive to initialize in some cases
//as this is called in a tight loop we only do it if necessary
values = new ArrayList<>();
Set<String> nonBindingFields = beanDeployment.getQualifierNonbindingMembers(requiredQualifier.name());
for (AnnotationValue val : requiredQualifier.valuesWithDefaults(beanDeployment.getBeanArchiveIndex())) {
if (!requiredClazz.method(val.name()).hasAnnotation(DotNames.NONBINDING)
&& !nonBindingFields.contains(val.name())) {
values.add(val);
}
}
}
for (AnnotationValue value : values) {
if (!value.equals(qualifier.valueWithDefault(beanDeployment.getBeanArchiveIndex(), value.name()))) {
matches = false;
Expand Down