<commit_before>package org.jetbrains.plugins.scala.annotator.template

import org.jetbrains.plugins.scala.annotator.AnnotatorPart
import com.intellij.lang.annotation.AnnotationHolder
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScNewTemplateDefinition
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTemplateDefinition}
import org.jetbrains.plugins.scala.annotator.quickfix.ImplementMethodsQuickFix
import org.jetbrains.plugins.scala.annotator.quickfix.modifiers.AddModifierQuickFix
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.ScModifierListOwner
import org.jetbrains.plugins.scala.overrideImplement.{ScAliasMember, ScalaOIUtil}
import org.jetbrains.plugins.scala.overrideImplement.ScalaOIUtil._

/**
 * <NAME>
 */

object NeedsToBeAbstract extends AnnotatorPart[ScTemplateDefinition] {
  def kind = classOf[ScTemplateDefinition]

  def annotate(definition: ScTemplateDefinition, holder: AnnotationHolder, typeAware: Boolean) {
    if(!typeAware) return

    if (definition.isInstanceOf[ScNewTemplateDefinition]) return

    if (definition.isInstanceOf[ScObject]) return

    if(isAbstract(definition)) return

    val undefined = for {
      member <- toMembers(getMembersToImplement(definition, withOwn = true))
      if !member.isInstanceOf[ScAliasMember] // See SCL-2887
    } yield (member.getText, member.getParentNodeDelegate.getText)

    if(!undefined.isEmpty) {
      val annotation = holder.createErrorAnnotation(definition.nameId,
        message(kindOf(definition), definition.name, undefined(0)))
      definition match {
        case owner: ScModifierListOwner => annotation.registerFix(new AddModifierQuickFix(owner, "abstract"))
        case _ =>
      }
      if(!ScalaOIUtil.getMembersToImplement(definition).isEmpty) {
        annotation.registerFix(new ImplementMethodsQuickFix(definition))
      }
    }
  }

  def message(kind: String, name: String, member: (String, String)) = {
    "%s %s needs to be abstract, since %s".format(kind, name,
      " member %s in %s is not defined".format(member._1, member._2))
  }
}<commit_msg>Consistent error message with Java (about unimplemented things).<commit_after>package org.jetbrains.plugins.scala.annotator.template

import org.jetbrains.plugins.scala.annotator.AnnotatorPart
import com.intellij.lang.annotation.AnnotationHolder
import org.jetbrains.plugins.scala.lang.psi.api.expr.ScNewTemplateDefinition
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.typedef.{ScObject, ScTemplateDefinition}
import org.jetbrains.plugins.scala.annotator.quickfix.ImplementMethodsQuickFix
import org.jetbrains.plugins.scala.annotator.quickfix.modifiers.AddModifierQuickFix
import org.jetbrains.plugins.scala.lang.psi.api.toplevel.ScModifierListOwner
import org.jetbrains.plugins.scala.overrideImplement.{ScAliasMember, ScalaOIUtil}
import org.jetbrains.plugins.scala.overrideImplement.ScalaOIUtil._

/**
 * <NAME>
 */

object NeedsToBeAbstract extends AnnotatorPart[ScTemplateDefinition] {
  def kind = classOf[ScTemplateDefinition]

  def annotate(definition: ScTemplateDefinition, holder: AnnotationHolder, typeAware: Boolean) {
    if(!typeAware) return

    if (definition.isInstanceOf[ScNewTemplateDefinition]) return

    if (definition.isInstanceOf[ScObject]) return

    if(isAbstract(definition)) return

    val undefined = for {
      member <- toMembers(getMembersToImplement(definition, withOwn = true))
      if !member.isInstanceOf[ScAliasMember] // See SCL-2887
    } yield (member.getText, member.getParentNodeDelegate.getText)

    if(!undefined.isEmpty) {
      val annotation = holder.createErrorAnnotation(definition.nameId,
        message(kindOf(definition), definition.name, undefined(0)))
      definition match {
        case owner: ScModifierListOwner => annotation.registerFix(new AddModifierQuickFix(owner, "abstract"))
        case _ =>
      }
      if(!ScalaOIUtil.getMembersToImplement(definition).isEmpty) {
        annotation.registerFix(new ImplementMethodsQuickFix(definition))
      }
    }
  }

  def message(kind: String, name: String, member: (String, String)) = {
    "%s '%s' must either be declared abstract or implement abstract member '%s' in '%s'".format(kind, name, member._1, member._2)
  }
}
{'fraction_non_alphanumeric': 0.10434782608695652, 'fraction_numerical': 0.003290246768507638, 'mean_word_length': 4.952447552447553, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '831839', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1226, 'n_words': 217}