Don't forget to resolve annotations from constructor parameter

#KT-12245 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-03-28 12:53:40 +03:00
parent c9b468581a
commit 682fe9e9ca
9 changed files with 103 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -618,6 +618,17 @@ public class BodyResolver {
valueParameterResolver.resolveValueParameters(klass.getPrimaryConstructorParameters(),
unsubstitutedPrimaryConstructor.getValueParameters(),
parameterScope, c.getOuterDataFlowInfo(), trace);
// Annotations on value parameter and constructor parameter could be splitted
resolveConstructorPropertyDescriptors(klass);
}
}
}
private void resolveConstructorPropertyDescriptors(KtClassOrObject ktClassOrObject) {
for (KtParameter parameter : ktClassOrObject.getPrimaryConstructorParameters()) {
PropertyDescriptor descriptor = trace.getBindingContext().get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter);
if (descriptor != null) {
ForceResolveUtil.forceResolveAllContents(descriptor.getAnnotations());
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.