Refactoring: CallableMemberDescriptor.isOverridable
This commit is contained in:
@@ -612,7 +612,7 @@ public class KotlinFlowInformationProvider {
|
||||
FunctionDescriptor functionDescriptor = (FunctionDescriptor) descriptor;
|
||||
String functionName = functionDescriptor.getName().asString();
|
||||
if (isMain
|
||||
|| functionDescriptor.getModality().isOverridable()
|
||||
|| ModalityKt.isOverridable(functionDescriptor)
|
||||
|| !functionDescriptor.getOverriddenDescriptors().isEmpty()
|
||||
|| "getValue".equals(functionName) || "setValue".equals(functionName)
|
||||
|| "propertyDelegated".equals(functionName)
|
||||
|
||||
@@ -84,7 +84,7 @@ class DelegationResolver<T : CallableMemberDescriptor> private constructor(
|
||||
memberExtractor.getMembersByType(it)
|
||||
} ?: emptyList<CallableMemberDescriptor>()
|
||||
return memberExtractor.getMembersByType(interfaceType).filter { descriptor ->
|
||||
descriptor.modality.isOverridable && !classSupertypeMembers.any { isOverridableBy(it, descriptor) }
|
||||
descriptor.isOverridable && !classSupertypeMembers.any { isOverridableBy(it, descriptor) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -884,7 +884,7 @@ public class OverrideResolver {
|
||||
for (CallableMemberDescriptor overridden : overriddenDescriptors) {
|
||||
if (overridden == null) continue;
|
||||
|
||||
if (!overridden.getModality().isOverridable()) {
|
||||
if (!ModalityKt.isOverridable(overridden)) {
|
||||
reportError.overridingFinalMember(memberDescriptor, overridden);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -447,10 +447,10 @@ public class DataFlowValueFactory {
|
||||
DeclarationDescriptor containingDeclaration = propertyDescriptor.getContainingDeclaration();
|
||||
if (containingDeclaration instanceof ClassDescriptor) {
|
||||
ClassDescriptor classDescriptor = (ClassDescriptor) containingDeclaration;
|
||||
if (classDescriptor.getModality().isOverridable() && propertyDescriptor.getModality().isOverridable()) return false;
|
||||
if (classDescriptor.getModality().isOverridable() && ModalityKt.isOverridable(propertyDescriptor)) return false;
|
||||
}
|
||||
else {
|
||||
if (propertyDescriptor.getModality().isOverridable()) {
|
||||
if (ModalityKt.isOverridable(propertyDescriptor)) {
|
||||
throw new IllegalStateException("Property outside a class must not be overridable: " + propertyDescriptor.getName());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -531,7 +531,7 @@ private class ConstantExpressionEvaluatorVisitor(
|
||||
if (resolvedCall != null) {
|
||||
val callableDescriptor = resolvedCall.resultingDescriptor
|
||||
if (callableDescriptor is VariableDescriptor) {
|
||||
if (callableDescriptor is PropertyDescriptor && callableDescriptor.modality.isOverridable) return null
|
||||
if (callableDescriptor is PropertyDescriptor && callableDescriptor.isOverridable) return null
|
||||
|
||||
val variableInitializer = callableDescriptor.compileTimeInitializer ?: return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user