override fun processMethodInvocation()

in intellij-plugin-verifier/verifier-intellij/src/main/java/com/jetbrains/pluginverifier/usages/internal/BaseInternalApiUsageProcessor.kt [42:72]


  override fun processMethodInvocation(
    methodReference: MethodReference,
    resolvedMethod: Method,
    instructionNode: AbstractInsnNode,
    callerMethod: Method,
    context: VerificationContext
  ) {
    val usageLocation = callerMethod.location
    if (isInternal(resolvedMethod, context, usageLocation)) {
      // Check if the method is an override, and if so check top declaration
      val canBeOverridden = !resolvedMethod.isStatic && !resolvedMethod.isPrivate
        && resolvedMethod.name != "<init>" && resolvedMethod.name != "<clinit>"

      // Taken from MethodOverridingVerifier
      val overriddenMethod = if (canBeOverridden) {
        MethodResolver().resolveMethod(
          ClassFileWithNoMethodsWrapper(resolvedMethod.containingClassFile),
          resolvedMethod.location.toReference(),
          if (resolvedMethod.containingClassFile.isInterface) Instruction.INVOKE_INTERFACE else Instruction.INVOKE_VIRTUAL,
          resolvedMethod,
          VerificationContextWithSilentProblemRegistrar(context)
        )
      } else {
        null
      }

      if (overriddenMethod == null || isInternal(overriddenMethod, context, usageLocation)) {
        internalUsageRegistrar.registerMethod(methodReference, resolvedMethod.location, usageLocation)
      }
    }
  }