<commit_before>/**
 * @author ven
 */
package org.jetbrains.plugins.scala.lang.psi.javaView
import com.intellij.extapi.psi.LightPsiFileBase
import com.intellij.psi._
import com.intellij.pom.java.LanguageLevel
import com.intellij.lang.StdLanguages
import com.intellij.openapi.fileTypes.StdFileTypes
import com.intellij.util.ArrayUtil
import org.jetbrains.plugins.scala.ScalaFileType
import org.jetbrains.plugins.scala.lang.psi.impl.top._
import java.io.Serializable

/**
 *  Java toplevel view of the scala file
 *  @see PsiJavaFile
 */
class ScJavaFile(viewProvider: FileViewProvider) extends LightPsiFileBase(viewProvider, StdLanguages.JAVA) with PsiJavaFile
with Serializable{
  def getLanguageLevel = LanguageLevel.JDK_1_5

  def findImportReferenceTo(psiClass: PsiClass) = null

  def getImplicitlyImportedPackageReferences = PsiJavaCodeReferenceElement.EMPTY_ARRAY

  def getImplicitlyImportedPackages = ArrayUtil.EMPTY_STRING_ARRAY

  def getSingleClassImports(checkIncludes: Boolean) = PsiClass.EMPTY_ARRAY

  def getOnDemandImports(includeImplicit: Boolean, checkIncludes: Boolean) = PsiElement.EMPTY_ARRAY

  def getImportList = null

  def getPackageStatement = null

  def importClass(psiClass: PsiClass) = false

  //todo
  def getPackageName = ""

  private var classes : Array[PsiClass] = null

  override def getClasses = {
    if (classes == null) {
      val scFile = viewProvider.getPsi(ScalaFileType.SCALA_FILE_TYPE.getLanguage).asInstanceOf[ScalaFile]
      val temp = scFile.getTmplDefs.map(c => new ScJavaClass(c, this)).toArray[PsiClass]
      classes = temp
      temp  //need thread safety here, so return local!
    }

    classes
  }

  def getChildren = getClasses.asInstanceOf[Array[PsiElement]]

  def copyLight(newFileViewProvider: FileViewProvider) = new ScJavaFile(newFileViewProvider)

  override def clearCaches = {classes = null}

  def getFileType = StdFileTypes.JAVA

  override def findElementAt(offset: Int): PsiElement = {
    for (val child <- getChildren) {
      val textRange = child.getTextRange
      if (textRange.contains(offset)) {
        return child.findElementAt(offset - textRange.getStartOffset)
      }
    }
    if (getTextRange.contains(offset))  this else null
  }
}
<commit_msg>assorted minor fixes<commit_after>/**
 * @author ven
 */
package org.jetbrains.plugins.scala.lang.psi.javaView
import com.intellij.extapi.psi.LightPsiFileBase
import com.intellij.psi._
import com.intellij.pom.java.LanguageLevel
import com.intellij.lang.StdLanguages
import com.intellij.openapi.fileTypes.StdFileTypes
import com.intellij.util.ArrayUtil
import org.jetbrains.plugins.scala.ScalaFileType
import org.jetbrains.plugins.scala.lang.psi.impl.top._
import java.io.Serializable

/**
 *  Java toplevel view of the scala file
 *  @see PsiJavaFile
 */
class ScJavaFile(viewProvider: FileViewProvider) extends LightPsiFileBase(viewProvider, StdLanguages.JAVA) with PsiJavaFile
with Serializable{
  def getLanguageLevel = LanguageLevel.JDK_1_5

  def findImportReferenceTo(psiClass: PsiClass) = null

  def getImplicitlyImportedPackageReferences = PsiJavaCodeReferenceElement.EMPTY_ARRAY

  def getImplicitlyImportedPackages = ArrayUtil.EMPTY_STRING_ARRAY

  def getSingleClassImports(checkIncludes: Boolean) = PsiClass.EMPTY_ARRAY

  def getOnDemandImports(includeImplicit: Boolean, checkIncludes: Boolean) = PsiElement.EMPTY_ARRAY

  def getImportList = null

  def getPackageStatement = null

  def importClass(psiClass: PsiClass) = false

  //todo
  def getPackageName = ""

  override def getClasses = {
    val scFile = viewProvider.getPsi(ScalaFileType.SCALA_FILE_TYPE.getLanguage).asInstanceOf[ScalaFile]
    scFile.getTmplDefs.map(c => new ScJavaClass(c, this)).toArray[PsiClass]
  }

  def getChildren = getClasses.asInstanceOf[Array[PsiElement]]

  def copyLight(newFileViewProvider: FileViewProvider) = new ScJavaFile(newFileViewProvider)

  def clearCaches = {
    //do not clear caches here, this method is not called
  }

  def getFileType = StdFileTypes.JAVA

  override def findElementAt(offset: Int): PsiElement = {
    for (val child <- getChildren) {
      val textRange = child.getTextRange
      if (textRange.contains(offset)) {
        return child.findElementAt(offset - textRange.getStartOffset)
      }
    }
    if (getTextRange.contains(offset))  this else null
  }
}

{'fraction_non_alphanumeric': 0.08223463687150838, 'fraction_numerical': 0.000893854748603352, 'mean_word_length': 3.9623059866962307, 'pattern_counts': {'":': 0, '<': 5, '<?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': '533007', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1375, 'n_words': 282}