<commit_before>package org.jetbrains.plugins.scala
package lang
package psi

import api.base.ScReferenceElement
import api.statements.ScTypeAliasDefinition
import api.toplevel.imports.{ScImportSelector, ScImportSelectors, ScImportExpr, ScImportStmt}
import api.toplevel.templates.ScTemplateBody
import api.{ScalaRecursiveElementVisitor, ScalaFile}
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil
import impl.toplevel.imports.ScImportStmtImpl
import impl.{ScPackageImpl, ScalaPsiElementFactory}
import org.jetbrains.plugins.scala.lang.parser.ScalaElementTypes
import api.toplevel.imports.usages.{ImportSelectorUsed, ImportExprUsed, ImportWildcardSelectorUsed, ImportUsed}
import com.intellij.codeInsight.hint.HintManager
import lexer.ScalaTokenTypes
import api.toplevel.packaging.ScPackaging
import api.toplevel.typedef.ScTypeDefinition
import com.intellij.psi._
import psi.impl.toplevel.synthetic.ScSyntheticPackage
import refactoring.util.ScalaNamesUtil
import scope._
import com.intellij.openapi.progress.ProgressManager
import lang.resolve.processor.{CompletionProcessor, ResolveProcessor}
import com.intellij.psi.util.PsiTreeUtil
import java.lang.ThreadLocal
import com.intellij.openapi.util.{Trinity, RecursionManager}
import stubs.ScImportStmtStub
import types.result.TypingContext
import types.ScDesignatorType
import extensions.{toPsiMemberExt, toPsiNamedElementExt, toPsiClassExt}
import settings._
import lang.resolve.{ScalaResolveResult, StdKinds}
import annotation.tailrec
import collection.mutable.{HashMap, HashSet, ArrayBuffer, Set}

trait ScImportsHolder extends ScalaPsiElement {

  def getImportStatements: Seq[ScImportStmt] = collection.immutable.Seq(findChildrenByClassScala(classOf[ScImportStmt]).toSeq: _*)
  
  @volatile
  private var modCount: Long = 0L

  private val updating: ThreadLocal[Boolean] = new ThreadLocal[Boolean]() {
    override def initialValue(): Boolean = false
  }
<commit_msg>Do not load tree everywhere.<commit_after>package org.jetbrains.plugins.scala
package lang
package psi

import api.base.ScReferenceElement
import api.statements.ScTypeAliasDefinition
import api.toplevel.imports.{ScImportSelector, ScImportSelectors, ScImportExpr, ScImportStmt}
import api.toplevel.templates.ScTemplateBody
import api.{ScalaRecursiveElementVisitor, ScalaFile}
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil
import impl.{ScPackageImpl, ScalaPsiElementFactory}
import org.jetbrains.plugins.scala.lang.parser.ScalaElementTypes
import api.toplevel.imports.usages.{ImportSelectorUsed, ImportExprUsed, ImportWildcardSelectorUsed, ImportUsed}
import com.intellij.codeInsight.hint.HintManager
import lexer.ScalaTokenTypes
import api.toplevel.packaging.ScPackaging
import api.toplevel.typedef.ScTypeDefinition
import com.intellij.psi._
import psi.impl.toplevel.synthetic.ScSyntheticPackage
import refactoring.util.ScalaNamesUtil
import scope._
import com.intellij.openapi.progress.ProgressManager
import lang.resolve.processor.{CompletionProcessor, ResolveProcessor}
import com.intellij.psi.util.PsiTreeUtil
import java.lang.ThreadLocal
import com.intellij.openapi.util.{Trinity, RecursionManager}
import types.result.TypingContext
import types.ScDesignatorType
import extensions.{toPsiMemberExt, toPsiNamedElementExt, toPsiClassExt}
import settings._
import lang.resolve.{ScalaResolveResult, StdKinds}
import annotation.tailrec
import collection.mutable.{HashMap, HashSet, ArrayBuffer, Set}
import com.intellij.psi.stubs.StubElement

trait ScImportsHolder extends ScalaPsiElement {

  def getImportStatements: Seq[ScImportStmt] = {
    this match {
      case s: ScalaStubBasedElementImpl[_] =>
        val stub: StubElement[_] = s.getStub
        if (stub != null) {
          return stub.getChildrenByType(ScalaElementTypes.IMPORT_STMT, JavaArrayFactoryUtil.ScImportStmtFactory).toSeq
        }
      case _ =>
    }
    collection.immutable.Seq(findChildrenByClassScala(classOf[ScImportStmt]).toSeq: _*)
  }
  
  @volatile
  private var modCount: Long = 0L

  private val updating: ThreadLocal[Boolean] = new ThreadLocal[Boolean]() {
    override def initialValue(): Boolean = false
  }

{'fraction_non_alphanumeric': 0.08115942028985507, 'fraction_numerical': 0.0004830917874396135, 'mean_word_length': 6.612132352941177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7659179', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1258, 'n_words': 236}