Run classifier usage checkers on constructor calls

In some cases, REFERENCE_TARGET for annotation entries is the annotation
class descriptor, and in others -- the constructor of that class
This commit is contained in:
Alexander Udalov
2017-12-08 12:00:14 +01:00
parent 8cd7686535
commit 46b8deedf7
4 changed files with 9 additions and 11 deletions
@@ -46,6 +46,9 @@ class JvmModuleAccessibilityChecker(project: Project) : CallChecker {
override fun check(resolvedCall: ResolvedCall<*>, reportOn: PsiElement, context: CallCheckerContext) {
val descriptor = resolvedCall.resultingDescriptor
// Do not check constructors, because the containing class will be checked in [ClassifierUsage]
if (descriptor is ClassConstructorDescriptor) return
// javac seems to check only the containing class of the member being called. Note that it's fine to call, for example,
// members with parameter types or return type from an unexported package
val targetDescriptor = DescriptorUtils.getParentOfType(descriptor, ClassOrPackageFragmentDescriptor::class.java) ?: return