<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.overrideImplement.{ScAliasMember, ScalaOIUtil}

/**
 * <NAME>
 */

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

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

    val isNew = definition.isInstanceOf[ScNewTemplateDefinition]
    val isObject = definition.isInstanceOf[ScObject]

    if (!isNew && !isObject) return

    val refs = definition.refs

    val hasBody = definition.extendsBlock.templateBody.isDefined
    val hasAbstract = refs.flatMap(_._2.toSeq).exists(t => isAbstract(t._1))

    if(hasAbstract) {
      refs.headOption.foreach {
        case (refElement, Some(psiClass)) => {
          import ScalaOIUtil._

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

          if(undefined.nonEmpty) {
            val element = if(isNew) refElement else definition.asInstanceOf[ScObject].nameId
            val annotation = holder.createErrorAnnotation(element, message(undefined: _*))
            annotation.registerFix(new ImplementMethodsQuickFix(definition))
          }
        }
        case _ =>
      }
    }
  }

  def message(members: (String, String)*) = {
    "Object creation impossible, since %s".format(
      members.map(p => " member %s in %s is not defined".format(p._1, p._2)).mkString("; "))
  }
}
<commit_msg>Diagnostic for IAE<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.overrideImplement.{ScAliasMember, ScalaOIUtil}
import com.intellij.codeInsight.generation.{PsiElementClassMember, ClassMemberWithElement}

/**
 * <NAME>
 */

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

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

    val isNew = definition.isInstanceOf[ScNewTemplateDefinition]
    val isObject = definition.isInstanceOf[ScObject]

    if (!isNew && !isObject) return

    val refs = definition.refs

    val hasAbstract = refs.flatMap(_._2.toSeq).exists(t => isAbstract(t._1))

    if(hasAbstract) {
      refs.headOption.foreach {
        case (refElement, Some(psiClass)) => {
          import ScalaOIUtil._

          val undefined = for {
            member <- toMembers(getMembersToImplement(definition))
            if !member.isInstanceOf[ScAliasMember] // See SCL-2887
          } yield {
            try {
              (member.getText, member.getParentNodeDelegate.getText)
            } catch {
              case iae: IllegalArgumentException =>
                throw new RuntimeException("memer: " + member.getText, iae)
            }
          }

          if(undefined.nonEmpty) {
            val element = if(isNew) refElement else definition.asInstanceOf[ScObject].nameId
            val annotation = holder.createErrorAnnotation(element, message(undefined: _*))
            annotation.registerFix(new ImplementMethodsQuickFix(definition))
          }
        }
        case _ =>
      }
    }
  }

  def message(members: (String, String)*) = {
    "Object creation impossible, since %s".format(
      members.map(p => " member %s in %s is not defined".format(p._1, p._2)).mkString("; "))
  }
}

{'fraction_non_alphanumeric': 0.1049482163406214, 'fraction_numerical': 0.003682393555811277, 'mean_word_length': 3.4211597151576805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, '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': '7324443', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1239, 'n_words': 220}