Check annotations on default property getter/setter
This commit is contained in:
@@ -727,12 +727,16 @@ class DeclarationsChecker(
|
||||
}
|
||||
|
||||
private fun checkAccessors(property: KtProperty, propertyDescriptor: PropertyDescriptor) {
|
||||
for (accessor in property.accessors) {
|
||||
val propertyAccessorDescriptor = (if (accessor.isGetter) propertyDescriptor.getter else propertyDescriptor.setter)
|
||||
?: throw AssertionError("No property accessor descriptor for ${property.text}")
|
||||
accessor.checkTypeReferences()
|
||||
modifiersChecker.checkModifiersForDeclaration(accessor, propertyAccessorDescriptor)
|
||||
identifierChecker.checkDeclaration(accessor, trace)
|
||||
for (accessorDescriptor in propertyDescriptor.accessors) {
|
||||
val accessor = if (accessorDescriptor is PropertyGetterDescriptor) property.getter else property.setter
|
||||
if (accessor != null) {
|
||||
accessor.checkTypeReferences()
|
||||
modifiersChecker.checkModifiersForDeclaration(accessor, accessorDescriptor)
|
||||
identifierChecker.checkDeclaration(accessor, trace)
|
||||
}
|
||||
else {
|
||||
modifiersChecker.runDeclarationCheckers(property, accessorDescriptor)
|
||||
}
|
||||
}
|
||||
checkAccessor(propertyDescriptor, property.getter, propertyDescriptor.getter)
|
||||
checkAccessor(propertyDescriptor, property.setter, propertyDescriptor.setter)
|
||||
|
||||
@@ -228,7 +228,10 @@ public class ModifiersChecker {
|
||||
}
|
||||
|
||||
|
||||
private void runDeclarationCheckers(@NotNull KtDeclaration declaration, @NotNull DeclarationDescriptor descriptor) {
|
||||
public void runDeclarationCheckers(
|
||||
@NotNull KtDeclaration declaration,
|
||||
@NotNull DeclarationDescriptor descriptor
|
||||
) {
|
||||
for (DeclarationChecker checker : declarationCheckers) {
|
||||
checker.check(declaration, descriptor, trace, trace.getBindingContext());
|
||||
}
|
||||
|
||||
@@ -18,12 +18,10 @@ package org.jetbrains.kotlin.resolve
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtTypeParameterListOwner
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
object UnderscoreChecker : DeclarationChecker {
|
||||
|
||||
@@ -44,6 +42,7 @@ object UnderscoreChecker : DeclarationChecker {
|
||||
diagnosticHolder: DiagnosticSink,
|
||||
bindingContext: BindingContext
|
||||
) {
|
||||
if (declaration is KtProperty && descriptor !is VariableDescriptor) return
|
||||
if (declaration is KtCallableDeclaration) {
|
||||
for (parameter in declaration.valueParameters) {
|
||||
checkNamed(parameter, diagnosticHolder)
|
||||
|
||||
Reference in New Issue
Block a user