I'm trying to create huge array of String (or Object):
val arr = LArray.of[String](10L + Integer.MAX_VALUE)
or
ClassTag<String> tag = scala.reflect.ClassTag$.MODULE$.apply(String.class) def size = Integer.MAX_VALUE.longValue() + 10 LArray lArray = new LObjectArrayLarge<String>(size, tag)
both failed with exception:
java.lang.NegativeArraySizeException was thrown. java.lang.NegativeArraySizeException at java.lang.reflect.Array.newArray(Native Method) at java.lang.reflect.Array.newInstance(Array.java:75) at scala.reflect.ClassTag.newArray(ClassTag.scala:60) at scala.reflect.ClassTag.newArray$(ClassTag.scala:49) at scala.reflect.ClassTag$GenericClassTag.newArray(ClassTag.scala:123) at xerial.larray.LObjectArrayLarge.$anonfun$array$1(LArray.scala:1114) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:156) at xerial.larray.LObjectArrayLarge.<init>(LArray.scala:1112) at xerial.larray.LObjectArray$.ofDim(LArray.scala:1031) at xerial.larray.LArray$.of(LArray.scala:397) at xerial.larray.LArrayTest.$anonfun$new$38(LArrayTest.scala:325) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85) at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83) at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104) at org.scalatest.Transformer.apply(Transformer.scala:22) at org.scalatest.Transformer.apply(Transformer.scala:20) at org.scalatest.WordSpecLike$$anon$1.apply(WordSpecLike.scala:1078) at org.scalatest.TestSuite.withFixture(TestSuite.scala:196) at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195) at org.scalatest.WordSpec.withFixture(WordSpec.scala:1881) at org.scalatest.WordSpecLike.invokeWithFixture$1(WordSpecLike.scala:1076) at org.scalatest.WordSpecLike.$anonfun$runTest$1(WordSpecLike.scala:1088) at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289) at org.scalatest.WordSpecLike.runTest(WordSpecLike.scala:1088) at org.scalatest.WordSpecLike.runTest$(WordSpecLike.scala:1070) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfter$$super$runTest(LArrayTest.scala:32) at org.scalatest.BeforeAndAfter.runTest(BeforeAndAfter.scala:203) at org.scalatest.BeforeAndAfter.runTest$(BeforeAndAfter.scala:192) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfterEach$$super$runTest(LArrayTest.scala:32) at org.scalatest.BeforeAndAfterEach.runTest(BeforeAndAfterEach.scala:221) at org.scalatest.BeforeAndAfterEach.runTest$(BeforeAndAfterEach.scala:214) at xerial.larray.LArrayTest.runTest(LArrayTest.scala:32) at org.scalatest.WordSpecLike.$anonfun$runTests$1(WordSpecLike.scala:1147) at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:396) at scala.collection.immutable.List.foreach(List.scala:389) at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384) at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:373) at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:410) at scala.collection.immutable.List.foreach(List.scala:389) at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384) at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:379) at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461) at org.scalatest.WordSpecLike.runTests(WordSpecLike.scala:1147) at org.scalatest.WordSpecLike.runTests$(WordSpecLike.scala:1146) at org.scalatest.WordSpec.runTests(WordSpec.scala:1881) at org.scalatest.Suite.run(Suite.scala:1147) at org.scalatest.Suite.run$(Suite.scala:1129) at org.scalatest.WordSpec.org$scalatest$WordSpecLike$$super$run(WordSpec.scala:1881) at org.scalatest.WordSpecLike.$anonfun$run$1(WordSpecLike.scala:1192) at org.scalatest.SuperEngine.runImpl(Engine.scala:521) at org.scalatest.WordSpecLike.run(WordSpecLike.scala:1192) at org.scalatest.WordSpecLike.run$(WordSpecLike.scala:1190) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfterAll$$super$run(LArrayTest.scala:32) at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:213) at org.scalatest.BeforeAndAfterAll.run(BeforeAndAfterAll.scala:210) at org.scalatest.BeforeAndAfterAll.run$(BeforeAndAfterAll.scala:208) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfter$$super$run(LArrayTest.scala:32) at org.scalatest.BeforeAndAfter.run(BeforeAndAfter.scala:258) at org.scalatest.BeforeAndAfter.run$(BeforeAndAfter.scala:256) at xerial.larray.LArrayTest.run(LArrayTest.scala:32) at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45) at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1340) at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1334) at scala.collection.immutable.List.foreach(List.scala:389) at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334) at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031) at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010) at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1500) at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010) at org.scalatest.tools.Runner$.run(Runner.scala:850) at org.scalatest.tools.Runner.run(Runner.scala) at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131) at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
Hi,
I'm trying to create huge array of String (or Object):
val arr = LArray.of[String](10L + Integer.MAX_VALUE)
orClassTag<String> tag = scala.reflect.ClassTag$.MODULE$.apply(String.class) def size = Integer.MAX_VALUE.longValue() + 10 LArray lArray = new LObjectArrayLarge<String>(size, tag)
both failed with exception:
java.lang.NegativeArraySizeException was thrown. java.lang.NegativeArraySizeException at java.lang.reflect.Array.newArray(Native Method) at java.lang.reflect.Array.newInstance(Array.java:75) at scala.reflect.ClassTag.newArray(ClassTag.scala:60) at scala.reflect.ClassTag.newArray$(ClassTag.scala:49) at scala.reflect.ClassTag$GenericClassTag.newArray(ClassTag.scala:123) at xerial.larray.LObjectArrayLarge.$anonfun$array$1(LArray.scala:1114) at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:156) at xerial.larray.LObjectArrayLarge.<init>(LArray.scala:1112) at xerial.larray.LObjectArray$.ofDim(LArray.scala:1031) at xerial.larray.LArray$.of(LArray.scala:397) at xerial.larray.LArrayTest.$anonfun$new$38(LArrayTest.scala:325) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85) at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83) at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104) at org.scalatest.Transformer.apply(Transformer.scala:22) at org.scalatest.Transformer.apply(Transformer.scala:20) at org.scalatest.WordSpecLike$$anon$1.apply(WordSpecLike.scala:1078) at org.scalatest.TestSuite.withFixture(TestSuite.scala:196) at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195) at org.scalatest.WordSpec.withFixture(WordSpec.scala:1881) at org.scalatest.WordSpecLike.invokeWithFixture$1(WordSpecLike.scala:1076) at org.scalatest.WordSpecLike.$anonfun$runTest$1(WordSpecLike.scala:1088) at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289) at org.scalatest.WordSpecLike.runTest(WordSpecLike.scala:1088) at org.scalatest.WordSpecLike.runTest$(WordSpecLike.scala:1070) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfter$$super$runTest(LArrayTest.scala:32) at org.scalatest.BeforeAndAfter.runTest(BeforeAndAfter.scala:203) at org.scalatest.BeforeAndAfter.runTest$(BeforeAndAfter.scala:192) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfterEach$$super$runTest(LArrayTest.scala:32) at org.scalatest.BeforeAndAfterEach.runTest(BeforeAndAfterEach.scala:221) at org.scalatest.BeforeAndAfterEach.runTest$(BeforeAndAfterEach.scala:214) at xerial.larray.LArrayTest.runTest(LArrayTest.scala:32) at org.scalatest.WordSpecLike.$anonfun$runTests$1(WordSpecLike.scala:1147) at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:396) at scala.collection.immutable.List.foreach(List.scala:389) at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384) at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:373) at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:410) at scala.collection.immutable.List.foreach(List.scala:389) at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384) at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:379) at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:461) at org.scalatest.WordSpecLike.runTests(WordSpecLike.scala:1147) at org.scalatest.WordSpecLike.runTests$(WordSpecLike.scala:1146) at org.scalatest.WordSpec.runTests(WordSpec.scala:1881) at org.scalatest.Suite.run(Suite.scala:1147) at org.scalatest.Suite.run$(Suite.scala:1129) at org.scalatest.WordSpec.org$scalatest$WordSpecLike$$super$run(WordSpec.scala:1881) at org.scalatest.WordSpecLike.$anonfun$run$1(WordSpecLike.scala:1192) at org.scalatest.SuperEngine.runImpl(Engine.scala:521) at org.scalatest.WordSpecLike.run(WordSpecLike.scala:1192) at org.scalatest.WordSpecLike.run$(WordSpecLike.scala:1190) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfterAll$$super$run(LArrayTest.scala:32) at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:213) at org.scalatest.BeforeAndAfterAll.run(BeforeAndAfterAll.scala:210) at org.scalatest.BeforeAndAfterAll.run$(BeforeAndAfterAll.scala:208) at xerial.larray.LArrayTest.org$scalatest$BeforeAndAfter$$super$run(LArrayTest.scala:32) at org.scalatest.BeforeAndAfter.run(BeforeAndAfter.scala:258) at org.scalatest.BeforeAndAfter.run$(BeforeAndAfter.scala:256) at xerial.larray.LArrayTest.run(LArrayTest.scala:32) at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45) at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1340) at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1334) at scala.collection.immutable.List.foreach(List.scala:389) at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1334) at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031) at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010) at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1500) at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010) at org.scalatest.tools.Runner$.run(Runner.scala:850) at org.scalatest.tools.Runner.run(Runner.scala) at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131) at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
May be am I doing something wrong ?
Thank you, Bedy