Resolve annotation arguments only once
This commit is contained in:
@@ -223,11 +223,17 @@ public class AnnotationResolver {
|
||||
return;
|
||||
}
|
||||
|
||||
AnnotationDescriptorImpl annotationDescriptorImpl = (AnnotationDescriptorImpl) annotationDescriptor;
|
||||
if (annotationDescriptorImpl.areValueArgumentsResolved()) return;
|
||||
|
||||
OverloadResolutionResults<FunctionDescriptor> results = resolveAnnotationCall(annotationEntry, scope, trace);
|
||||
if (results.isSingleResult()) {
|
||||
checkAnnotationType(annotationEntry, trace, results);
|
||||
resolveAnnotationArguments(annotationDescriptor, results.getResultingCall(), trace);
|
||||
}
|
||||
else {
|
||||
annotationDescriptorImpl.markValueArgumentsResolved();
|
||||
}
|
||||
}
|
||||
|
||||
public static void resolveAnnotationArguments(
|
||||
@@ -240,15 +246,19 @@ public class AnnotationResolver {
|
||||
return;
|
||||
}
|
||||
|
||||
AnnotationDescriptorImpl annotationDescriptorImpl = (AnnotationDescriptorImpl) annotationDescriptor;
|
||||
|
||||
for (Map.Entry<ValueParameterDescriptor, ResolvedValueArgument> descriptorToArgument : resolvedCall.getValueArguments().entrySet()) {
|
||||
ValueParameterDescriptor parameterDescriptor = descriptorToArgument.getKey();
|
||||
ResolvedValueArgument resolvedArgument = descriptorToArgument.getValue();
|
||||
|
||||
CompileTimeConstant<?> value = getAnnotationArgumentValue(trace, parameterDescriptor, resolvedArgument);
|
||||
if (value != null) {
|
||||
((AnnotationDescriptorImpl) annotationDescriptor).setValueArgument(parameterDescriptor, value);
|
||||
annotationDescriptorImpl.setValueArgument(parameterDescriptor, value);
|
||||
}
|
||||
}
|
||||
|
||||
annotationDescriptorImpl.markValueArgumentsResolved();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user