override fun verify()

in intellij-plugin-verifier/verifier-core/src/main/java/com/jetbrains/pluginverifier/verifiers/clazz/AbstractMethodVerifier.kt [15:48]


  override fun verify(classFile: ClassFile, context: VerificationContext) {
    if (classFile.isAbstract || classFile.isInterface) return

    val abstractMethods = hashMapOf<MethodSignature, MethodLocation>()
    val implementedMethods = hashMapOf<MethodSignature, MethodLocation>()
    var hasUnresolvedParents = false

    val parentsVisitor = ClassParentsVisitor(true) { subclassFile, superName ->
      val parentFile = context.classResolver.resolveClassChecked(superName, subclassFile, context)
      hasUnresolvedParents = hasUnresolvedParents || parentFile == null
      parentFile
    }

    parentsVisitor.visitClass(classFile, true, onEnter = { parent ->
      parent.methods.forEach { method ->
        if (!method.isPrivate && !method.isStatic) {
          val methodSignature = MethodSignature(method.name, method.descriptor)
          if (method.isAbstract) {
            abstractMethods[methodSignature] = method.location
          } else {
            implementedMethods[methodSignature] = method.location
          }
        }
      }
      true
    })

    if (!hasUnresolvedParents) {
      (abstractMethods.keys - implementedMethods.keys).forEach { method ->
        val abstractMethod = abstractMethods[method]!!
        context.problemRegistrar.registerProblem(MethodNotImplementedProblem(abstractMethod, classFile.location))
      }
    }
  }