<commit_before>/*
 * Scala.js (https://www.scala-js.org/)
 *
 * Copyright EPFL.
 *
 * Licensed under Apache License 2.0
 * (https://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package java.lang.reflect

import scala.scalajs.js

import js.JSConverters._

import java.lang.Class

object Array {
  def newInstance(componentType: Class[_], length: Int): AnyRef =
    componentType.newArrayOfThisClass(js.Array(length))

  def newInstance(componentType: Class[_], dimensions: scala.Array[Int]): AnyRef =
    componentType.newArrayOfThisClass(dimensions.toJSArray)

  def getLength(array: AnyRef): Int = array match {
    // yes, this is kind of stupid, but that's how it is
    case array: Array[Object]  => array.length
    case array: Array[Boolean] => array.length
    case array: Array[Char]    => array.length
    case array: Array[Byte]    => array.length
    case array: Array[Short]   => array.length
    case array: Array[Int]     => array.length
    case array: Array[Long]    => array.length
    case array: Array[Float]   => array.length
    case array: Array[Double]  => array.length
    case _ => throw new IllegalArgumentException("argument type mismatch")
  }

  def get(array: AnyRef, index: Int): AnyRef = array match {
    case array: Array[Object]  => array(index)
    case array: Array[Boolean] => new java.lang.Boolean(array(index))
    case array: Array[Char]    => new java.lang.Character(array(index))
    case array: Array[Byte]    => new java.lang.Byte(array(index))
    case array: Array[Short]   => new java.lang.Short(array(index))
    case array: Array[Int]     => new java.lang.Integer(array(index))
    case array: Array[Long]    => new java.lang.Long(array(index))
    case array: Array[Float]   => new java.lang.Float(array(index))
    case array: Array[Double]  => new java.lang.Double(array(index))
    case _ => throw new IllegalArgumentException("argument type mismatch")
  }
<commit_msg>Avoid constructors of primitive boxes<commit_after>/*
 * Scala.js (https://www.scala-js.org/)
 *
 * Copyright EPFL.
 *
 * Licensed under Apache License 2.0
 * (https://www.apache.org/licenses/LICENSE-2.0).
 *
 * See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 */

package java.lang.reflect

import scala.scalajs.js

import js.JSConverters._

import java.lang.Class

object Array {
  def newInstance(componentType: Class[_], length: Int): AnyRef =
    componentType.newArrayOfThisClass(js.Array(length))

  def newInstance(componentType: Class[_], dimensions: scala.Array[Int]): AnyRef =
    componentType.newArrayOfThisClass(dimensions.toJSArray)

  def getLength(array: AnyRef): Int = array match {
    // yes, this is kind of stupid, but that's how it is
    case array: Array[Object]  => array.length
    case array: Array[Boolean] => array.length
    case array: Array[Char]    => array.length
    case array: Array[Byte]    => array.length
    case array: Array[Short]   => array.length
    case array: Array[Int]     => array.length
    case array: Array[Long]    => array.length
    case array: Array[Float]   => array.length
    case array: Array[Double]  => array.length
    case _ => throw new IllegalArgumentException("argument type mismatch")
  }

  def get(array: AnyRef, index: Int): AnyRef = array match {
    case array: Array[Object]  => array(index)
    case array: Array[Boolean] => java.lang.Boolean.valueOf(array(index))
    case array: Array[Char]    => java.lang.Character.valueOf(array(index))
    case array: Array[Byte]    => java.lang.Byte.valueOf(array(index))
    case array: Array[Short]   => java.lang.Short.valueOf(array(index))
    case array: Array[Int]     => java.lang.Integer.valueOf(array(index))
    case array: Array[Long]    => java.lang.Long.valueOf(array(index))
    case array: Array[Float]   => java.lang.Float.valueOf(array(index))
    case array: Array[Double]  => java.lang.Double.valueOf(array(index))
    case _ => throw new IllegalArgumentException("argument type mismatch")
  }

{'fraction_non_alphanumeric': 0.12942317014057197, 'fraction_numerical': 0.0019389238972370335, 'mean_word_length': 3.7821552723059098, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 43, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, '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': '7317539', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1234, 'n_words': 328}