summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.sbt45
-rw-r--r--build.xml32
-rw-r--r--dbuild-meta.json5
-rw-r--r--doc/LICENSE.md1
-rw-r--r--doc/licenses/bsd_scalacheck.txt32
-rw-r--r--project/PartestUtil.scala2
-rw-r--r--project/ScriptCommands.scala128
-rw-r--r--project/VersionUtil.scala4
-rw-r--r--project/plugins.sbt4
-rw-r--r--scripts/common20
-rw-r--r--scripts/jobs/integrate/bootstrap104
-rwxr-xr-xscripts/jobs/integrate/windows22
-rwxr-xr-xscripts/jobs/validate/publish-core7
-rwxr-xr-xscripts/jobs/validate/test16
-rw-r--r--src/build/bnd/scala-compiler.bnd1
-rw-r--r--src/build/dbuild-meta-json-gen.scala5
-rw-r--r--src/build/genprod.scala3
-rw-r--r--src/build/maven/scala-compiler-doc-pom.xml5
-rw-r--r--src/build/maven/scala-compiler-pom.xml5
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala23
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala93
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala106
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala22
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala17
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala22
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala86
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala13
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala58
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala23
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala9
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala25
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala14
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala13
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala28
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala28
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaParsers.scala15
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaScanners.scala38
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Delambdafy.scala20
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala15
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala33
-rw-r--r--src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala17
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Checkable.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
-rw-r--r--src/eclipse/interactive/.classpath2
-rw-r--r--src/eclipse/partest/.classpath4
-rw-r--r--src/eclipse/repl/.classpath2
-rw-r--r--src/eclipse/scala-compiler/.classpath2
-rw-r--r--src/eclipse/scaladoc/.classpath7
-rw-r--r--src/eclipse/test-junit/.classpath4
-rw-r--r--src/intellij/README.md4
-rw-r--r--src/intellij/scala.ipr.SAMPLE70
-rw-r--r--src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala10
-rw-r--r--src/library/scala/Option.scala6
-rw-r--r--src/library/scala/Predef.scala2
-rw-r--r--src/library/scala/Tuple1.scala3
-rw-r--r--src/library/scala/Tuple10.scala3
-rw-r--r--src/library/scala/Tuple11.scala3
-rw-r--r--src/library/scala/Tuple12.scala3
-rw-r--r--src/library/scala/Tuple13.scala3
-rw-r--r--src/library/scala/Tuple14.scala3
-rw-r--r--src/library/scala/Tuple15.scala3
-rw-r--r--src/library/scala/Tuple16.scala3
-rw-r--r--src/library/scala/Tuple17.scala3
-rw-r--r--src/library/scala/Tuple18.scala3
-rw-r--r--src/library/scala/Tuple19.scala3
-rw-r--r--src/library/scala/Tuple2.scala3
-rw-r--r--src/library/scala/Tuple20.scala3
-rw-r--r--src/library/scala/Tuple21.scala3
-rw-r--r--src/library/scala/Tuple22.scala3
-rw-r--r--src/library/scala/Tuple3.scala3
-rw-r--r--src/library/scala/Tuple4.scala3
-rw-r--r--src/library/scala/Tuple5.scala3
-rw-r--r--src/library/scala/Tuple6.scala3
-rw-r--r--src/library/scala/Tuple7.scala3
-rw-r--r--src/library/scala/Tuple8.scala3
-rw-r--r--src/library/scala/Tuple9.scala3
-rw-r--r--src/library/scala/collection/BufferedIterator.scala6
-rw-r--r--src/library/scala/collection/GenMap.scala14
-rw-r--r--src/library/scala/collection/GenMapLike.scala36
-rw-r--r--src/library/scala/collection/Map.scala24
-rw-r--r--src/library/scala/collection/MapLike.scala142
-rw-r--r--src/library/scala/collection/immutable/Map.scala116
-rw-r--r--src/library/scala/collection/immutable/MapLike.scala55
-rw-r--r--src/library/scala/collection/immutable/Queue.scala8
-rw-r--r--src/library/scala/collection/immutable/Range.scala2
-rw-r--r--src/library/scala/collection/mutable/HashTable.scala5
-rw-r--r--src/library/scala/collection/mutable/LinkedHashMap.scala2
-rw-r--r--src/library/scala/collection/mutable/LinkedHashSet.scala2
-rw-r--r--src/library/scala/collection/mutable/Map.scala40
-rw-r--r--src/library/scala/collection/mutable/MapLike.scala62
-rw-r--r--src/library/scala/collection/parallel/immutable/package.scala7
-rw-r--r--src/library/scala/math/package.scala253
-rw-r--r--src/library/scala/reflect/ClassTag.scala4
-rw-r--r--src/library/scala/reflect/Manifest.scala113
-rw-r--r--src/library/scala/remote.scala1
-rw-r--r--src/library/scala/runtime/java8/JFunction.java146
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcB$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcC$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcS$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcV$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0$mcZ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction0.java39
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcDF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcFD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcFF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcFI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcFJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcIF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcJF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcVD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcVF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcVI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcVJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcZD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcZF$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcZI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1$mcZJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction1.java228
-rw-r--r--src/library/scala/runtime/java8/JFunction10.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction11.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction12.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction13.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction14.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction15.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction16.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction17.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction18.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction19.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcDJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcFJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcIJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcJJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcVJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZDD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZDI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZDJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZID$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZII$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZIJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZJD$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZJI$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2$mcZJJ$sp.java2
-rw-r--r--src/library/scala/runtime/java8/JFunction2.java498
-rw-r--r--src/library/scala/runtime/java8/JFunction20.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction21.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction22.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction3.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction4.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction5.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction6.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction7.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction8.java10
-rw-r--r--src/library/scala/runtime/java8/JFunction9.java10
-rw-r--r--src/library/scala/runtime/java8/JProcedure0.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure1.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure10.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure11.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure12.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure13.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure14.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure15.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure16.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure17.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure18.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure19.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure2.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure20.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure21.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure22.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure3.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure4.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure5.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure6.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure7.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure8.java21
-rw-r--r--src/library/scala/runtime/java8/JProcedure9.java21
-rw-r--r--src/library/scala/util/Either.scala320
-rw-r--r--src/library/scala/util/matching/Regex.scala142
-rw-r--r--src/partest-extras/scala/org/scalacheck/Arbitrary.scala433
-rw-r--r--src/partest-extras/scala/org/scalacheck/Commands.scala146
-rw-r--r--src/partest-extras/scala/org/scalacheck/Commands2.scala150
-rw-r--r--src/partest-extras/scala/org/scalacheck/Gen.scala813
-rw-r--r--src/partest-extras/scala/org/scalacheck/Prop.scala953
-rw-r--r--src/partest-extras/scala/org/scalacheck/Properties.scala82
-rw-r--r--src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala93
-rw-r--r--src/partest-extras/scala/org/scalacheck/Shrink.scala215
-rw-r--r--src/partest-extras/scala/org/scalacheck/Test.scala372
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/Buildable.scala77
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala41
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala44
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/FreqMap.scala65
-rw-r--r--src/partest-extras/scala/org/scalacheck/util/Pretty.scala129
-rw-r--r--src/partest-extras/scala/tools/partest/ASMConverters.scala6
-rw-r--r--src/reflect/scala/reflect/internal/Constants.scala3
-rw-r--r--src/reflect/scala/reflect/internal/Definitions.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Printers.scala30
-rw-r--r--src/reflect/scala/reflect/internal/StdNames.scala1
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala119
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala3
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/IndexScript.scala21
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/page/JSON.scala56
-rw-r--r--src/scaladoc/scala/tools/partest/ScaladocModelTest.scala2
-rw-r--r--test/benchmarks/build.sbt2
-rw-r--r--test/files/instrumented/InstrumentationTest.check2
-rw-r--r--test/files/jvm/annotations.check3
-rw-r--r--test/files/jvm/annotations.flags1
-rw-r--r--test/files/neg/sammy_restrictions.check33
-rw-r--r--test/files/neg/sammy_restrictions.scala7
-rw-r--r--test/files/neg/t4851.check4
-rw-r--r--test/files/neg/t7294.check6
-rw-r--r--test/files/neg/t7294.flags1
-rw-r--r--test/files/neg/t7294b.check4
-rw-r--r--test/files/neg/t7294b.flags1
-rw-r--r--test/files/neg/t9849.check7
-rw-r--r--test/files/neg/t9849.scala16
-rw-r--r--test/files/neg/trait-defaults-super.check4
-rw-r--r--test/files/neg/trait-defaults-super.scala21
-rw-r--r--test/files/pos/t482.scala7
-rw-r--r--test/files/pos/t4914.scala20
-rw-r--r--test/files/pos/t7294.scala6
-rw-r--r--test/files/pos/t9855.scala10
-rw-r--r--test/files/pos/t9855b.scala16
-rw-r--r--test/files/pos/tcpoly_bounds1.scala6
-rw-r--r--test/files/pos/trait-defaults-super.scala21
-rw-r--r--test/files/presentation/callcc-interpreter/Runner.scala5
-rw-r--r--test/files/presentation/doc/doc.scala6
-rw-r--r--test/files/presentation/t7678/Runner.scala2
-rw-r--r--test/files/run/classfile-format-51.scala2
-rw-r--r--test/files/run/lambda-serialization.scala2
-rw-r--r--test/files/run/noInlineUnknownIndy/Test.scala7
-rw-r--r--test/files/run/reflection-java-annotations.check5
-rw-r--r--test/files/run/reflection-java-annotations/Test_2.scala4
-rw-r--r--test/files/run/sammy_seriazable.scala47
-rw-r--r--test/files/run/sd167.check1
-rw-r--r--test/files/run/sd167.scala8
-rw-r--r--test/files/run/t3326.scala2
-rw-r--r--test/files/run/t3888.check1
-rw-r--r--test/files/run/t3888.scala5
-rw-r--r--test/files/run/t4891.check3
-rw-r--r--test/files/run/t5652.check3
-rw-r--r--test/files/run/t5699.check4
-rw-r--r--test/files/run/t6288.check6
-rw-r--r--test/files/run/t7439.check2
-rw-r--r--test/files/run/t7700.check5
-rw-r--r--test/files/run/t7700.scala16
-rw-r--r--test/files/run/t7747-repl.scala8
-rw-r--r--test/files/run/t7932.check4
-rw-r--r--test/files/run/t7932.scala10
-rw-r--r--test/files/run/t8442.check2
-rw-r--r--test/files/run/t8549.scala39
-rw-r--r--test/files/run/t8601e/StaticInit.classbin417 -> 0 bytes
-rw-r--r--test/files/run/t9268.check3
-rw-r--r--test/files/run/trait-static-clash.scala10
-rw-r--r--test/files/run/xMigration.check6
-rw-r--r--test/files/scalacheck/CheckEither.scala70
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala2
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala2
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala44
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala2
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala33
-rw-r--r--test/files/scalacheck/parallel-collections/ParallelSetCheck.scala2
-rw-r--r--test/junit/scala/collection/IteratorTest.scala28
-rw-r--r--test/junit/scala/lang/traits/BytecodeTest.scala9
-rw-r--r--test/junit/scala/reflect/internal/PrintersTest.scala16
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala19
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala5
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala4
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala4
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala35
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala20
-rw-r--r--test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala23
-rw-r--r--test/junit/scala/tools/testing/BytecodeTesting.scala15
-rw-r--r--test/junit/scala/util/matching/RegexTest.scala70
-rw-r--r--test/scaladoc/resources/SI-4826.java20
-rw-r--r--test/scaladoc/run/SI-4826.check1
-rw-r--r--test/scaladoc/run/SI-4826.scala30
-rw-r--r--versions.properties12
335 files changed, 6194 insertions, 3032 deletions
diff --git a/build.sbt b/build.sbt
index 20ae42b3e6..10cca3531a 100644
--- a/build.sbt
+++ b/build.sbt
@@ -56,11 +56,10 @@
import VersionUtil._
// Scala dependencies:
-val scalaParserCombinatorsDep = scalaDep("org.scala-lang.modules", "scala-parser-combinators")
val scalaSwingDep = scalaDep("org.scala-lang.modules", "scala-swing")
val scalaXmlDep = scalaDep("org.scala-lang.modules", "scala-xml")
+val scalaParserCombinatorsDep = scalaDep("org.scala-lang.modules", "scala-parser-combinators")
val partestDep = scalaDep("org.scala-lang.modules", "scala-partest", versionProp = "partest")
-val scalacheckDep = scalaDep("org.scalacheck", "scalacheck", scope = "it")
// Non-Scala dependencies:
val junitDep = "junit" % "junit" % "4.11"
@@ -399,7 +398,7 @@ lazy val compiler = configureAsSubproject(project)
description := "Scala Compiler",
libraryDependencies ++= Seq(antDep, asmDep),
// These are only needed for the POM:
- libraryDependencies ++= Seq(scalaXmlDep, scalaParserCombinatorsDep, jlineDep % "optional"),
+ libraryDependencies ++= Seq(scalaXmlDep, jlineDep % "optional"),
// this a way to make sure that classes from interactive and scaladoc projects
// end up in compiler jar (that's what Ant build does)
// we need to use LocalProject references (with strings) to deal with mutual recursion
@@ -428,7 +427,6 @@ lazy val compiler = configureAsSubproject(project)
Osgi.headers ++= Seq(
"Import-Package" -> ("jline.*;resolution:=optional," +
"org.apache.tools.ant.*;resolution:=optional," +
- "scala.util.parsing.*;version=\"${range;[====,====];"+versionNumber("scala-parser-combinators")+"}\";resolution:=optional," +
"scala.xml.*;version=\"${range;[====,====];"+versionNumber("scala-xml")+"}\";resolution:=optional," +
"scala.*;version=\"${range;[==,=+);${ver}}\"," +
"*"),
@@ -522,7 +520,7 @@ lazy val scaladoc = configureAsSubproject(project)
.settings(
name := "scala-compiler-doc",
description := "Scala Documentation Generator",
- libraryDependencies ++= Seq(scalaXmlDep, scalaParserCombinatorsDep, partestDep),
+ libraryDependencies ++= Seq(scalaXmlDep, partestDep),
includeFilter in unmanagedResources in Compile := "*.html" | "*.css" | "*.gif" | "*.png" | "*.js" | "*.txt" | "*.svg" | "*.eot" | "*.woff" | "*.ttf"
)
.dependsOn(compiler)
@@ -562,6 +560,7 @@ lazy val junit = project.in(file("test") / "junit")
fork in Test := true,
libraryDependencies ++= Seq(junitDep, junitInterfaceDep, jolDep),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
+ testFrameworks -= new TestFramework("org.scalacheck.ScalaCheckFramework"),
unmanagedSourceDirectories in Test := List(baseDirectory.value)
)
@@ -642,7 +641,7 @@ lazy val test = project
.settings(disablePublishing: _*)
.settings(Defaults.itSettings: _*)
.settings(
- libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep, scalacheckDep),
+ libraryDependencies ++= Seq(asmDep, partestDep, scalaXmlDep),
libraryDependencies ++= {
// Resolve the JARs for all test/files/lib/*.jar.desired.sha1 files through Ivy
val baseDir = (baseDirectory in ThisBuild).value
@@ -659,6 +658,7 @@ lazy val test = project
fork in IntegrationTest := true,
javaOptions in IntegrationTest += "-Xmx2G",
testFrameworks += new TestFramework("scala.tools.partest.sbt.Framework"),
+ testFrameworks -= new TestFramework("org.scalacheck.ScalaCheckFramework"),
testOptions in IntegrationTest += Tests.Argument("-Dpartest.java_opts=-Xmx1024M -Xms64M -XX:MaxPermSize=128M"),
testOptions in IntegrationTest += Tests.Argument("-Dpartest.scalac_opts=" + (scalacOptions in Compile).value.mkString(" ")),
testOptions in IntegrationTest += Tests.Setup { () =>
@@ -768,6 +768,32 @@ lazy val root: Project = (project in file("."))
GenerateAnyVals.run(dir.getAbsoluteFile)
state
},
+ testAll := {
+ val results = ScriptCommands.sequence[Result[Unit]](List(
+ (Keys.test in Test in junit).result,
+ (testOnly in IntegrationTest in testP).toTask(" -- run pos neg jvm").result,
+ (testOnly in IntegrationTest in testP).toTask(" -- res scalap specialized scalacheck").result,
+ (testOnly in IntegrationTest in testP).toTask(" -- instrumented presentation").result,
+ (testOnly in IntegrationTest in testP).toTask(" -- --srcpath scaladoc").result,
+ (Keys.test in Test in osgiTestFelix).result,
+ (Keys.test in Test in osgiTestEclipse).result,
+ (MiMa.mima in library).result,
+ (MiMa.mima in reflect).result,
+ Def.task(()).dependsOn( // Run these in parallel:
+ doc in Compile in library,
+ doc in Compile in reflect,
+ doc in Compile in compiler,
+ doc in Compile in scalap
+ ).result
+ )).value
+ val failed = results.map(_.toEither).collect { case Left(i) => i }
+ if(failed.nonEmpty) {
+ val log = streams.value.log
+ log.error(s"${failed.size} of ${results.length} test tasks failed:")
+ failed.foreach(i => log.error(s" - $i"))
+ throw new RuntimeException
+ }
+ },
antStyle := false,
incOptions := incOptions.value.withNameHashing(!antStyle.value).withAntStyle(antStyle.value)
)
@@ -837,6 +863,7 @@ lazy val buildDirectory = settingKey[File]("The directory where all build produc
lazy val mkBin = taskKey[Seq[File]]("Generate shell script (bash or Windows batch).")
lazy val mkQuick = taskKey[File]("Generate a full build, including scripts, in build/quick")
lazy val mkPack = taskKey[File]("Generate a full build, including scripts, in build/pack")
+lazy val testAll = taskKey[Unit]("Run all test tasks sequentially")
// Defining these settings is somewhat redundant as we also redefine settings that depend on them.
// However, IntelliJ's project import works better when these are set correctly.
@@ -935,7 +962,7 @@ intellij := {
val modules: List[(String, Seq[File])] = {
// for the sbt build module, the dependencies are fetched from the project's build using sbt-buildinfo
- val buildModule = ("scala-build", scalabuild.BuildInfo.buildClasspath.split(":").toSeq.map(new File(_)))
+ val buildModule = ("scala-build", scalabuild.BuildInfo.buildClasspath.split(java.io.File.pathSeparator).toSeq.map(new File(_)))
// `sbt projects` lists all modules in the build
buildModule :: List(
moduleDeps(compilerP).value,
@@ -1014,12 +1041,14 @@ intellij := {
var continue = false
if (!ipr.exists) {
scala.Console.print(s"Could not find src/intellij/scala.ipr. Create new project files from src/intellij/*.SAMPLE (y/N)? ")
+ scala.Console.flush()
if (scala.Console.readLine() == "y") {
intellijCreateFromSample((baseDirectory in ThisBuild).value)
continue = true
}
} else {
scala.Console.print("Update library classpaths in the current src/intellij/scala.ipr (y/N)? ")
+ scala.Console.flush()
continue = scala.Console.readLine() == "y"
}
if (continue) {
@@ -1044,6 +1073,7 @@ lazy val intellijFromSample = taskKey[Unit]("Create fresh IntelliJ project files
intellijFromSample := {
val s = streams.value
scala.Console.print(s"Create new project files from src/intellij/*.SAMPLE (y/N)? ")
+ scala.Console.flush()
if (scala.Console.readLine() == "y")
intellijCreateFromSample((baseDirectory in ThisBuild).value)
else
@@ -1061,6 +1091,7 @@ lazy val intellijToSample = taskKey[Unit]("Update src/intellij/*.SAMPLE using th
intellijToSample := {
val s = streams.value
scala.Console.print(s"Update src/intellij/*.SAMPLE using the current IntelliJ project files (y/N)? ")
+ scala.Console.flush()
if (scala.Console.readLine() == "y") {
val basedir = (baseDirectory in ThisBuild).value
val existing = basedir / "src/intellij" * "*.SAMPLE"
diff --git a/build.xml b/build.xml
index 519d3597cc..7c6f525c1c 100644
--- a/build.xml
+++ b/build.xml
@@ -319,7 +319,6 @@ TODO:
<prepareCross name="scala-parser-combinators" />
<prepareCross name="scala-swing"/>
<prepareCross name="partest"/>
- <prepareCross name="scalacheck"/>
<artifact:dependencies pathId="asm.classpath" filesetId="asm.fileset">
<dependency groupId="org.scala-lang.modules" artifactId="scala-asm" version="${scala-asm.version}"/>
@@ -339,11 +338,6 @@ TODO:
</artifact:dependencies>
<copy-deps project="partest"/>
- <artifact:dependencies pathId="scalacheck.classpath" filesetId="scalacheck.fileset" versionsId="scalacheck.versions">
- <artifact:remoteRepository refid="extra-repo"/>
- <dependency groupId="org.scalacheck" artifactId="scalacheck${scalacheck.cross}" version="${scalacheck.version.number}" />
- </artifact:dependencies>
-
<artifact:dependencies pathId="repl.deps.classpath" filesetId="repl.fileset" versionsId="repl.deps.versions">
<dependency groupId="jline" artifactId="jline" version="${jline.version}"/>
</artifact:dependencies>
@@ -373,7 +367,7 @@ TODO:
<propertyForCrossedArtifact name="scala-parser-combinators" jar="org.scala-lang.modules:scala-parser-combinators"/>
<propertyForCrossedArtifact name="scala-xml" jar="org.scala-lang.modules:scala-xml"/>
- <propertyForCrossedArtifact name="scala-swing" jar="org.scala-lang.modules:scala-swing"/>
+ <propertyForCrossedArtifact name="scala-swing" jar="org.scala-lang.modules:scala-swing"/>
<!-- BND support -->
<typedef resource="aQute/bnd/ant/taskdef.properties" classpathref="extra.tasks.classpath" />
@@ -567,7 +561,6 @@ TODO:
<echo message="scala-swing.version.number = ${scala-swing.version.number}"/>
<echo message="jline.version = ${jline.version}"/>
<echo message="partest.version.number = ${partest.version.number}"/>
- <echo message="scalacheck.version.number = ${scalacheck.version.number}"/>
<propertyfile file="versions.properties">
<entry key="starr.version" value="${starr.version}"/>
@@ -577,7 +570,6 @@ TODO:
<entry key="scala-swing.version.number" value="${scala-swing.version.number}"/>
<entry key="jline.version" value="${jline.version}"/>
<entry key="partest.version.number" value="${partest.version.number}"/>
- <entry key="scalacheck.version.number" value="${scalacheck.version.number}"/>
</propertyfile>
</then></if>
@@ -799,7 +791,6 @@ TODO:
<path id="pack.bin.tool.path">
<pathelement location="${library.jar}"/>
<pathelement location="${xml.jar}"/>
- <pathelement location="${parser-combinators.jar}"/>
<pathelement location="${reflect.jar}"/>
<pathelement location="${compiler.jar}"/>
<!-- TODO modularize compiler: <pathelement location="${scaladoc.jar}"/> -->
@@ -812,7 +803,9 @@ TODO:
<fileset dir="${build-quick.dir}/classes/library"/>
</path>
- <path id="pack.repl-jline.files"> <fileset dir="${build-quick.dir}/classes/repl-jline"/> </path>
+ <path id="pack.repl-jline.files">
+ <fileset dir="${build-quick.dir}/classes/repl-jline"/>
+ </path>
<path id="pack.compiler.files">
<fileset dir="${build-quick.dir}/classes/compiler"/>
@@ -921,8 +914,7 @@ TODO:
<!-- partest's dependencies, which marks most of its dependencies as provided,
(but not scala-library, so we filter that one out...)
so we provide them: scala-[library/reflect/compiler], scalap built here,
- scala-xml, scala-parser-combinators via external-modules-nocore,
- scalacheck as part of `partest.classpath` -->
+ scala-xml via external-modules-nocore, as part of `partest.classpath` -->
<restrict>
<path refid="partest.classpath"/>
<rsel:not><rsel:or>
@@ -930,20 +922,8 @@ TODO:
</rsel:or></rsel:not>
</restrict>
<pathelement location="${scala-xml}"/>
- <pathelement location="${scala-parser-combinators}"/>
<!-- <pathelement location="${scala-swing}"/> -->
- <restrict>
- <path refid="scalacheck.classpath"/>
- <rsel:not><rsel:or>
- <rsel:name name="scala-library*.jar"/>
- <rsel:name name="scala-compiler*.jar"/>
- <rsel:name name="scala-reflect*.jar"/>
- <rsel:name name="scala-parser-combinators*.jar"/>
- <rsel:name name="scala-xml*.jar"/>
- </rsel:or></rsel:not>
- </restrict>
-
<!-- partest classes specific to the core compiler build -->
<pathelement location="${partest-extras.jar}"/>
<pathelement location="${partest-javaagent.jar}"/>
@@ -1297,8 +1277,6 @@ TODO:
<include name="${interactive.jar}"/>
<include name="${scaladoc.jar}"/>
-->
-
- <file name="${parser-combinators.jar}"/>
<file name="${xml.jar}"/>
<file name="${swing.jar}"/>
</filelist>
diff --git a/dbuild-meta.json b/dbuild-meta.json
index 4806f9fa5a..ca3ce2a110 100644
--- a/dbuild-meta.json
+++ b/dbuild-meta.json
@@ -48,11 +48,6 @@
"extension" : "jar",
"name" : "scala-xml",
"organization" : "org.scala-lang.modules"
- },
- {
- "extension" : "jar",
- "name" : "scala-parser-combinators",
- "organization" : "org.scala-lang.modules"
}
],
"name" : "scala-compiler",
diff --git a/doc/LICENSE.md b/doc/LICENSE.md
index a07ba32e0b..0718c43e05 100644
--- a/doc/LICENSE.md
+++ b/doc/LICENSE.md
@@ -46,6 +46,7 @@ This license is used by the following third-party libraries:
This license is used by the following third-party libraries:
* jline
+ * scalacheck
### [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
This license is used by the following third-party libraries:
diff --git a/doc/licenses/bsd_scalacheck.txt b/doc/licenses/bsd_scalacheck.txt
new file mode 100644
index 0000000000..f1920752e0
--- /dev/null
+++ b/doc/licenses/bsd_scalacheck.txt
@@ -0,0 +1,32 @@
+ScalaCheck LICENSE
+
+Copyright (c) 2007-2013, Rickard Nilsson
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software in source
+or binary form for any purpose with or without fee is hereby granted,
+provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the name of the author nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
diff --git a/project/PartestUtil.scala b/project/PartestUtil.scala
index 8793e9c0a5..99b978515c 100644
--- a/project/PartestUtil.scala
+++ b/project/PartestUtil.scala
@@ -29,7 +29,7 @@ object PartestUtil {
val knownUnaryOptions = List(
"--pos", "--neg", "--run", "--jvm", "--res", "--ant", "--scalap", "--specialized",
"--scalacheck", "--instrumented", "--presentation", "--failed", "--update-check",
- "--show-diff", "--verbose", "--terse", "--debug", "--version", "--self-test", "--help")
+ "--show-diff", "--show-log", "--verbose", "--terse", "--debug", "--version", "--self-test", "--help")
val srcPathOption = "--srcpath"
val grepOption = "--grep"
diff --git a/project/ScriptCommands.scala b/project/ScriptCommands.scala
index e5ff38617e..8d5d09943a 100644
--- a/project/ScriptCommands.scala
+++ b/project/ScriptCommands.scala
@@ -4,30 +4,112 @@ import BuildSettings.autoImport._
/** Custom commands for use by the Jenkins scripts. This keeps the surface area and call syntax small. */
object ScriptCommands {
- def all = Seq(setupPublishCore, setupValidateTest)
-
- /** Set up the environment for `validate/publish-core`. The argument is the Artifactory snapshot repository URL. */
- def setupPublishCore = Command.single("setupPublishCore") { case (state, url) =>
- Project.extract(state).append(Seq(
- baseVersionSuffix in Global := "SHA-SNAPSHOT",
- // Append build.timestamp to Artifactory URL to get consistent build numbers (see https://github.com/sbt/sbt/issues/2088):
- publishTo in Global := Some("scala-pr" at url.replaceAll("/$", "") + ";build.timestamp=" + System.currentTimeMillis),
- publishArtifact in (Compile, packageDoc) in ThisBuild := false,
- scalacOptions in Compile in ThisBuild += "-Yopt:l:classpath",
- logLevel in ThisBuild := Level.Info,
- logLevel in update in ThisBuild := Level.Warn
- ), state)
- }
+ def all = Seq(
+ setupPublishCore,
+ setupValidateTest,
+ setupBootstrapStarr, setupBootstrapLocker, setupBootstrapQuick, setupBootstrapPublish
+ )
+
+ /** Set up the environment for `validate/publish-core`.
+ * The optional argument is the Artifactory snapshot repository URL. */
+ def setupPublishCore = setup("setupPublishCore") { args =>
+ Seq(
+ baseVersionSuffix in Global := "SHA-SNAPSHOT"
+ ) ++ (args match {
+ case Seq(url) => publishTarget(url)
+ case Nil => Nil
+ }) ++ noDocs ++ enableOptimizer
+ }
- /** Set up the environment for `validate/test`. The argument is the Artifactory snapshot repository URL. */
- def setupValidateTest = Command.single("setupValidateTest") { case (state, url) =>
- //TODO When ant is gone, pass starr version as an argument to this command instead of using version.properties
- Project.extract(state).append(Seq(
+ /** Set up the environment for `validate/test`.
+ * The optional argument is the Artifactory snapshot repository URL. */
+ def setupValidateTest = setup("setupValidateTest") { args =>
+ Seq(
+ testOptions in IntegrationTest in LocalProject("test") ++= Seq(Tests.Argument("--show-log"), Tests.Argument("--show-diff"))
+ ) ++ (args match {
+ case Seq(url) => Seq(resolvers in Global += "scala-pr" at url)
+ case Nil => Nil
+ }) ++ enableOptimizer
+ }
+
+ /** Set up the environment for building STARR in `validate/bootstrap`. The arguments are:
+ * - Repository URL for publishing
+ * - Version number to publish */
+ def setupBootstrapStarr = setup("setupBootstrapStarr") { case Seq(url, ver) =>
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT"
+ ) ++ publishTarget(url) ++ noDocs ++ enableOptimizer
+ }
+
+ /** Set up the environment for building locker in `validate/bootstrap`. The arguments are:
+ * - Repository URL for publishing locker and resolving STARR
+ * - Version number to publish */
+ def setupBootstrapLocker = setup("setupBootstrapLocker") { case Seq(url, ver) =>
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT",
+ resolvers in Global += "scala-pr" at url
+ ) ++ publishTarget(url) ++ noDocs ++ enableOptimizer
+ }
+
+ /** Set up the environment for building quick in `validate/bootstrap`. The arguments are:
+ * - Repository URL for publishing
+ * - Version number to publish */
+ def setupBootstrapQuick = setup("setupBootstrapQuick") { case Seq(url, ver) =>
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT",
resolvers in Global += "scala-pr" at url,
- scalacOptions in Compile in ThisBuild += "-opt:l:classpath",
- testOptions in IntegrationTest in LocalProject("test") ++= Seq(Tests.Argument("--show-log"), Tests.Argument("--show-diff")),
- logLevel in ThisBuild := Level.Info,
- logLevel in update in ThisBuild := Level.Warn
- ), state)
+ testOptions in IntegrationTest in LocalProject("test") ++= Seq(Tests.Argument("--show-log"), Tests.Argument("--show-diff"))
+ ) ++ publishTarget(url) ++ enableOptimizer
+ }
+
+ /** Set up the environment for publishing in `validate/bootstrap`. The arguments are:
+ * - Temporary bootstrap repository URL for resolving modules
+ * - Version number to publish
+ * All artifacts are published to Sonatype. */
+ def setupBootstrapPublish = setup("setupBootstrapPublish") { case Seq(url, ver) =>
+ // Define a copy of the setting key here in case the plugin is not part of the build
+ val pgpPassphrase = SettingKey[Option[Array[Char]]]("pgp-passphrase", "The passphrase associated with the secret used to sign artifacts.", KeyRanks.BSetting)
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT",
+ resolvers in Global += "scala-pr" at url,
+ publishTo in Global := Some("sonatype-releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
+ credentials in Global += Credentials(Path.userHome / ".credentials-sonatype"),
+ pgpPassphrase in Global := Some(Array.empty)
+ ) ++ enableOptimizer
+ }
+
+ private[this] def setup(name: String)(f: Seq[String] => Seq[Setting[_]]) =
+ Command.args(name, name) { case (state, seq) => Project.extract(state).append(f(seq) ++ resetLogLevels, state) }
+
+ private[this] val resetLogLevels = Seq(
+ logLevel in ThisBuild := Level.Info,
+ logLevel in update in ThisBuild := Level.Warn
+ )
+
+ private[this] val enableOptimizer = Seq(
+ scalacOptions in Compile in ThisBuild += "-opt:l:classpath"
+ )
+
+ private[this] val noDocs = Seq(
+ publishArtifact in (Compile, packageDoc) in ThisBuild := false
+ )
+
+ private[this] def publishTarget(url: String) = {
+ // Append build.timestamp to Artifactory URL to get consistent build numbers (see https://github.com/sbt/sbt/issues/2088):
+ val url2 = if(url.startsWith("file:")) url else url.replaceAll("/$", "") + ";build.timestamp=" + System.currentTimeMillis
+ Seq(publishTo in Global := Some("scala-pr-publish" at url2))
+ }
+
+ /** Like `Def.sequential` but accumulate all results */
+ def sequence[B](tasks: List[Def.Initialize[Task[B]]]): Def.Initialize[Task[List[B]]] = tasks match {
+ case Nil => Def.task { Nil }
+ case x :: xs => Def.taskDyn {
+ val v = x.value
+ sequence(xs).apply((t: Task[List[B]]) => t.map(l => v :: l))
+ }
}
}
diff --git a/project/VersionUtil.scala b/project/VersionUtil.scala
index 4705bbb6ce..6fe2b004f7 100644
--- a/project/VersionUtil.scala
+++ b/project/VersionUtil.scala
@@ -61,7 +61,7 @@ object VersionUtil {
val (base, suffix) = {
val (b, s) = (baseVersion.value, baseVersionSuffix.value)
if(s == "SPLIT") {
- val split = """([\w+\.]+)(-[\w+\.]+)??""".r
+ val split = """([\w+\.]+)(-[\w+\.-]+)??""".r
val split(b2, sOrNull) = b
(b2, Option(sOrNull).map(_.drop(1)).getOrElse(""))
} else (b, s)
@@ -94,7 +94,7 @@ object VersionUtil {
}
private lazy val generateBuildCharacterPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task {
- writeProps(versionProperties.value.toMap, (baseDirectory in ThisBuild).value / "buildcharacter.properties")
+ writeProps(versionProperties.value.toMap ++ versionProps, (baseDirectory in ThisBuild).value / "buildcharacter.properties")
}
private def writeProps(m: Map[String, String], propFile: File): File = {
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 98ec8f16ed..0a5b8f3dd4 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -11,9 +11,9 @@ enablePlugins(BuildInfoPlugin)
// configure sbt-buildinfo to send the externalDependencyClasspath to the main build, which allows using it for the IntelliJ project config
-lazy val buildClasspath = taskKey[String]("Colon-separated list of entries on the sbt build classpath.")
+lazy val buildClasspath = taskKey[String]("Colon-separated (or semicolon-separated in case of Windows) list of entries on the sbt build classpath.")
-buildClasspath := (externalDependencyClasspath in Compile).value.map(_.data).mkString(":")
+buildClasspath := (externalDependencyClasspath in Compile).value.map(_.data).mkString(java.io.File.pathSeparator)
buildInfoKeys := Seq[BuildInfoKey](buildClasspath)
diff --git a/scripts/common b/scripts/common
index bfddf3d149..95389e5495 100644
--- a/scripts/common
+++ b/scripts/common
@@ -154,3 +154,23 @@ EOF
fi
popd
}
+
+# Generate a repositories file with all allowed repositories in our build environment.
+# Takes one optional argument, the private repository URL.
+# See http://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html
+function generateRepositoriesConfig() {
+ jcenterCacheUrl=${jcenterCacheUrl-"https://scala-ci.typesafe.com/artifactory/jcenter/"}
+ sbtRepositoryConfig="$scriptsDir/sbt-repositories-config"
+ echo > "$sbtRepositoryConfig" '[repositories]'
+ if [ -n "$1" ]
+ then
+ echo >> "$sbtRepositoryConfig" " private-repo: $1"
+ fi
+ cat >> "$sbtRepositoryConfig" << EOF
+ jcenter-cache: $jcenterCacheUrl
+ typesafe-ivy-releases: https://dl.bintray.com/typesafe/ivy-releases/, [organisation]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
+ sbt-plugin-releases: https://dl.bintray.com/sbt/sbt-plugin-releases/, [organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
+ maven-central
+ local
+EOF
+}
diff --git a/scripts/jobs/integrate/bootstrap b/scripts/jobs/integrate/bootstrap
index 76673b4f32..4d5dae89a2 100644
--- a/scripts/jobs/integrate/bootstrap
+++ b/scripts/jobs/integrate/bootstrap
@@ -85,14 +85,12 @@
moduleVersioning=${moduleVersioning-"versions.properties"}
publishPrivateTask=${publishPrivateTask-"publish"}
-publishSonatypeTaskCore=${publishSonatypeTaskCore-"publish-signed"}
-publishSonatypeTaskModules=${publishSonatypeTaskModules-"publish-signed"}
-publishStarrPrivateTask=${publishStarrPrivateTask-$publishPrivateTask} # set to "init" to speed up testing of the script (if you already built STARR before)
-publishLockerPrivateTask=${publishLockerPrivateTask-$publishPrivateTask} # set to "init" to speed up testing of the script (if you already built locker before)
+publishSonatypeTaskCore=${publishSonatypeTaskCore-"publishSigned"}
+publishSonatypeTaskModules=${publishSonatypeTaskModules-"publishSigned"}
forceRebuild=${forceRebuild-no}
-antBuildTask="${antBuildTask-nightly}" # TESTING leave empty to avoid the sanity check (don't set it to "init" because ant will croak)
+sbtBuildTask="testAll" # TESTING leave empty to avoid the sanity check
clean="clean" # TESTING leave empty to speed up testing
baseDir=${WORKSPACE-`pwd`}
@@ -111,21 +109,7 @@ mkdir -p $baseDir/resolutionScratch_
# repo used to publish "locker" scala to (to start the bootstrap)
releaseTempRepoCred="private-repo"
releaseTempRepoUrl=${releaseTempRepoUrl-"https://scala-ci.typesafe.com/artifactory/scala-release-temp/"}
-jcenterCacheUrl=${jcenterCacheUrl-"https://scala-ci.typesafe.com/artifactory/jcenter/"}
-
-# Used below in sbtArgs since we use a dedicated repository to share artifcacts between jobs,
-# so we need to configure SBT to use these rather than its default, Maven Central.
-# See http://www.scala-sbt.org/0.13/docs/Proxy-Repositories.html
-sbtRepositoryConfig="$scriptsDir/repositories-scala-release"
-cat > "$sbtRepositoryConfig" << EOF
-[repositories]
- private-repo: $releaseTempRepoUrl
- jcenter-cache: $jcenterCacheUrl
- typesafe-ivy-releases: https://dl.bintray.com/typesafe/ivy-releases/, [organisation]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
- sbt-plugin-releases: https://dl.bintray.com/sbt/sbt-plugin-releases/, [organisation]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
- maven-central
- local
-EOF
+generateRepositoriesConfig $releaseTempRepoUrl
##### git
gfxd() {
@@ -174,11 +158,11 @@ function st_stagingRepoClose() {
# the old version (on jenkins, and I don't want to upgrade for risk of breaking other builds) honors -sbt-dir
# the new version of sbt-extras ignores sbt-dir, so we pass it in as -Dsbt.global.base
# need to set sbt-dir to one that has the gpg.sbt plugin config
-sbtArgs="-no-colors -ivy $baseDir/ivy2 -Dsbt.override.build.repos=true -Dsbt.repository.config=$sbtRepositoryConfig -Dsbt.global.base=$HOME/.sbt/0.13 -sbt-dir $HOME/.sbt/0.13"
+sbtArgs="-ivy $baseDir/ivy2 -Dsbt.override.build.repos=true -Dsbt.repository.config=$sbtRepositoryConfig -Dsbt.global.base=$HOME/.sbt/0.13 -sbt-dir $HOME/.sbt/0.13"
sbtBuild() {
- echo "### sbtBuild: "$SBT_CMD $sbtArgs "${scalaVersionTasks[@]}" "${publishTasks[@]}" "$@"
- $SBT_CMD $sbtArgs "${scalaVersionTasks[@]}" "${publishTasks[@]}" "$@" >> $baseDir/logs/builds 2>&1
+ echo "### sbtBuild: "$SBT_CMD -no-colors $sbtArgs "${scalaVersionTasks[@]}" "${publishTasks[@]}" "$@"
+ $SBT_CMD -no-colors $sbtArgs "${scalaVersionTasks[@]}" "${publishTasks[@]}" "$@" >> $baseDir/logs/builds 2>&1
}
sbtResolve() {
@@ -186,8 +170,8 @@ sbtResolve() {
touch build.sbt
# Can be set to `full` if a module requires cross-versioning against the full Scala version, like the continuations plugin used to.
cross=${4-binary}
- echo "### sbtResolve: $SBT_CMD $sbtArgs " "${scalaVersionTasks[@]}" "\"$1\" % \"$2\" % \"$3\" cross CrossVersion.$cross"
- $SBT_CMD $sbtArgs "${scalaVersionTasks[@]}" \
+ echo "### sbtResolve: $SBT_CMD -no-colors $sbtArgs " "${scalaVersionTasks[@]}" "\"$1\" % \"$2\" % \"$3\" cross CrossVersion.$cross"
+ $SBT_CMD -no-colors $sbtArgs "${scalaVersionTasks[@]}" \
"set libraryDependencies := Seq(\"$1\" % \"$2\" % \"$3\" cross CrossVersion.$cross)" \
'show update' >> $baseDir/logs/resolution 2>&1
}
@@ -247,7 +231,7 @@ buildPartest() {
else
update scala scala-partest "$PARTEST_REF" && gfxd
doc="$(docTask $PARTEST_BUILT)"
- sbtBuild 'set version :="'$PARTEST_VER'"' 'set VersionKeys.scalaXmlVersion := "'$XML_VER'"' 'set VersionKeys.scalaCheckVersion := "'$SCALACHECK_VER'"' $clean "$doc" test "${buildTasks[@]}"
+ sbtBuild 'set version :="'$PARTEST_VER'"' 'set VersionKeys.scalaXmlVersion := "'$XML_VER'"' $clean "$doc" test "${buildTasks[@]}"
PARTEST_BUILT="yes"
fi
}
@@ -282,7 +266,7 @@ buildModules() {
buildXML
buildParsers
buildSwing
- buildScalacheck
+ # buildScalacheck
buildPartest
}
@@ -424,7 +408,7 @@ deriveModuleVersions() {
echo "Module versions (versioning strategy: $moduleVersioning):"
echo "PARSERS = $PARSERS_VER at $PARSERS_REF"
echo "PARTEST = $PARTEST_VER at $PARTEST_REF"
- echo "SCALACHECK = $SCALACHECK_VER at $SCALACHECK_REF"
+ # echo "SCALACHECK = $SCALACHECK_VER at $SCALACHECK_REF"
echo "SWING = $SWING_VER at $SWING_REF"
echo "XML = $XML_VER at $XML_REF"
@@ -444,7 +428,7 @@ removeExistingBuilds() {
local storageApiUrl=`echo $releaseTempRepoUrl | sed 's/\(scala-release-temp\)/api\/storage\/\1/'`
local scalaLangModules=`curl -s $storageApiUrl/org/scala-lang | jq -r '.children | .[] | "org/scala-lang" + .uri' | grep -v actors-migration`
- for module in "org/scalacheck" $scalaLangModules; do
+ for module in $scalaLangModules; do
local artifacts=`curl -s $storageApiUrl/$module | jq -r ".children | .[] | select(.uri | contains(\"$SCALA_VER\")) | .uri"`
for artifact in $artifacts; do
echo "Deleting $releaseTempRepoUrl$module$artifact"
@@ -464,7 +448,7 @@ constructUpdatedModuleVersions() {
updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dscala-xml.version.number=$XML_VER")
updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dpartest.version.number=$PARTEST_VER")
- updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dscalacheck.version.number=$SCALACHECK_VER")
+ # updatedModuleVersions=("${updatedModuleVersions[@]}" "-Dscalacheck.version.number=$SCALACHECK_VER")
# allow overriding the jline version using a jenkins build parameter
if [ ! -z "$JLINE_VER" ] ; then updatedModuleVersions=("${updatedModuleVersions[@]}" "-Djline.version=$JLINE_VER"); fi
@@ -490,13 +474,7 @@ bootstrap() {
git clone --reference $WORKSPACE/.git $WORKSPACE/.git $STARR_DIR
cd $STARR_DIR
git co $STARR_REF
- ant -Dmaven.version.number=$STARR_VER\
- -Dremote.snapshot.repository=NOPE\
- -Dremote.release.repository=$releaseTempRepoUrl\
- -Drepository.credentials.id=$releaseTempRepoCred\
- -Ddocs.skip=1\
- -Dlocker.skip=1\
- $publishStarrPrivateTask >> $baseDir/logs/builds 2>&1
+ $SBT_CMD -no-colors $sbtArgs --warn "setupBootstrapStarr $releaseTempRepoUrl $STARR_VER" $clean publish >> $baseDir/logs/builds 2>&1
)
fi
@@ -510,14 +488,7 @@ bootstrap() {
# publish more than just core: partest needs scalap
# in sabbus lingo, the resulting Scala build will be used as starr to build the released Scala compiler
if [ ! -z "$STARR_VER" ]; then SET_STARR=-Dstarr.version=$STARR_VER; fi
- ant -Dmaven.version.number=$SCALA_VER\
- -Dremote.snapshot.repository=NOPE\
- $SET_STARR\
- -Dremote.release.repository=$releaseTempRepoUrl\
- -Drepository.credentials.id=$releaseTempRepoCred\
- -Ddocs.skip=1\
- -Dlocker.skip=1\
- $publishLockerPrivateTask >> $baseDir/logs/builds 2>&1
+ $SBT_CMD -no-colors $sbtArgs $SET_STARR --warn "setupBootstrapLocker $releaseTempRepoUrl $SCALA_VER" $clean publish >> $baseDir/logs/builds 2>&1
echo "### Building modules using locker"
@@ -534,7 +505,7 @@ bootstrap() {
echo "### Bootstrapping Scala using locker"
# # TODO: close all open staging repos so that we can be reasonably sure the only open one we see after publishing below is ours
- # # the ant call will create a new one
+ # # the sbt call will create a new one
#
# Rebuild Scala with these modules so that all binary versions are consistent.
# Update versions.properties to new modules.
@@ -542,23 +513,35 @@ bootstrap() {
# don't skip locker (-Dlocker.skip=1), or stability will fail
# overwrite "locker" version of scala at private-repo with bootstrapped version
cd $baseDir
- rm -rf build/ # must leave everything else in $baseDir for downstream jobs
+ rm -rf build/
- ant -Dstarr.version=$SCALA_VER\
- -Dextra.repo.url=$releaseTempRepoUrl\
- -Dmaven.version.suffix=$SCALA_VER_SUFFIX\
+ $SBT_CMD $sbtArgs \
+ --warn \
+ -Dstarr.version=$SCALA_VER \
${updatedModuleVersions[@]} \
- -Dupdate.versions=1\
- -Dscaladoc.git.commit=$SCALADOC_SOURCE_LINKS_VER\
- -Dremote.snapshot.repository=NOPE\
- -Dremote.release.repository=$releaseTempRepoUrl\
- -Drepository.credentials.id=$releaseTempRepoCred\
- -Dscalac.args.optimise=-opt:l:classpath\
- $antBuildTask $publishPrivateTask
+ "setupBootstrapQuick $releaseTempRepoUrl $SCALA_VER" \
+ $clean \
+ $sbtBuildTask \
+ dist/mkQuick \
+ publish | grep -v "was too long to be displayed in the webview, and will be left out"
# clear ivy cache (and to be sure, local as well), so the next round of sbt builds sees the fresh scala
rm -rf $baseDir/ivy2
+ # Run stability tests using the just built version as "quick" and a new version as "strap"
+ mv build/quick quick1
+ rm -rf build/
+ $SBT_CMD $sbtArgs \
+ --warn \
+ -Dstarr.version=$SCALA_VER \
+ ${updatedModuleVersions[@]} \
+ "setupBootstrapQuick $releaseTempRepoUrl $SCALA_VER" \
+ $clean \
+ dist/mkQuick
+ mv build/quick build/strap
+ mv quick1 build/quick
+ tools/stability-test.sh
+
# TODO: create PR with following commit (note that release will have been tagged already)
# git commit versions.properties -m"Bump versions.properties for $SCALA_VER."
}
@@ -571,7 +554,12 @@ publishSonatype() {
# stage to sonatype, along with all modules -Dmaven.version.suffix/-Dbuild.release not necessary,
# since we're just publishing an existing build
echo "### Publishing core to sonatype"
- ant -Dmaven.version.number=$SCALA_VER $publishSonatypeTaskCore
+ $SBT_CMD $sbtArgs \
+ --warn \
+ -Dstarr.version=$SCALA_VER \
+ ${updatedModuleVersions[@]} \
+ "setupBootstrapPublish $releaseTempRepoUrl $SCALA_VER" \
+ $publishSonatypeTaskCore | grep -v "was too long to be displayed in the webview, and will be left out"
echo "### Publishing modules to sonatype"
# build/test/publish scala core modules to sonatype (this will start a new staging repo)
diff --git a/scripts/jobs/integrate/windows b/scripts/jobs/integrate/windows
index ba48c5bc25..5e04b0b380 100755
--- a/scripts/jobs/integrate/windows
+++ b/scripts/jobs/integrate/windows
@@ -1,15 +1,19 @@
#!/bin/bash
-./pull-binary-libs.sh
-
-export ANT_OPTS="-Dfile.encoding=UTF-8 -server -XX:+AggressiveOpts -XX:+UseParNewGC -Xmx2G -Xss1M -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=128M"
-
-# TODO: don't hardcode these paths -- should be in scala/scala-jenkins-infra, passed in through env vars from jenkins
-export PATH='/cygdrive/c/Program Files/Java/jdk1.8.0_92/bin:/cygdrive/c/apache-ant-1.9.6/bin:/cygdrive/c/Program Files (x86)/Git-2.5.3/Cmd:/bin:/usr/bin:'
-export JAVA_HOME='C:/Program Files/Java/jdk1.8.0_92'
+baseDir=${WORKSPACE-`pwd`}
+scriptsDir="$baseDir/scripts"
+. $scriptsDir/common
java -version
javac -version
-ant -version
-ant test-opt
+generateRepositoriesConfig
+
+SBT="java $JAVA_OPTS -Dsbt.ivy.home=$WORKSPACE/.ivy2 -jar $sbtLauncher -Dsbt.override.build.repos=true -Dsbt.repository.config=$sbtRepositoryConfig"
+
+# Build locker with STARR
+$SBT --warn "setupPublishCore" generateBuildCharacterPropertiesFile publishLocal
+
+# Build quick and run the tests
+parseScalaProperties buildcharacter.properties
+$SBT -Dstarr.version=$maven_version_number --warn "setupValidateTest" testAll | grep -v "was too long to be displayed in the webview, and will be left out"
diff --git a/scripts/jobs/validate/publish-core b/scripts/jobs/validate/publish-core
index b0bfd48083..c71fbd12b7 100755
--- a/scripts/jobs/validate/publish-core
+++ b/scripts/jobs/validate/publish-core
@@ -9,6 +9,9 @@ baseDir=${WORKSPACE-`pwd`}
scriptsDir="$baseDir/scripts"
. $scriptsDir/common
+generateRepositoriesConfig $prRepoUrl
+SBT="$SBT_CMD -Dsbt.override.build.repos=true -Dsbt.repository.config=$sbtRepositoryConfig"
+
case $prDryRun in
yep)
echo "DRY RUN"
@@ -16,7 +19,7 @@ case $prDryRun in
;;
*)
echo ">>> Getting Scala version number."
- $SBT_CMD --warn "setupPublishCore $prRepoUrl" generateBuildCharacterPropertiesFile
+ $SBT --warn "setupPublishCore $prRepoUrl" generateBuildCharacterPropertiesFile
parseScalaProperties buildcharacter.properties # produce maven_version_number
echo ">>> Checking availability of Scala ${maven_version_number} in $prRepoUrl."
@@ -27,7 +30,7 @@ case $prDryRun in
if $libraryAvailable && $reflectAvailable && $compilerAvailable; then
echo "Scala core already built!"
else
- $SBT_CMD --warn "setupPublishCore $prRepoUrl" publish
+ $SBT --warn "setupPublishCore $prRepoUrl" publish
fi
mv buildcharacter.properties jenkins.properties # parsed by the jenkins job
diff --git a/scripts/jobs/validate/test b/scripts/jobs/validate/test
index 3cd8af5608..9938319dd8 100755
--- a/scripts/jobs/validate/test
+++ b/scripts/jobs/validate/test
@@ -4,6 +4,9 @@ baseDir=${WORKSPACE-`pwd`}
scriptsDir="$baseDir/scripts"
. $scriptsDir/common
+generateRepositoriesConfig $prRepoUrl
+SBT="$SBT_CMD -Dsbt.override.build.repos=true -Dsbt.repository.config=$sbtRepositoryConfig"
+
case $prDryRun in
yep)
@@ -15,21 +18,12 @@ case $prDryRun in
# build quick using STARR built upstream, as specified by scalaVersion
# (in that sense it's locker, since it was built with starr by that upstream job);
# and run JUnit tests, partest, OSGi tests, MiMa and scaladoc
- $SBT_CMD \
+ $SBT \
-Dstarr.version=$scalaVersion \
--warn \
"setupValidateTest $prRepoUrl" \
$testExtraArgs \
- "test" \
- "partest run pos neg jvm" \
- "partest res scalap specialized scalacheck" \
- "partest instrumented presentation" \
- "partest --srcpath scaladoc" \
- osgiTestFelix/test \
- osgiTestEclipse/test \
- library/mima \
- reflect/mima \
- doc
+ testAll | grep -v "was too long to be displayed in the webview, and will be left out"
;;
diff --git a/src/build/bnd/scala-compiler.bnd b/src/build/bnd/scala-compiler.bnd
index 3e60c4973c..c12c84c3f9 100644
--- a/src/build/bnd/scala-compiler.bnd
+++ b/src/build/bnd/scala-compiler.bnd
@@ -5,7 +5,6 @@ Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: jline.*;resolution:=optional, \
org.apache.tools.ant.*;resolution:=optional, \
- scala.util.parsing.*;version="${range;[====,====];@PARSER_COMBINATORS_VERSION@}";resolution:=optional, \
scala.xml.*;version="${range;[====,====];@XML_VERSION@}";resolution:=optional, \
scala.*;version="${range;[==,=+);${ver}}", \
*
diff --git a/src/build/dbuild-meta-json-gen.scala b/src/build/dbuild-meta-json-gen.scala
index 043ad19b2e..6405650d88 100644
--- a/src/build/dbuild-meta-json-gen.scala
+++ b/src/build/dbuild-meta-json-gen.scala
@@ -23,8 +23,7 @@ val meta =
Project("scala-compiler", "org.scala-lang",
Seq(ProjectRef("scala-compiler", "org.scala-lang")),
Seq(ProjectRef("scala-reflect", "org.scala-lang"),
- ProjectRef("scala-xml", "org.scala-lang.modules"),
- ProjectRef("scala-parser-combinators", "org.scala-lang.modules")
+ ProjectRef("scala-xml", "org.scala-lang.modules")
)),
// Project("scala-repl", "org.scala-lang",
@@ -37,7 +36,7 @@ val meta =
// Project("scaladoc", "org.scala-lang",
// Seq(ProjectRef("scaladoc", "org.scala-lang")),
- // Seq(ProjectRef("scala-compiler", "org.scala-lang"),ProjectRef("scala-partest", "org.scala-lang"), ProjectRef("scala-xml", "org.scala-lang"), ProjectRef("scala-parser-combinators", "org.scala-lang"))),
+ // Seq(ProjectRef("scala-compiler", "org.scala-lang"),ProjectRef("scala-partest", "org.scala-lang"), ProjectRef("scala-xml", "org.scala-lang"))),
Project("scalap", "org.scala-lang",
Seq(ProjectRef("scalap", "org.scala-lang")),
diff --git a/src/build/genprod.scala b/src/build/genprod.scala
index f85a151ae5..fa48b020cc 100644
--- a/src/build/genprod.scala
+++ b/src/build/genprod.scala
@@ -315,8 +315,7 @@ class Tuple(val i: Int) extends Group("Tuple") with Arity {
* @constructor Create a new tuple with {i} elements.{idiomatic}
{params}
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class {className}{covariantArgs}({fields})
+final case class {className}{covariantArgs}({fields})
extends {Product.className(i)}{invariantArgs}
{{
override def toString() = "(" + {mkToString} + ")"
diff --git a/src/build/maven/scala-compiler-doc-pom.xml b/src/build/maven/scala-compiler-doc-pom.xml
index 0c33d23d61..86ca3f865b 100644
--- a/src/build/maven/scala-compiler-doc-pom.xml
+++ b/src/build/maven/scala-compiler-doc-pom.xml
@@ -39,11 +39,6 @@
<artifactId>scala-xml_@SCALA_BINARY_VERSION@</artifactId>
<version>@XML_VERSION@</version>
</dependency>
- <dependency>
- <groupId>org.scala-lang.modules</groupId>
- <artifactId>scala-parser-combinators_@SCALA_BINARY_VERSION@</artifactId>
- <version>@PARSER_COMBINATORS_VERSION@</version>
- </dependency>
</dependencies>
<developers>
<developer>
diff --git a/src/build/maven/scala-compiler-pom.xml b/src/build/maven/scala-compiler-pom.xml
index 15546109c8..9c157d17d9 100644
--- a/src/build/maven/scala-compiler-pom.xml
+++ b/src/build/maven/scala-compiler-pom.xml
@@ -45,11 +45,6 @@
<artifactId>scala-xml_@SCALA_BINARY_VERSION@</artifactId>
<version>@XML_VERSION@</version>
</dependency>
- <dependency> <!-- for scala-compiler-doc -->
- <groupId>org.scala-lang.modules</groupId>
- <artifactId>scala-parser-combinators_@SCALA_BINARY_VERSION@</artifactId>
- <version>@PARSER_COMBINATORS_VERSION@</version>
- </dependency>
<dependency> <!-- for scala-compiler-repl; once it moves there, make it required -->
<groupId>jline</groupId>
<artifactId>jline</artifactId>
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 9d6693c00f..d4c2896c5c 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -411,7 +411,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
override val initial = true
}
- import syntaxAnalyzer.{ UnitScanner, UnitParser }
+ import syntaxAnalyzer.{ UnitScanner, UnitParser, JavaUnitParser }
// !!! I think we're overdue for all these phase objects being lazy vals.
// There's no way for a Global subclass to provide a custom typer
@@ -1042,6 +1042,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
def newUnitParser(code: String, filename: String = "<console>"): UnitParser =
newUnitParser(newCompilationUnit(code, filename))
+ def newJavaUnitParser(unit: CompilationUnit): JavaUnitParser = new JavaUnitParser(unit)
+
/** A Run is a single execution of the compiler on a set of units.
*/
class Run extends RunContextApi with RunReporting with RunParsing {
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 14ee7d7a78..bb695500cc 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -336,12 +336,13 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
* - are associating the RHS with a cloned symbol, but intend for the original
* method to remain and for recursive calls to target it.
*/
- final def mkStatic(orig: DefDef, maybeClone: Symbol => Symbol): DefDef = {
+ final def mkStatic(orig: DefDef, newName: Name, maybeClone: Symbol => Symbol): DefDef = {
assert(phase.erasedTypes, phase)
assert(!orig.symbol.hasFlag(SYNCHRONIZED), orig.symbol.defString)
val origSym = orig.symbol
val origParams = orig.symbol.info.params
val newSym = maybeClone(orig.symbol)
+ newSym.setName(newName)
newSym.setFlag(STATIC)
// Add an explicit self parameter
val selfParamSym = newSym.newSyntheticValueParam(newSym.owner.typeConstructor, nme.SELF).setFlag(ARTIFACT)
@@ -349,25 +350,27 @@ abstract class TreeGen extends scala.reflect.internal.TreeGen with TreeDSL {
case mt @ MethodType(params, res) => copyMethodType(mt, selfParamSym :: params, res)
})
val selfParam = ValDef(selfParamSym)
- val rhs = orig.rhs.substituteThis(newSym.owner, atPos(newSym.pos)(gen.mkAttributedIdent(selfParamSym)))
+ val rhs = orig.rhs.substituteThis(newSym.owner, gen.mkAttributedIdent(selfParamSym)) // SD-186 intentionally leaving Ident($this) is unpositioned
.substituteSymbols(origParams, newSym.info.params.drop(1)).changeOwner(origSym -> newSym)
treeCopy.DefDef(orig, orig.mods, orig.name, orig.tparams, (selfParam :: orig.vparamss.head) :: Nil, orig.tpt, rhs).setSymbol(newSym)
}
- // TODO: the rewrite to AbstractFunction is superfluous once we compile FunctionN to a SAM type (aka functional interface)
- def functionClassType(fun: Function): Type =
- if (isFunctionType(fun.tpe)) abstractFunctionType(fun.vparams.map(_.symbol.tpe), fun.body.tpe.deconst)
- else fun.tpe
-
def expandFunction(localTyper: analyzer.Typer)(fun: Function, inConstructorFlag: Long): Tree = {
- val parents = addSerializable(functionClassType(fun))
- val anonClass = fun.symbol.owner newAnonymousFunctionClass(fun.pos, inConstructorFlag) addAnnotation SerialVersionUIDAnnotation
+ val anonClass = fun.symbol.owner newAnonymousFunctionClass(fun.pos, inConstructorFlag)
+ val parents = if (isFunctionType(fun.tpe)) {
+ anonClass addAnnotation SerialVersionUIDAnnotation
+ addSerializable(abstractFunctionType(fun.vparams.map(_.symbol.tpe), fun.body.tpe.deconst))
+ } else {
+ if (fun.tpe.typeSymbol.isSubClass(JavaSerializableClass))
+ anonClass addAnnotation SerialVersionUIDAnnotation
+ fun.tpe :: Nil
+ }
+ anonClass setInfo ClassInfoType(parents, newScope, anonClass)
// The original owner is used in the backend for the EnclosingMethod attribute. If fun is
// nested in a value-class method, its owner was already changed to the extension method.
// Saving the original owner allows getting the source structure from the class symbol.
defineOriginalOwner(anonClass, fun.symbol.originalOwner)
- anonClass setInfo ClassInfoType(parents, newScope, anonClass)
val samDef = mkMethodFromFunction(localTyper)(anonClass, fun)
anonClass.info.decls enter samDef.symbol
diff --git a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
index df2073785b..e0667b5a3e 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/SyntaxAnalyzer.scala
@@ -82,7 +82,7 @@ abstract class SyntaxAnalyzer extends SubComponent with Parsers with MarkupParse
}
private def initialUnitBody(unit: CompilationUnit): Tree = {
- if (unit.isJava) new JavaUnitParser(unit).parse()
+ if (unit.isJava) newJavaUnitParser(unit).parse()
else if (currentRun.parsing.incompleteHandled) newUnitParser(unit).parse()
else newUnitParser(unit).smartParse()
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index d7106ae908..d5c4b5e201 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -11,11 +11,11 @@ package jvm
import scala.annotation.switch
import scala.reflect.internal.Flags
-
import scala.tools.asm
import GenBCode._
import BackendReporting._
-import scala.tools.asm.tree.MethodInsnNode
+import scala.tools.asm.Opcodes
+import scala.tools.asm.tree.{MethodInsnNode, MethodNode}
import scala.tools.nsc.backend.jvm.BCodeHelpers.{InvokeStyle, TestOp}
/*
@@ -630,14 +630,14 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
case Apply(fun, args) if app.hasAttachment[delambdafy.LambdaMetaFactoryCapable] =>
val attachment = app.attachments.get[delambdafy.LambdaMetaFactoryCapable].get
genLoadArguments(args, paramTKs(app))
- genInvokeDynamicLambda(attachment.target, attachment.arity, attachment.functionalInterface, attachment.sam)
+ genInvokeDynamicLambda(attachment.target, attachment.arity, attachment.functionalInterface, attachment.sam, attachment.isSerializable, attachment.addScalaSerializableMarker)
generatedType = methodBTypeFromSymbol(fun.symbol).returnType
case Apply(fun, List(expr)) if currentRun.runDefinitions.isBox(fun.symbol) =>
val nativeKind = tpeTK(expr)
genLoad(expr, nativeKind)
val MethodNameAndType(mname, methodType) = srBoxesRuntimeBoxToMethods(nativeKind)
- bc.invokestatic(srBoxesRunTimeRef.internalName, mname, methodType.descriptor, app.pos)
+ bc.invokestatic(srBoxesRunTimeRef.internalName, mname, methodType.descriptor, itf = false, app.pos)
generatedType = boxResultType(fun.symbol)
case Apply(fun, List(expr)) if currentRun.runDefinitions.isUnbox(fun.symbol) =>
@@ -645,7 +645,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
val boxType = unboxResultType(fun.symbol)
generatedType = boxType
val MethodNameAndType(mname, methodType) = srBoxesRuntimeUnboxToMethods(boxType)
- bc.invokestatic(srBoxesRunTimeRef.internalName, mname, methodType.descriptor, app.pos)
+ bc.invokestatic(srBoxesRunTimeRef.internalName, mname, methodType.descriptor, itf = false, app.pos)
case app @ Apply(fun, args) =>
val sym = fun.symbol
@@ -1058,31 +1058,40 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
}
receiverClass.info // ensure types the type is up to date; erasure may add lateINTERFACE to traits
- val receiverName = internalName(receiverClass)
-
- // super calls are only allowed to direct parents
- if (style.isSuper && receiverClass.isTraitOrInterface && !cnode.interfaces.contains(receiverName)) {
- thisBType.info.get.inlineInfo.lateInterfaces += receiverName
- cnode.interfaces.add(receiverName)
- }
+ val receiverBType = classBTypeFromSymbol(receiverClass)
+ val receiverName = receiverBType.internalName
def needsInterfaceCall(sym: Symbol) = {
sym.isTraitOrInterface ||
sym.isJavaDefined && sym.isNonBottomSubClass(definitions.ClassfileAnnotationClass)
}
- val jname = method.javaSimpleName.toString
- val bmType = methodBTypeFromSymbol(method)
- val mdescr = bmType.descriptor
+ val jname = method.javaSimpleName.toString
+ val bmType = methodBTypeFromSymbol(method)
+ val mdescr = bmType.descriptor
+ val isInterface = receiverBType.isInterface.get
import InvokeStyle._
- style match {
- case Static => bc.invokestatic (receiverName, jname, mdescr, pos)
- case Special => bc.invokespecial (receiverName, jname, mdescr, pos)
- case Virtual =>
- if (needsInterfaceCall(receiverClass)) bc.invokeinterface(receiverName, jname, mdescr, pos)
- else bc.invokevirtual (receiverName, jname, mdescr, pos)
- case Super => bc.invokespecial (receiverName, jname, mdescr, pos)
+ if (style == Super) {
+ assert(receiverClass == methodOwner, s"for super call, expecting $receiverClass == $methodOwner")
+ if (receiverClass.isTrait && !receiverClass.isJavaDefined) {
+ val staticDesc = MethodBType(typeToBType(method.owner.info) :: bmType.argumentTypes, bmType.returnType).descriptor
+ val staticName = traitImplMethodName(method).toString
+ bc.invokestatic(receiverName, staticName, staticDesc, isInterface, pos)
+ } else {
+ if (receiverClass.isTraitOrInterface) {
+ // An earlier check in Mixin reports an error in this case, so it doesn't reach the backend
+ assert(cnode.interfaces.contains(receiverName), s"cannot invokespecial $receiverName.$jname, the interface is not a direct parent.")
+ }
+ bc.invokespecial(receiverName, jname, mdescr, isInterface, pos)
+ }
+ } else {
+ val opc = style match {
+ case Static => Opcodes.INVOKESTATIC
+ case Special => Opcodes.INVOKESPECIAL
+ case Virtual => if (isInterface) Opcodes.INVOKEINTERFACE else Opcodes.INVOKEVIRTUAL
+ }
+ bc.emitInvoke(opc, receiverName, jname, mdescr, isInterface, pos)
}
bmType.returnType
@@ -1321,37 +1330,37 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
def genSynchronized(tree: Apply, expectedType: BType): BType
def genLoadTry(tree: Try): BType
- def genInvokeDynamicLambda(lambdaTarget: Symbol, arity: Int, functionalInterface: Symbol, sam: Symbol) {
+ def genInvokeDynamicLambda(lambdaTarget: Symbol, arity: Int, functionalInterface: Symbol, sam: Symbol, isSerializable: Boolean, addScalaSerializableMarker: Boolean) {
val isStaticMethod = lambdaTarget.hasFlag(Flags.STATIC)
def asmType(sym: Symbol) = classBTypeFromSymbol(sym).toASMType
+ val isInterface = lambdaTarget.owner.isTrait
val implMethodHandle =
- new asm.Handle(if (lambdaTarget.hasFlag(Flags.STATIC)) asm.Opcodes.H_INVOKESTATIC else if (lambdaTarget.owner.isTrait) asm.Opcodes.H_INVOKEINTERFACE else asm.Opcodes.H_INVOKEVIRTUAL,
+ new asm.Handle(if (lambdaTarget.hasFlag(Flags.STATIC)) asm.Opcodes.H_INVOKESTATIC else if (isInterface) asm.Opcodes.H_INVOKEINTERFACE else asm.Opcodes.H_INVOKEVIRTUAL,
classBTypeFromSymbol(lambdaTarget.owner).internalName,
lambdaTarget.name.toString,
- methodBTypeFromSymbol(lambdaTarget).descriptor)
+ methodBTypeFromSymbol(lambdaTarget).descriptor,
+ /* itf = */ isInterface)
val receiver = if (isStaticMethod) Nil else lambdaTarget.owner :: Nil
val (capturedParams, lambdaParams) = lambdaTarget.paramss.head.splitAt(lambdaTarget.paramss.head.length - arity)
- // Requires https://github.com/scala/scala-java8-compat on the runtime classpath
val invokedType = asm.Type.getMethodDescriptor(asmType(functionalInterface), (receiver ::: capturedParams).map(sym => typeToBType(sym.info).toASMType): _*)
-
val constrainedType = new MethodBType(lambdaParams.map(p => typeToBType(p.tpe)), typeToBType(lambdaTarget.tpe.resultType)).toASMType
- val samName = sam.name.toString
val samMethodType = methodBTypeFromSymbol(sam).toASMType
-
- val flags = java.lang.invoke.LambdaMetafactory.FLAG_SERIALIZABLE | java.lang.invoke.LambdaMetafactory.FLAG_MARKERS
-
- val ScalaSerializable = classBTypeFromSymbol(definitions.SerializableClass).toASMType
- bc.jmethod.visitInvokeDynamicInsn(samName, invokedType, lambdaMetaFactoryBootstrapHandle,
- /* samMethodType = */ samMethodType,
- /* implMethod = */ implMethodHandle,
- /* instantiatedMethodType = */ constrainedType,
- /* flags = */ flags.asInstanceOf[AnyRef],
- /* markerInterfaceCount = */ 1.asInstanceOf[AnyRef],
- /* markerInterfaces[0] = */ ScalaSerializable,
- /* bridgeCount = */ 0.asInstanceOf[AnyRef]
- )
- indyLambdaHosts += cnode.name
+ val markers = if (addScalaSerializableMarker) classBTypeFromSymbol(definitions.SerializableClass).toASMType :: Nil else Nil
+ visitInvokeDynamicInsnLMF(bc.jmethod, sam.name.toString, invokedType, samMethodType, implMethodHandle, constrainedType, isSerializable, markers)
+ if (isSerializable)
+ indyLambdaHosts += cnode.name
}
}
+
+ private def visitInvokeDynamicInsnLMF(jmethod: MethodNode, samName: String, invokedType: String, samMethodType: asm.Type,
+ implMethodHandle: asm.Handle, instantiatedMethodType: asm.Type,
+ serializable: Boolean, markerInterfaces: Seq[asm.Type]) = {
+ import java.lang.invoke.LambdaMetafactory.{FLAG_MARKERS, FLAG_SERIALIZABLE}
+ def flagIf(b: Boolean, flag: Int): Int = if (b) flag else 0
+ val flags = FLAG_MARKERS | flagIf(serializable, FLAG_SERIALIZABLE)
+ val bsmArgs = Seq(samMethodType, implMethodHandle, instantiatedMethodType, Int.box(flags), Int.box(markerInterfaces.length)) ++ markerInterfaces
+ jmethod.visitInvokeDynamicInsn(samName, invokedType, lambdaMetaFactoryAltMetafactoryHandle, bsmArgs: _*)
+ }
+
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
index 5a5747c81f..d779490ba8 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
@@ -11,6 +11,7 @@ import scala.tools.asm
import scala.tools.nsc.io.AbstractFile
import GenBCode._
import BackendReporting._
+import scala.reflect.internal.Flags
/*
* Traits encapsulating functionality to convert Scala AST Trees into ASM ClassNodes.
@@ -49,6 +50,14 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
}
}
+ def needsStaticImplMethod(sym: Symbol) = sym.hasAttachment[global.mixer.NeedStaticImpl.type]
+
+ final def traitImplMethodName(sym: Symbol): Name = {
+ val name = sym.javaSimpleName
+ if (sym.isMixinConstructor) name
+ else name.append(nme.NAME_JOIN_STRING)
+ }
+
/**
* True if `classSym` is an anonymous class or a local class. I.e., false if `classSym` is a
* member class. This method is used to decide if we should emit an EnclosingMethod attribute.
@@ -230,58 +239,6 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
sym.isErroneous
}
- /**
- * Build the [[InlineInfo]] for a class symbol.
- */
- def buildInlineInfoFromClassSymbol(classSym: Symbol, classSymToInternalName: Symbol => InternalName, methodSymToDescriptor: Symbol => String): InlineInfo = {
- val isEffectivelyFinal = classSym.isEffectivelyFinal
-
- val sam = {
- if (classSym.isEffectivelyFinal) None
- else {
- // Phase travel necessary. For example, nullary methods (getter of an abstract val) get an
- // empty parameter list in later phases and would therefore be picked as SAM.
- val samSym = exitingPickler(definitions.samOf(classSym.tpe))
- if (samSym == NoSymbol) None
- else Some(samSym.javaSimpleName.toString + methodSymToDescriptor(samSym))
- }
- }
-
- var warning = Option.empty[ClassSymbolInfoFailureSI9111]
-
- // Primitive methods cannot be inlined, so there's no point in building a MethodInlineInfo. Also, some
- // primitive methods (e.g., `isInstanceOf`) have non-erased types, which confuses [[typeToBType]].
- val methodInlineInfos = classSym.info.decls.iterator.filter(m => m.isMethod && !scalaPrimitives.isPrimitive(m)).flatMap({
- case methodSym =>
- if (completeSilentlyAndCheckErroneous(methodSym)) {
- // Happens due to SI-9111. Just don't provide any MethodInlineInfo for that method, we don't need fail the compiler.
- if (!classSym.isJavaDefined) devWarning("SI-9111 should only be possible for Java classes")
- warning = Some(ClassSymbolInfoFailureSI9111(classSym.fullName))
- None
- } else {
- val name = methodSym.javaSimpleName.toString // same as in genDefDef
- val signature = name + methodSymToDescriptor(methodSym)
-
- // In `trait T { object O }`, `oSym.isEffectivelyFinalOrNotOverridden` is true, but the
- // method is abstract in bytecode, `defDef.rhs.isEmpty`. Abstract methods are excluded
- // so they are not marked final in the InlineInfo attribute.
- //
- // However, due to https://github.com/scala/scala-dev/issues/126, this currently does not
- // work, the abstract accessor for O will be marked effectivelyFinal.
- val effectivelyFinal = methodSym.isEffectivelyFinalOrNotOverridden && !methodSym.isDeferred
-
- val info = MethodInlineInfo(
- effectivelyFinal = effectivelyFinal,
- annotatedInline = methodSym.hasAnnotation(ScalaInlineClass),
- annotatedNoInline = methodSym.hasAnnotation(ScalaNoInlineClass)
- )
- Some((signature, info))
- }
- }).toMap
-
- InlineInfo(isEffectivelyFinal, sam, methodInlineInfos, warning)
- }
-
/*
* must-single-thread
*/
@@ -568,15 +525,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
/**
* The class internal name for a given class symbol.
*/
- final def internalName(sym: Symbol): String = {
- // For each java class, the scala compiler creates a class and a module (thus a module class).
- // If the `sym` is a java module class, we use the java class instead. This ensures that the
- // ClassBType is created from the main class (instead of the module class).
- // The two symbols have the same name, so the resulting internalName is the same.
- // Phase travel (exitingPickler) required for SI-6613 - linkedCoC is only reliable in early phases (nesting)
- val classSym = if (sym.isJavaDefined && sym.isModuleClass) exitingPickler(sym.linkedClassOfClass) else sym
- classBTypeFromSymbol(classSym).internalName
- }
+ final def internalName(sym: Symbol): String = classBTypeFromSymbol(sym).internalName
} // end of trait BCInnerClassGen
trait BCAnnotGen extends BCInnerClassGen {
@@ -934,25 +883,22 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
*
* must-single-thread
*/
- private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, module: Symbol, m: Symbol): Unit = {
- def staticForwarderGenericSignature(sym: Symbol, moduleClass: Symbol): String = {
- if (sym.isDeferred) null // only add generic signature if method concrete; bug #1745
- else {
- // SI-3452 Static forwarder generation uses the same erased signature as the method if forwards to.
- // By rights, it should use the signature as-seen-from the module class, and add suitable
- // primitive and value-class boxing/unboxing.
- // But for now, just like we did in mixin, we just avoid writing a wrong generic signature
- // (one that doesn't erase to the actual signature). See run/t3452b for a test case.
- val memberTpe = enteringErasure(moduleClass.thisType.memberInfo(sym))
- val erasedMemberType = erasure.erasure(sym)(memberTpe)
- if (erasedMemberType =:= sym.info)
- getGenericSignature(sym, moduleClass, memberTpe)
- else null
- }
+ private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, moduleClass: Symbol, m: Symbol): Unit = {
+ def staticForwarderGenericSignature: String = {
+ // SI-3452 Static forwarder generation uses the same erased signature as the method if forwards to.
+ // By rights, it should use the signature as-seen-from the module class, and add suitable
+ // primitive and value-class boxing/unboxing.
+ // But for now, just like we did in mixin, we just avoid writing a wrong generic signature
+ // (one that doesn't erase to the actual signature). See run/t3452b for a test case.
+ val memberTpe = enteringErasure(moduleClass.thisType.memberInfo(m))
+ val erasedMemberType = erasure.erasure(m)(memberTpe)
+ if (erasedMemberType =:= m.info)
+ getGenericSignature(m, moduleClass, memberTpe)
+ else null
}
- val moduleName = internalName(module)
- val methodInfo = module.thisType.memberInfo(m)
+ val moduleName = internalName(moduleClass)
+ val methodInfo = moduleClass.thisType.memberInfo(m)
val paramJavaTypes: List[BType] = methodInfo.paramTypes map typeToBType
// val paramNames = 0 until paramJavaTypes.length map ("x_" + _)
@@ -967,7 +913,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
)
// TODO needed? for(ann <- m.annotations) { ann.symbol.initialize }
- val jgensig = staticForwarderGenericSignature(m, module)
+ val jgensig = staticForwarderGenericSignature
addRemoteExceptionAnnot(isRemoteClass, hasPublicBitSet(flags), m)
val (throws, others) = m.annotations partition (_.symbol == definitions.ThrowsClass)
val thrownExceptions: List[String] = getExceptions(throws)
@@ -988,7 +934,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
mirrorMethod.visitCode()
- mirrorMethod.visitFieldInsn(asm.Opcodes.GETSTATIC, moduleName, strMODULE_INSTANCE_FIELD, classBTypeFromSymbol(module).descriptor)
+ mirrorMethod.visitFieldInsn(asm.Opcodes.GETSTATIC, moduleName, strMODULE_INSTANCE_FIELD, classBTypeFromSymbol(moduleClass).descriptor)
var index = 0
for(jparamType <- paramJavaTypes) {
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
index ed1b4ec325..e3d45a9b3e 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
@@ -190,6 +190,7 @@ abstract class BCodeIdiomatic extends SubComponent {
JavaStringBuilderClassName,
INSTANCE_CONSTRUCTOR_NAME,
"()V",
+ itf = false,
pos
)
}
@@ -373,30 +374,27 @@ abstract class BCodeIdiomatic extends SubComponent {
final def rem(tk: BType) { emitPrimitive(JCodeMethodN.remOpcodes, tk) } // can-multi-thread
// can-multi-thread
- final def invokespecial(owner: String, name: String, desc: String, pos: Position) {
- addInvoke(Opcodes.INVOKESPECIAL, owner, name, desc, false, pos)
+ final def invokespecial(owner: String, name: String, desc: String, itf: Boolean, pos: Position): Unit = {
+ emitInvoke(Opcodes.INVOKESPECIAL, owner, name, desc, itf, pos)
}
// can-multi-thread
- final def invokestatic(owner: String, name: String, desc: String, pos: Position) {
- addInvoke(Opcodes.INVOKESTATIC, owner, name, desc, false, pos)
+ final def invokestatic(owner: String, name: String, desc: String, itf: Boolean, pos: Position): Unit = {
+ emitInvoke(Opcodes.INVOKESTATIC, owner, name, desc, itf, pos)
}
// can-multi-thread
- final def invokeinterface(owner: String, name: String, desc: String, pos: Position) {
- addInvoke(Opcodes.INVOKEINTERFACE, owner, name, desc, true, pos)
+ final def invokeinterface(owner: String, name: String, desc: String, pos: Position): Unit = {
+ emitInvoke(Opcodes.INVOKEINTERFACE, owner, name, desc, itf = true, pos)
}
// can-multi-thread
- final def invokevirtual(owner: String, name: String, desc: String, pos: Position) {
- addInvoke(Opcodes.INVOKEVIRTUAL, owner, name, desc, false, pos)
+ final def invokevirtual(owner: String, name: String, desc: String, pos: Position): Unit = {
+ emitInvoke(Opcodes.INVOKEVIRTUAL, owner, name, desc, itf = false, pos)
}
- private def addInvoke(opcode: Int, owner: String, name: String, desc: String, itf: Boolean, pos: Position) = {
+ def emitInvoke(opcode: Int, owner: String, name: String, desc: String, itf: Boolean, pos: Position): Unit = {
val node = new MethodInsnNode(opcode, owner, name, desc, itf)
jmethod.instructions.add(node)
if (settings.optInlinerEnabled) callsitePositions(node) = pos
}
- final def invokedynamic(owner: String, name: String, desc: String) {
- jmethod.visitMethodInsn(Opcodes.INVOKEDYNAMIC, owner, name, desc)
- }
// can-multi-thread
final def goTo(label: asm.Label) { jmethod.visitJumpInsn(Opcodes.GOTO, label) }
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
index bddc41e5c6..1bff8519ec 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala
@@ -488,7 +488,22 @@ abstract class BCodeSkelBuilder extends BCodeHelpers {
case ValDef(mods, name, tpt, rhs) => () // fields are added in `genPlainClass()`, via `addClassFields()`
- case dd : DefDef => genDefDef(dd)
+ case dd : DefDef =>
+ val sym = dd.symbol
+ if (needsStaticImplMethod(sym)) {
+ val staticDefDef = global.gen.mkStatic(dd, traitImplMethodName(sym), _.cloneSymbol)
+ val forwarderDefDef = {
+ val forwarderBody = Apply(global.gen.mkAttributedRef(staticDefDef.symbol), This(sym.owner).setType(sym.owner.typeConstructor) :: dd.vparamss.head.map(p => global.gen.mkAttributedIdent(p.symbol))).setType(sym.info.resultType)
+ // we don't want to the optimizer to inline the static method into the forwarder. Instead,
+ // the backend has a special case to transitively inline into a callsite of the forwarder
+ // when the forwarder itself is inlined.
+ forwarderBody.updateAttachment(NoInlineCallsiteAttachment)
+ deriveDefDef(dd)(_ => global.atPos(dd.pos)(forwarderBody))
+ }
+ genDefDef(staticDefDef)
+ if (!sym.isMixinConstructor)
+ genDefDef(forwarderDefDef)
+ } else genDefDef(dd)
case Template(_, _, body) => body foreach gen
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
index a708feb0a7..7b2686e7a9 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala
@@ -225,8 +225,7 @@ abstract class BTypes {
val inlineInfo = inlineInfoFromClassfile(classNode)
- val classfileInterfaces: List[ClassBType] = classNode.interfaces.asScala.map(classBTypeFromParsedClassfile)(collection.breakOut)
- val interfaces = classfileInterfaces.filterNot(i => inlineInfo.lateInterfaces.contains(i.internalName))
+ val interfaces: List[ClassBType] = classNode.interfaces.asScala.map(classBTypeFromParsedClassfile)(collection.breakOut)
classBType.info = Right(ClassInfo(superClass, interfaces, flags, nestedClasses, nestedInfo, inlineInfo))
classBType
@@ -1147,25 +1146,6 @@ object BTypes {
sam: Option[String],
methodInfos: Map[String, MethodInlineInfo],
warning: Option[ClassInlineInfoWarning]) {
- /**
- * A super call (invokespecial) to a default method T.m is only allowed if the interface T is
- * a direct parent of the class. Super calls are introduced for example in Mixin when generating
- * forwarder methods:
- *
- * trait T { override def clone(): Object = "hi" }
- * trait U extends T
- * class C extends U
- *
- * The class C gets a forwarder that invokes T.clone(). During code generation the interface T
- * is added as direct parent to class C. Note that T is not a (direct) parent in the frontend
- * type of class C.
- *
- * All interfaces that are added to a class during code generation are added to this buffer and
- * stored in the InlineInfo classfile attribute. This ensures that the ClassBTypes for a
- * specific class is the same no matter if it's constructed from a Symbol or from a classfile.
- * This is tested in BTypesFromClassfileTest.
- */
- val lateInterfaces: ListBuffer[InternalName] = ListBuffer.empty
}
val EmptyInlineInfo = InlineInfo(false, None, Map.empty, None)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
index d83b4a1d85..383347a0d3 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BTypesFromSymbols.scala
@@ -97,11 +97,19 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
* for the Nothing / Null. If used for example as a parameter type, we use the runtime classes
* in the classfile method signature.
*/
- final def classBTypeFromSymbol(classSym: Symbol): ClassBType = {
+ final def classBTypeFromSymbol(sym: Symbol): ClassBType = {
+ // For each java class, the scala compiler creates a class and a module (thus a module class).
+ // If the `sym` is a java module class, we use the java class instead. This ensures that the
+ // ClassBType is created from the main class (instead of the module class).
+ // The two symbols have the same name, so the resulting internalName is the same.
+ // Phase travel (exitingPickler) required for SI-6613 - linkedCoC is only reliable in early phases (nesting)
+ val classSym = if (sym.isJavaDefined && sym.isModuleClass) exitingPickler(sym.linkedClassOfClass) else sym
+
assert(classSym != NoSymbol, "Cannot create ClassBType from NoSymbol")
assert(classSym.isClass, s"Cannot create ClassBType from non-class symbol $classSym")
assertClassNotArrayNotPrimitive(classSym)
assert(!primitiveTypeToBType.contains(classSym) || isCompilingPrimitive, s"Cannot create ClassBType for primitive class symbol $classSym")
+
if (classSym == NothingClass) srNothingRef
else if (classSym == NullClass) srNullRef
else {
@@ -149,7 +157,8 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
def staticHandleFromSymbol(sym: Symbol): asm.Handle = {
val owner = if (sym.owner.isModuleClass) sym.owner.linkedClassOfClass else sym.owner
val descriptor = methodBTypeFromMethodType(sym.info, isConstructor = false).descriptor
- new asm.Handle(asm.Opcodes.H_INVOKESTATIC, classBTypeFromSymbol(owner).internalName, sym.name.encoded, descriptor)
+ val ownerBType = classBTypeFromSymbol(owner)
+ new asm.Handle(asm.Opcodes.H_INVOKESTATIC, ownerBType.internalName, sym.name.encoded, descriptor, /* itf = */ ownerBType.isInterface.get)
}
/**
@@ -234,12 +243,13 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
val allParents = classParents ++ classSym.annotations.flatMap(newParentForAnnotation)
+ val minimizedParents = if (classSym.isJavaDefined) allParents else erasure.minimizeParents(allParents)
// We keep the superClass when computing minimizeParents to eliminate more interfaces.
// Example: T can be eliminated from D
// trait T
// class C extends T
// class D extends C with T
- val interfaces = erasure.minimizeParents(allParents) match {
+ val interfaces = minimizedParents match {
case superClass :: ifs if !isInterfaceOrTrait(superClass.typeSymbol) =>
ifs
case ifs =>
@@ -508,7 +518,7 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
* classfile attribute.
*/
private def buildInlineInfo(classSym: Symbol, internalName: InternalName): InlineInfo = {
- def buildFromSymbol = buildInlineInfoFromClassSymbol(classSym, classBTypeFromSymbol(_).internalName, methodBTypeFromSymbol(_).descriptor)
+ def buildFromSymbol = buildInlineInfoFromClassSymbol(classSym)
// phase travel required, see implementation of `compiles`. for nested classes, it checks if the
// enclosingTopLevelClass is being compiled. after flatten, all classes are considered top-level,
@@ -530,6 +540,74 @@ class BTypesFromSymbols[G <: Global](val global: G) extends BTypes {
}
/**
+ * Build the [[InlineInfo]] for a class symbol.
+ */
+ def buildInlineInfoFromClassSymbol(classSym: Symbol): InlineInfo = {
+ val isEffectivelyFinal = classSym.isEffectivelyFinal
+
+ val sam = {
+ if (classSym.isEffectivelyFinal) None
+ else {
+ // Phase travel necessary. For example, nullary methods (getter of an abstract val) get an
+ // empty parameter list in later phases and would therefore be picked as SAM.
+ val samSym = exitingPickler(definitions.samOf(classSym.tpe))
+ if (samSym == NoSymbol) None
+ else Some(samSym.javaSimpleName.toString + methodBTypeFromSymbol(samSym).descriptor)
+ }
+ }
+
+ var warning = Option.empty[ClassSymbolInfoFailureSI9111]
+
+ // Primitive methods cannot be inlined, so there's no point in building a MethodInlineInfo. Also, some
+ // primitive methods (e.g., `isInstanceOf`) have non-erased types, which confuses [[typeToBType]].
+ val methodInlineInfos = classSym.info.decls.iterator.filter(m => m.isMethod && !scalaPrimitives.isPrimitive(m)).flatMap({
+ case methodSym =>
+ if (completeSilentlyAndCheckErroneous(methodSym)) {
+ // Happens due to SI-9111. Just don't provide any MethodInlineInfo for that method, we don't need fail the compiler.
+ if (!classSym.isJavaDefined) devWarning("SI-9111 should only be possible for Java classes")
+ warning = Some(ClassSymbolInfoFailureSI9111(classSym.fullName))
+ Nil
+ } else {
+ val name = methodSym.javaSimpleName.toString // same as in genDefDef
+ val signature = name + methodBTypeFromSymbol(methodSym).descriptor
+
+ // In `trait T { object O }`, `oSym.isEffectivelyFinalOrNotOverridden` is true, but the
+ // method is abstract in bytecode, `defDef.rhs.isEmpty`. Abstract methods are excluded
+ // so they are not marked final in the InlineInfo attribute.
+ //
+ // However, due to https://github.com/scala/scala-dev/issues/126, this currently does not
+ // work, the abstract accessor for O will be marked effectivelyFinal.
+ val effectivelyFinal = methodSym.isEffectivelyFinalOrNotOverridden && !methodSym.isDeferred
+
+ val info = MethodInlineInfo(
+ effectivelyFinal = effectivelyFinal,
+ annotatedInline = methodSym.hasAnnotation(ScalaInlineClass),
+ annotatedNoInline = methodSym.hasAnnotation(ScalaNoInlineClass))
+
+ if (needsStaticImplMethod(methodSym)) {
+ val staticName = traitImplMethodName(methodSym).toString
+ val selfParam = methodSym.newSyntheticValueParam(methodSym.owner.typeConstructor, nme.SELF)
+ val staticMethodType = methodSym.info match {
+ case mt @ MethodType(params, res) => copyMethodType(mt, selfParam :: params, res)
+ }
+ val staticMethodSignature = staticName + methodBTypeFromMethodType(staticMethodType, isConstructor = false)
+ val staticMethodInfo = MethodInlineInfo(
+ effectivelyFinal = true,
+ annotatedInline = info.annotatedInline,
+ annotatedNoInline = info.annotatedNoInline)
+ if (methodSym.isMixinConstructor)
+ List((staticMethodSignature, staticMethodInfo))
+ else
+ List((signature, info), (staticMethodSignature, staticMethodInfo))
+ } else
+ List((signature, info))
+ }
+ }).toMap
+
+ InlineInfo(isEffectivelyFinal, sam, methodInlineInfos, warning)
+ }
+
+ /**
* For top-level objects without a companion class, the compiler generates a mirror class with
* static forwarders (Java compat). There's no symbol for the mirror class, but we still need a
* ClassBType (its info.nestedClasses will hold the InnerClass entries, see comment in BTypes).
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala b/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
index 4ad4a95728..7b640ac54f 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BackendReporting.scala
@@ -26,9 +26,7 @@ final class BackendReportingImpl(val global: Global) extends BackendReporting {
/**
* Utilities for error reporting.
*
- * Defines some tools to make error reporting with Either easier. Would be subsumed by a right-biased
- * Either in the standard library (or scalaz \/) (Validation is different, it accumulates multiple
- * errors).
+ * Defines some utility methods to make error reporting with Either easier.
*/
object BackendReporting {
def methodSignature(classInternalName: InternalName, name: String, desc: String) = {
@@ -42,19 +40,12 @@ object BackendReporting {
def assertionError(message: String): Nothing = throw new AssertionError(message)
implicit class RightBiasedEither[A, B](val v: Either[A, B]) extends AnyVal {
- def map[C](f: B => C): Either[A, C] = v.right.map(f)
- def flatMap[C](f: B => Either[A, C]): Either[A, C] = v.right.flatMap(f)
def withFilter(f: B => Boolean)(implicit empty: A): Either[A, B] = v match {
case Left(_) => v
case Right(e) => if (f(e)) v else Left(empty) // scalaz.\/ requires an implicit Monoid m to get m.empty
}
- def foreach[U](f: B => U): Unit = v.right.foreach(f)
- def getOrElse[C >: B](alt: => C): C = v.right.getOrElse(alt)
-
- /**
- * Get the value, fail with an assertion if this is an error.
- */
+ /** Get the value, fail with an assertion if this is an error. */
def get: B = {
assert(v.isRight, v.left.get)
v.right.get
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala
index 1feca56923..c2010d2828 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala
@@ -217,26 +217,6 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) {
nonOverloadedConstructors(tupleClassSymbols)
}
- // enumeration of specialized classes is temporary, while we still use the java-defined JFunctionN.
- // once we switch to ordinary FunctionN, we can use specializedSubclasses just like for tuples.
- private def specializedJFunctionSymbols(base: String): Seq[Symbol] = {
- def primitives = Seq("B", "S", "I", "J", "C", "F", "D", "Z", "V")
- def ijfd = Iterator("I", "J", "F", "D")
- def ijfdzv = Iterator("I", "J", "F", "D", "Z", "V")
- def ijd = Iterator("I", "J", "D")
- val classNames = {
- primitives.map(base + "0$mc" + _ + "$sp") // Function0
- } ++ {
- // return type specializations appear first in the name string (alphabetical sorting)
- for (r <- ijfdzv; a <- ijfd) yield base + "1$mc" + r + a + "$sp" // Function1
- } ++ {
- for (r <- ijfdzv; a <- ijd; b <- ijd) yield base + "2$mc" + r + a + b + "$sp" // Function2
- }
- classNames map getRequiredClass
- }
-
- lazy val functionRefs: Set[InternalName] = (FunctionClass.seq ++ specializedJFunctionSymbols("scala.runtime.java8.JFunction")).map(classBTypeFromSymbol(_).internalName).toSet
-
lazy val typeOfArrayOp: Map[Int, BType] = {
import scalaPrimitives._
Map(
@@ -268,7 +248,22 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) {
})
}
- lazy val lambdaMetaFactoryBootstrapHandle =
+ lazy val lambdaMetaFactoryMetafactoryHandle =
+ new asm.Handle(asm.Opcodes.H_INVOKESTATIC,
+ coreBTypes.jliLambdaMetafactoryRef.internalName, sn.Metafactory.toString,
+ MethodBType(
+ List(
+ coreBTypes.jliMethodHandlesLookupRef,
+ coreBTypes.StringRef,
+ coreBTypes.jliMethodTypeRef,
+ coreBTypes.jliMethodTypeRef,
+ coreBTypes.jliMethodHandleRef,
+ coreBTypes.jliMethodTypeRef),
+ coreBTypes.jliCallSiteRef
+ ).descriptor,
+ /* itf = */ coreBTypes.jliLambdaMetafactoryRef.isInterface.get)
+
+ lazy val lambdaMetaFactoryAltMetafactoryHandle =
new asm.Handle(asm.Opcodes.H_INVOKESTATIC,
coreBTypes.jliLambdaMetafactoryRef.internalName, sn.AltMetafactory.toString,
MethodBType(
@@ -278,7 +273,8 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) {
coreBTypes.jliMethodTypeRef,
ArrayBType(ObjectRef)),
coreBTypes.jliCallSiteRef
- ).descriptor)
+ ).descriptor,
+ /* itf = */ coreBTypes.jliLambdaMetafactoryRef.isInterface.get)
lazy val lambdaDeserializeBootstrapHandle =
new scala.tools.asm.Handle(scala.tools.asm.Opcodes.H_INVOKESTATIC,
@@ -290,7 +286,8 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) {
coreBTypes.jliMethodTypeRef
),
coreBTypes.jliCallSiteRef
- ).descriptor)
+ ).descriptor,
+ /* itf = */ coreBTypes.srLambdaDeserialize.isInterface.get)
}
/**
@@ -319,6 +316,7 @@ trait CoreBTypesProxyGlobalIndependent[BTS <: BTypes] {
def juHashMapRef : ClassBType
def juMapRef : ClassBType
def jliCallSiteRef : ClassBType
+ def jliLambdaMetafactoryRef : ClassBType
def jliMethodTypeRef : ClassBType
def jliSerializedLambdaRef : ClassBType
def jliMethodHandleRef : ClassBType
@@ -342,10 +340,9 @@ trait CoreBTypesProxyGlobalIndependent[BTS <: BTypes] {
def srRefConstructors : Map[InternalName, MethodNameAndType]
def tupleClassConstructors : Map[InternalName, MethodNameAndType]
- def functionRefs: Set[InternalName]
-
- def lambdaMetaFactoryBootstrapHandle : asm.Handle
- def lambdaDeserializeBootstrapHandle : asm.Handle
+ def lambdaMetaFactoryMetafactoryHandle : asm.Handle
+ def lambdaMetaFactoryAltMetafactoryHandle : asm.Handle
+ def lambdaDeserializeBootstrapHandle : asm.Handle
}
/**
@@ -410,8 +407,6 @@ final class CoreBTypesProxy[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes:
def srRefConstructors : Map[InternalName, MethodNameAndType] = _coreBTypes.srRefConstructors
def tupleClassConstructors : Map[InternalName, MethodNameAndType] = _coreBTypes.tupleClassConstructors
- def functionRefs: Set[InternalName] = _coreBTypes.functionRefs
-
def srSymbolLiteral : ClassBType = _coreBTypes.srSymbolLiteral
def srStructuralCallSite : ClassBType = _coreBTypes.srStructuralCallSite
def srLambdaDeserialize : ClassBType = _coreBTypes.srLambdaDeserialize
@@ -429,6 +424,7 @@ final class CoreBTypesProxy[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes:
def String_valueOf: Symbol = _coreBTypes.String_valueOf
- def lambdaMetaFactoryBootstrapHandle = _coreBTypes.lambdaMetaFactoryBootstrapHandle
- def lambdaDeserializeBootstrapHandle = _coreBTypes.lambdaDeserializeBootstrapHandle
+ def lambdaMetaFactoryMetafactoryHandle : asm.Handle = _coreBTypes.lambdaMetaFactoryMetafactoryHandle
+ def lambdaMetaFactoryAltMetafactoryHandle : asm.Handle = _coreBTypes.lambdaMetaFactoryAltMetafactoryHandle
+ def lambdaDeserializeBootstrapHandle : asm.Handle = _coreBTypes.lambdaDeserializeBootstrapHandle
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala
index 9abd1d8006..83615abc31 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala
@@ -2,17 +2,18 @@ package scala.tools.nsc
package backend.jvm
package analysis
+import java.lang.invoke.LambdaMetafactory
+
import scala.annotation.switch
-import scala.tools.asm.{Handle, Type}
+import scala.collection.JavaConverters._
+import scala.collection.mutable
import scala.tools.asm.Opcodes._
import scala.tools.asm.tree._
-import scala.tools.asm.tree.analysis.{Frame, BasicInterpreter, Analyzer, Value}
-import GenBCode._
+import scala.tools.asm.tree.analysis._
+import scala.tools.asm.{Handle, Type}
import scala.tools.nsc.backend.jvm.BTypes._
+import scala.tools.nsc.backend.jvm.GenBCode._
import scala.tools.nsc.backend.jvm.opt.BytecodeUtils._
-import java.lang.invoke.LambdaMetafactory
-import scala.collection.mutable
-import scala.collection.JavaConverters._
/**
* This component hosts tools and utilities used in the backend that require access to a `BTypes`
@@ -32,7 +33,12 @@ class BackendUtils[BT <: BTypes](val btypes: BT) {
*/
class AsmAnalyzer[V <: Value](methodNode: MethodNode, classInternalName: InternalName, val analyzer: Analyzer[V] = new Analyzer(new BasicInterpreter)) {
computeMaxLocalsMaxStack(methodNode)
- analyzer.analyze(classInternalName, methodNode)
+ try {
+ analyzer.analyze(classInternalName, methodNode)
+ } catch {
+ case ae: AnalyzerException =>
+ throw new AnalyzerException(null, "While processing " + classInternalName + "." + methodNode.name, ae)
+ }
def frameAt(instruction: AbstractInsnNode): Frame[V] = analyzer.frameAt(instruction, methodNode)
}
@@ -125,7 +131,6 @@ class BackendUtils[BT <: BTypes](val btypes: BT) {
private val anonfunAdaptedName = """.*\$anonfun\$.*\$\d+\$adapted""".r
def hasAdaptedImplMethod(closureInit: ClosureInstantiation): Boolean = {
- isBuiltinFunctionType(Type.getReturnType(closureInit.lambdaMetaFactoryCall.indy.desc).getInternalName) &&
anonfunAdaptedName.pattern.matcher(closureInit.lambdaMetaFactoryCall.implMethod.getName).matches
}
@@ -250,8 +255,6 @@ class BackendUtils[BT <: BTypes](val btypes: BT) {
}
}
- def isBuiltinFunctionType(internalName: InternalName): Boolean = functionRefs(internalName)
-
/**
* Visit the class node and collect all referenced nested classes.
*/
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala
index 63906d80e5..e21c46dbe9 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/BytecodeUtils.scala
@@ -93,6 +93,15 @@ object BytecodeUtils {
op == INVOKESPECIAL || op == INVOKESTATIC
}
+ def isVirtualCall(instruction: AbstractInsnNode): Boolean = {
+ val op = instruction.getOpcode
+ op == INVOKEVIRTUAL || op == INVOKEINTERFACE
+ }
+
+ def isCall(instruction: AbstractInsnNode): Boolean = {
+ isNonVirtualCall(instruction) || isVirtualCall(instruction)
+ }
+
def isExecutable(instruction: AbstractInsnNode): Boolean = instruction.getOpcode >= 0
def isConstructor(methodNode: MethodNode): Boolean = {
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala
index 40344809bf..b088b5ee48 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala
@@ -9,11 +9,11 @@ package opt
import scala.collection.immutable.IntMap
import scala.reflect.internal.util.{NoPosition, Position}
-import scala.tools.asm.{Opcodes, Type, Handle}
+import scala.tools.asm.{Handle, Opcodes, Type}
import scala.tools.asm.tree._
import scala.collection.{concurrent, mutable}
import scala.collection.JavaConverters._
-import scala.tools.nsc.backend.jvm.BTypes.InternalName
+import scala.tools.nsc.backend.jvm.BTypes.{InternalName, MethodInlineInfo}
import scala.tools.nsc.backend.jvm.BackendReporting._
import scala.tools.nsc.backend.jvm.analysis._
import BytecodeUtils._
@@ -67,6 +67,7 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
}
def containsCallsite(callsite: Callsite): Boolean = callsites(callsite.callsiteMethod) contains callsite.callsiteInstruction
+ def findCallSite(method: MethodNode, call: MethodInsnNode): Option[Callsite] = callsites.getOrElse(method, Map.empty).get(call)
def removeClosureInstantiation(indy: InvokeDynamicInsnNode, methodNode: MethodNode): Option[ClosureInstantiation] = {
val methodClosureInits = closureInstantiations(methodNode)
@@ -356,7 +357,7 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
"Invocation of" +
s" ${callee.map(_.calleeDeclarationClass.internalName).getOrElse("?")}.${callsiteInstruction.name + callsiteInstruction.desc}" +
s"@${callsiteMethod.instructions.indexOf(callsiteInstruction)}" +
- s" in ${callsiteClass.internalName}.${callsiteMethod.name}"
+ s" in ${callsiteClass.internalName}.${callsiteMethod.name}${callsiteMethod.desc}"
}
final case class ClonedCallsite(callsite: Callsite, clonedWhenInlining: Callsite)
@@ -412,24 +413,10 @@ class CallGraph[BT <: BTypes](val btypes: BT) {
final case class LambdaMetaFactoryCall(indy: InvokeDynamicInsnNode, samMethodType: Type, implMethod: Handle, instantiatedMethodType: Type)
object LambdaMetaFactoryCall {
- private val lambdaMetaFactoryInternalName: InternalName = "java/lang/invoke/LambdaMetafactory"
-
- private val metafactoryHandle = {
- val metafactoryMethodName: String = "metafactory"
- val metafactoryDesc: String = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"
- new Handle(Opcodes.H_INVOKESTATIC, lambdaMetaFactoryInternalName, metafactoryMethodName, metafactoryDesc)
- }
-
- private val altMetafactoryHandle = {
- val altMetafactoryMethodName: String = "altMetafactory"
- val altMetafactoryDesc: String = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;"
- new Handle(Opcodes.H_INVOKESTATIC, lambdaMetaFactoryInternalName, altMetafactoryMethodName, altMetafactoryDesc)
- }
-
def unapply(insn: AbstractInsnNode): Option[(InvokeDynamicInsnNode, Type, Handle, Type)] = insn match {
- case indy: InvokeDynamicInsnNode if indy.bsm == metafactoryHandle || indy.bsm == altMetafactoryHandle =>
+ case indy: InvokeDynamicInsnNode if indy.bsm == coreBTypes.lambdaMetaFactoryMetafactoryHandle || indy.bsm == coreBTypes.lambdaMetaFactoryAltMetafactoryHandle =>
indy.bsmArgs match {
- case Array(samMethodType: Type, implMethod: Handle, instantiatedMethodType: Type, xs@_*) => // xs binding because IntelliJ gets confused about _@_*
+ case Array(samMethodType: Type, implMethod: Handle, instantiatedMethodType: Type, _@_*) =>
// LambdaMetaFactory performs a number of automatic adaptations when invoking the lambda
// implementation method (casting, boxing, unboxing, and primitive widening, see Javadoc).
//
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala
index 4163d62df7..b05669ce89 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/CopyProp.scala
@@ -295,18 +295,12 @@ class CopyProp[BT <: BTypes](val btypes: BT) {
}
/**
- * Eliminate the closure value produced by `indy`. If the SAM type is known to construct
- * without side-effects (e.g. scala/FunctionN), the `indy` and its inputs
- * are eliminated, otherwise a POP is inserted.
+ * Eliminate LMF `indy` and its inputs.
*/
def handleClosureInst(indy: InvokeDynamicInsnNode): Unit = {
- if (isBuiltinFunctionType(Type.getReturnType(indy.desc).getInternalName)) {
- toRemove += indy
- callGraph.removeClosureInstantiation(indy, method)
- handleInputs(indy, Type.getArgumentTypes(indy.desc).length)
- } else {
- toInsertAfter(indy) = getPop(1)
- }
+ toRemove += indy
+ callGraph.removeClosureInstantiation(indy, method)
+ handleInputs(indy, Type.getArgumentTypes(indy.desc).length)
}
def runQueue(): Unit = while (queue.nonEmpty) {
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
index 79d26b0b4e..5ce7072c60 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlineInfoAttribute.scala
@@ -51,7 +51,6 @@ case class InlineInfoAttribute(inlineInfo: InlineInfo) extends Attribute(InlineI
if (inlineInfo.isEffectivelyFinal) flags |= 1
// flags |= 2 // no longer written
if (inlineInfo.sam.isDefined) flags |= 4
- if (inlineInfo.lateInterfaces.nonEmpty) flags |= 8
result.putByte(flags)
for (samNameDesc <- inlineInfo.sam) {
@@ -79,9 +78,6 @@ case class InlineInfoAttribute(inlineInfo: InlineInfo) extends Attribute(InlineI
result.putByte(inlineInfo)
}
- result.putShort(inlineInfo.lateInterfaces.length)
- for (i <- inlineInfo.lateInterfaces) result.putShort(cw.newUTF8(i))
-
result
}
@@ -105,7 +101,6 @@ case class InlineInfoAttribute(inlineInfo: InlineInfo) extends Attribute(InlineI
val isFinal = (flags & 1) != 0
val hasSelf = (flags & 2) != 0
val hasSam = (flags & 4) != 0
- val hasLateInterfaces = (flags & 8) != 0
if (hasSelf) nextUTF8() // no longer used
@@ -128,13 +123,7 @@ case class InlineInfoAttribute(inlineInfo: InlineInfo) extends Attribute(InlineI
(name + desc, MethodInlineInfo(isFinal, isInline, isNoInline))
}).toMap
- val lateInterfaces = if (!hasLateInterfaces) Nil else {
- val numLateInterfaces = nextShort()
- (0 until numLateInterfaces).map(_ => nextUTF8())
- }
-
val info = InlineInfo(isFinal, sam, infos, None)
- info.lateInterfaces ++= lateInterfaces
InlineInfoAttribute(info)
} else {
val msg = UnknownScalaInlineInfoVersion(cr.getClassName, version)
@@ -161,8 +150,6 @@ object InlineInfoAttribute {
* [u2] name (reference)
* [u2] descriptor (reference)
* [u1] isFinal (<< 0), traitMethodWithStaticImplementation (<< 1), hasInlineAnnotation (<< 2), hasNoInlineAnnotation (<< 3)
- * [u2]? numLateInterfaces
- * [u2] lateInterface (reference)
*/
final val VERSION: Byte = 1
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
index 7b4cfe2a18..9c5a1a9f98 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/Inliner.scala
@@ -106,6 +106,8 @@ class Inliner[BT <: BTypes](val btypes: BT) {
val elided = mutable.Set.empty[InlineRequest]
def nonElidedRequests(methodNode: MethodNode): Set[InlineRequest] = requestsByMethod(methodNode) diff elided
+ def allCallees(r: InlineRequest): Set[MethodNode] = r.post.flatMap(allCallees).toSet + r.callsite.callee.get.callee
+
/**
* Break cycles in the inline request graph by removing callsites.
*
@@ -114,20 +116,20 @@ class Inliner[BT <: BTypes](val btypes: BT) {
*/
def breakInlineCycles: List[InlineRequest] = {
// is there a path of inline requests from start to goal?
- def isReachable(start: MethodNode, goal: MethodNode): Boolean = {
- @tailrec def reachableImpl(check: List[MethodNode], visited: Set[MethodNode]): Boolean = check match {
- case x :: xs =>
+ def isReachable(start: Set[MethodNode], goal: MethodNode): Boolean = {
+ @tailrec def reachableImpl(check: Set[MethodNode], visited: Set[MethodNode]): Boolean = {
+ if (check.isEmpty) false
+ else {
+ val x = check.head
if (x == goal) true
- else if (visited(x)) reachableImpl(xs, visited)
+ else if (visited(x)) reachableImpl(check - x, visited)
else {
- val callees = nonElidedRequests(x).map(_.callsite.callee.get.callee)
- reachableImpl(xs ::: callees.toList, visited + x)
+ val callees = nonElidedRequests(x).flatMap(allCallees)
+ reachableImpl(check - x ++ callees, visited + x)
}
-
- case Nil =>
- false
+ }
}
- reachableImpl(List(start), Set.empty)
+ reachableImpl(start, Set.empty)
}
val result = new mutable.ListBuffer[InlineRequest]()
@@ -136,7 +138,7 @@ class Inliner[BT <: BTypes](val btypes: BT) {
java.util.Arrays.sort(requests, callsiteOrdering)
for (r <- requests) {
// is there a chain of inlining requests that would inline the callsite method into the callee?
- if (isReachable(r.callsite.callee.get.callee, r.callsite.callsiteMethod))
+ if (isReachable(allCallees(r), r.callsite.callsiteMethod))
elided += r
else
result += r
@@ -150,8 +152,8 @@ class Inliner[BT <: BTypes](val btypes: BT) {
if (requests.isEmpty) Nil
else {
val (leaves, others) = requests.partition(r => {
- val inlineRequestsForCallee = nonElidedRequests(r.callsite.callee.get.callee)
- inlineRequestsForCallee.forall(visited)
+ val inlineRequestsForCallees = allCallees(r).flatMap(nonElidedRequests)
+ inlineRequestsForCallees.forall(visited)
})
assert(leaves.nonEmpty, requests)
leaves ::: leavesFirst(others, visited ++ leaves)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala
index 009742501e..79e74f3eb7 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/opt/InlinerHeuristics.scala
@@ -7,14 +7,14 @@ package scala.tools.nsc
package backend.jvm
package opt
-import scala.tools.asm.tree.MethodNode
-import scala.tools.nsc.backend.jvm.BTypes.InternalName
import scala.collection.JavaConverters._
+import scala.tools.asm.Opcodes
+import scala.tools.asm.tree.{MethodInsnNode, MethodNode}
+import scala.tools.nsc.backend.jvm.BTypes.InternalName
import scala.tools.nsc.backend.jvm.BackendReporting.OptimizerWarning
class InlinerHeuristics[BT <: BTypes](val bTypes: BT) {
import bTypes._
- import inliner._
import callGraph._
case class InlineRequest(callsite: Callsite, post: List[InlineRequest], reason: String) {
@@ -93,7 +93,27 @@ class InlinerHeuristics[BT <: BTypes](val bTypes: BT) {
val callee = callsite.callee.get
def requestIfCanInline(callsite: Callsite, reason: String): Either[OptimizerWarning, InlineRequest] = inliner.earlyCanInlineCheck(callsite) match {
case Some(w) => Left(w)
- case None => Right(InlineRequest(callsite, Nil, reason))
+ case None =>
+ val callee = callsite.callee.get
+ val postInlineRequest: List[InlineRequest] = callee.calleeDeclarationClass.isInterface match {
+ case Right(true) =>
+ // Treat the pair of trait interface method and static method as one for the purposes of inlining:
+ // if we inline invokeinterface, invoke the invokestatic, too.
+ val calls = callee.callee.instructions.iterator().asScala.filter(BytecodeUtils.isCall).take(2).toList
+ calls match {
+ case List(x: MethodInsnNode) if x.getOpcode == Opcodes.INVOKESTATIC && x.name == (callee.callee.name + "$") =>
+ callGraph.addIfMissing(callee.callee, callee.calleeDeclarationClass)
+ val maybeNodeToCallsite1 = callGraph.findCallSite(callee.callee, x)
+ maybeNodeToCallsite1.toList.flatMap(x => requestIfCanInline(x, reason).right.toOption)
+ case _ =>
+ Nil
+
+ }
+ case _ => Nil
+ }
+
+ Right(InlineRequest(callsite, postInlineRequest, reason))
+
}
compilerSettings.YoptInlineHeuristics.value match {
diff --git a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
index fd9c99a3b9..01ca8033ac 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaParsers.scala
@@ -111,7 +111,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
def arrayOf(tpt: Tree) =
AppliedTypeTree(scalaDot(tpnme.Array), List(tpt))
- def blankExpr = Ident(nme.WILDCARD)
+ def blankExpr = EmptyTree
def makePackaging(pkg: RefTree, stats: List[Tree]): PackageDef =
atPos(pkg.pos) { PackageDef(pkg, stats) }
@@ -135,6 +135,11 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
DefDef(Modifiers(Flags.JAVA), nme.CONSTRUCTOR, List(), List(vparams), TypeTree(), blankExpr)
}
+ /** A hook for joining the comment associated with a definition.
+ * Overridden by scaladoc.
+ */
+ def joinComment(trees: => List[Tree]): List[Tree] = trees
+
// ------------- general parsing ---------------------------
/** skip parent or brace enclosed sequence of things */
@@ -581,7 +586,7 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
case CLASS | ENUM | INTERFACE | AT =>
typeDecl(if (definesInterface(parentToken)) mods | Flags.STATIC else mods)
case _ =>
- termDecl(mods, parentToken)
+ joinComment(termDecl(mods, parentToken))
}
def makeCompanionObject(cdef: ClassDef, statics: List[Tree]): Tree =
@@ -833,10 +838,10 @@ trait JavaParsers extends ast.parser.ParsersCommon with JavaScanners {
}
def typeDecl(mods: Modifiers): List[Tree] = in.token match {
- case ENUM => enumDecl(mods)
- case INTERFACE => interfaceDecl(mods)
+ case ENUM => joinComment(enumDecl(mods))
+ case INTERFACE => joinComment(interfaceDecl(mods))
case AT => annotationDecl(mods)
- case CLASS => classDecl(mods)
+ case CLASS => joinComment(classDecl(mods))
case _ => in.nextToken(); syntaxError("illegal start of type declaration", skipIt = true); List(errorTypeTree)
}
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
index c74a6938c6..e11ac94041 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
@@ -577,21 +577,29 @@ trait JavaScanners extends ast.parser.ScannersCommon {
}
}
- protected def skipComment(): Boolean = {
- @tailrec def skipLineComment(): Unit = in.ch match {
- case CR | LF | SU =>
- case _ => in.next; skipLineComment()
- }
- @tailrec def skipJavaComment(): Unit = in.ch match {
- case SU => incompleteInputError("unclosed comment")
- case '*' => in.next; if (in.ch == '/') in.next else skipJavaComment()
- case _ => in.next; skipJavaComment()
- }
- in.ch match {
- case '/' => in.next ; skipLineComment() ; true
- case '*' => in.next ; skipJavaComment() ; true
- case _ => false
- }
+ protected def putCommentChar(): Unit = in.next()
+
+ protected def skipBlockComment(isDoc: Boolean): Unit = in.ch match {
+ case SU => incompleteInputError("unclosed comment")
+ case '*' => putCommentChar() ; if (in.ch == '/') putCommentChar() else skipBlockComment(isDoc)
+ case _ => putCommentChar() ; skipBlockComment(isDoc)
+ }
+
+ protected def skipLineComment(): Unit = in.ch match {
+ case CR | LF | SU =>
+ case _ => putCommentChar() ; skipLineComment()
+ }
+
+ protected def skipComment(): Boolean = in.ch match {
+ case '/' => putCommentChar() ; skipLineComment() ; true
+ case '*' =>
+ putCommentChar()
+ in.ch match {
+ case '*' => skipBlockComment(isDoc = true)
+ case _ => skipBlockComment(isDoc = false)
+ }
+ true
+ case _ => false
}
// Identifiers ---------------------------------------------------------------
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 0533d420cd..f8c1a0d082 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -366,7 +366,7 @@ abstract class ClassfileParser {
// - better owner than `NoSymbol`
// - remove eager warning
val msg = s"Class $name not found - continuing with a stub."
- if (!settings.isScaladoc) warning(msg)
+ if ((!settings.isScaladoc) && (settings.verbose || settings.developer)) warning(msg)
return NoSymbol.newStubSymbol(name.toTypeName, msg)
}
val completer = new loaders.ClassfileLoader(file)
diff --git a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
index 2dd8def53e..855e53710b 100644
--- a/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
+++ b/src/compiler/scala/tools/nsc/transform/Delambdafy.scala
@@ -28,7 +28,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
/** the following two members override abstract members in Transform */
val phaseName: String = "delambdafy"
- final case class LambdaMetaFactoryCapable(target: Symbol, arity: Int, functionalInterface: Symbol, sam: Symbol)
+ final case class LambdaMetaFactoryCapable(target: Symbol, arity: Int, functionalInterface: Symbol, sam: Symbol, isSerializable: Boolean, addScalaSerializableMarker: Boolean)
/**
* Get the symbol of the target lifted lambda body method from a function. I.e. if
@@ -95,6 +95,8 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
// no need for adaptation when the implemented sam is of a specialized built-in function type
val lambdaTarget = if (isSpecialized) target else createBoxingBridgeMethodIfNeeded(fun, target, functionalInterface, sam)
+ val isSerializable = samUserDefined == NoSymbol || samUserDefined.owner.isNonBottomSubClass(definitions.JavaSerializableClass)
+ val addScalaSerializableMarker = samUserDefined == NoSymbol
// The backend needs to know the target of the lambda and the functional interface in order
// to emit the invokedynamic instruction. We pass this information as tree attachment.
@@ -102,7 +104,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
// see https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/LambdaMetafactory.html
// instantiatedMethodType is derived from lambdaTarget's signature
// samMethodType is derived from samOf(functionalInterface)'s signature
- apply.updateAttachment(LambdaMetaFactoryCapable(lambdaTarget, fun.vparams.length, functionalInterface, sam))
+ apply.updateAttachment(LambdaMetaFactoryCapable(lambdaTarget, fun.vparams.length, functionalInterface, sam, isSerializable, addScalaSerializableMarker))
apply
}
@@ -241,8 +243,12 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
exitingErasure(target.info.paramTypes).map(reboxValueClass) :+ reboxValueClass(exitingErasure(target.info.resultType))).toTypeName
val isSpecialized = specializedName != funSym.name
- val functionalInterface = // TODO: this is no longer needed, right? we can just use the regular function classes
- if (isSpecialized) currentRun.runDefinitions.Scala_Java8_CompatPackage.info.decl(specializedName.prepend("J"))
+ val functionalInterface =
+ if (isSpecialized) {
+ // Unfortunately we still need to use custom functional interfaces for specialized functions so that the
+ // unboxed apply method is left abstract for us to implement.
+ currentRun.runDefinitions.Scala_Java8_CompatPackage.info.decl(specializedName.prepend("J"))
+ }
else FunctionClass(originalFunction.vparams.length)
(functionalInterface, isSpecialized)
@@ -261,7 +267,7 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
def pretransform(tree: Tree): Tree = tree match {
case dd: DefDef if dd.symbol.isDelambdafyTarget =>
if (!dd.symbol.hasFlag(STATIC) && methodReferencesThis(dd.symbol)) {
- gen.mkStatic(dd, sym => sym)
+ gen.mkStatic(dd, dd.symbol.name, sym => sym)
} else {
dd.symbol.setFlag(STATIC)
dd
@@ -276,8 +282,10 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre
case dd: DefDef if dd.symbol.isLiftedMethod && !dd.symbol.isDelambdafyTarget =>
// SI-9390 emit lifted methods that don't require a `this` reference as STATIC
// delambdafy targets are excluded as they are made static by `transformFunction`.
- if (!dd.symbol.hasFlag(STATIC) && !methodReferencesThis(dd.symbol))
+ if (!dd.symbol.hasFlag(STATIC) && !methodReferencesThis(dd.symbol)) {
dd.symbol.setFlag(STATIC)
+ dd.symbol.removeAttachment[mixer.NeedStaticImpl.type]
+ }
super.transform(tree)
case Apply(fun, outer :: rest) if shouldElideOuterArg(fun.symbol, outer) =>
val nullOuter = gen.mkZero(outer.tpe)
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 5e903946c1..db8e203c1c 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -189,18 +189,23 @@ abstract class Erasure extends AddInterfaces
/* Drop redundant types (ones which are implemented by some other parent) from the immediate parents.
* This is important on Android because there is otherwise an interface explosion.
+ * This is now restricted to Scala defined ancestors: a Java defined ancestor may need to be listed
+ * as an immediate parent to support an `invokespecial`.
*/
def minimizeParents(parents: List[Type]): List[Type] = if (parents.isEmpty) parents else {
- def isInterfaceOrTrait(sym: Symbol) = sym.isInterface || sym.isTrait
+ def isRedundantParent(sym: Symbol) = sym.isInterface || sym.isTrait
var rest = parents.tail
var leaves = collection.mutable.ListBuffer.empty[Type] += parents.head
while(rest.nonEmpty) {
val candidate = rest.head
- val nonLeaf = leaves exists { t => t.typeSymbol isSubClass candidate.typeSymbol }
- if(!nonLeaf) {
- leaves = leaves filterNot { t => isInterfaceOrTrait(t.typeSymbol) && (candidate.typeSymbol isSubClass t.typeSymbol) }
- leaves += candidate
+ if (candidate.typeSymbol.isJavaDefined && candidate.typeSymbol.isInterface) leaves += candidate
+ else {
+ val nonLeaf = leaves exists { t => t.typeSymbol isSubClass candidate.typeSymbol }
+ if (!nonLeaf) {
+ leaves = leaves filterNot { t => isRedundantParent(t.typeSymbol) && (candidate.typeSymbol isSubClass t.typeSymbol) }
+ leaves += candidate
+ }
}
rest = rest.tail
}
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 19ba9345fa..d62b77dac2 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -130,6 +130,10 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
*/
def addMember(clazz: Symbol, member: Symbol): Symbol = {
debuglog(s"mixing into $clazz: ${member.defString}")
+ // This attachment is used to instruct the backend about which methids in traits require
+ // a static trait impl method. We remove this from the new symbol created for the method
+ // mixed into the subclass.
+ member.removeAttachment[NeedStaticImpl.type]
clazz.info.decls enter member setFlag MIXEDIN resetFlag JAVA_DEFAULTMETHOD
}
def cloneAndAddMember(mixinClass: Symbol, mixinMember: Symbol, clazz: Symbol): Symbol =
@@ -344,6 +348,10 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
reporter.error(clazz.pos, "Member %s of mixin %s is missing a concrete super implementation.".format(
mixinMember.alias, mixinClass))
case alias1 =>
+ if (alias1.owner.isJavaDefined && alias1.owner.isInterface && !clazz.parentSymbols.contains(alias1.owner)) {
+ val suggestedParent = exitingTyper(clazz.info.baseType(alias1.owner))
+ reporter.error(clazz.pos, s"Unable to implement a super accessor required by trait ${mixinClass.name} unless $suggestedParent is directly extended by $clazz.")
+ }
superAccessor.asInstanceOf[TermSymbol] setAlias alias1
}
}
@@ -1001,8 +1009,20 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
val parents1 = currentOwner.info.parents map (t => TypeTree(t) setPos tree.pos)
// mark fields which can be nulled afterward
lazyValNullables = nullableFields(templ) withDefaultValue Set()
+ // Remove bodies of accessors in traits - TODO: after PR #5141 (fields refactoring), this might be a no-op
+ val bodyEmptyAccessors = if (!sym.enclClass.isTrait) body else body mapConserve {
+ case dd: DefDef if dd.symbol.isAccessor && !dd.symbol.isLazy =>
+ deriveDefDef(dd)(_ => EmptyTree)
+ case tree => tree
+ }
// add all new definitions to current class or interface
- treeCopy.Template(tree, parents1, self, addNewDefs(currentOwner, body))
+ val body1 = addNewDefs(currentOwner, bodyEmptyAccessors)
+ body1 foreach {
+ case dd: DefDef if isTraitMethodRequiringStaticImpl(dd) =>
+ dd.symbol.updateAttachment(NeedStaticImpl)
+ case _ =>
+ }
+ treeCopy.Template(tree, parents1, self, body1)
case Select(qual, name) if sym.owner.isTrait && !sym.isMethod =>
// refer to fields in some trait an abstract getter in the interface.
@@ -1018,7 +1038,6 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
typedPos(tree.pos)((qual DOT setter)(rhs))
-
case _ =>
tree
}
@@ -1037,4 +1056,14 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
finally localTyper = saved
}
}
+
+ private def isTraitMethodRequiringStaticImpl(dd: DefDef): Boolean = {
+ val sym = dd.symbol
+ dd.rhs.nonEmpty &&
+ sym.owner.isTrait &&
+ !sym.isPrivate && // no need to put implementations of private methods into a static method
+ !sym.hasFlag(Flags.STATIC)
+ }
+
+ case object NeedStaticImpl extends PlainAttachment
}
diff --git a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
index e12b8548a8..5750f8f7e7 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/MatchTranslation.scala
@@ -125,7 +125,7 @@ trait MatchTranslation {
// TODO: paramType may contain unbound type params (run/t2800, run/t3530)
val makers = (
// Statically conforms to paramType
- if (this ensureConformsTo paramType) treeMaker(binder, false, pos) :: Nil
+ if (tpe <:< paramType) treeMaker(binder, false, pos) :: Nil
else typeTest :: extraction :: Nil
)
step(makers: _*)(extractor.subBoundTrees: _*)
@@ -162,16 +162,6 @@ trait MatchTranslation {
setVarInfo(binder, paramType)
true
}
- // If <:< but not =:=, no type test needed, but the tree maker relies on the binder having
- // exactly paramType (and not just some type compatible with it.) SI-6624 shows this is necessary
- // because apparently patBinder may have an unfortunate type (.decls don't have the case field
- // accessors) TODO: get to the bottom of this -- I assume it happens when type checking
- // infers a weird type for an unapply call. By going back to the parameterType for the
- // extractor call we get a saner type, so let's just do that for now.
- def ensureConformsTo(paramType: Type): Boolean = (
- (tpe =:= paramType)
- || (tpe <:< paramType) && setInfo(paramType)
- )
private def concreteType = tpe.bounds.hi
private def unbound = unbind(tree)
@@ -396,7 +386,6 @@ trait MatchTranslation {
/** Create the TreeMaker that embodies this extractor call
*
- * `binder` has been casted to `paramType` if necessary
* `binderKnownNonNull` indicates whether the cast implies `binder` cannot be null
* when `binderKnownNonNull` is `true`, `ProductExtractorTreeMaker` does not do a (redundant) null check on binder
*/
@@ -502,7 +491,7 @@ trait MatchTranslation {
* when `binderKnownNonNull` is `true`, `ProductExtractorTreeMaker` does not do a (redundant) null check on binder
*/
def treeMaker(binder: Symbol, binderKnownNonNull: Boolean, pos: Position): TreeMaker = {
- val paramAccessors = binder.constrParamAccessors
+ val paramAccessors = aligner.wholeType.typeSymbol.constrParamAccessors
val numParams = paramAccessors.length
def paramAccessorAt(subPatIndex: Int) = paramAccessors(math.min(subPatIndex, numParams - 1))
// binders corresponding to mutable fields should be stored (SI-5158, SI-6070)
@@ -531,7 +520,7 @@ trait MatchTranslation {
// reference the (i-1)th case accessor if it exists, otherwise the (i-1)th tuple component
override protected def tupleSel(binder: Symbol)(i: Int): Tree = {
- val accessors = binder.caseFieldAccessors
+ val accessors = aligner.wholeType.typeSymbol.caseFieldAccessors
if (accessors isDefinedAt (i-1)) gen.mkAttributedStableRef(binder) DOT accessors(i-1)
else codegen.tupleSel(binder)(i) // this won't type check for case classes, as they do not inherit ProductN
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
index 2b6a4c763a..215ee1c42b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Checkable.scala
@@ -241,9 +241,7 @@ trait Checkable {
private def isSealedOrFinal(sym: Symbol) = sym.isSealed || sym.isFinal
private def isEffectivelyFinal(sym: Symbol): Boolean = (
// initialization important
- sym.initialize.isEffectivelyFinalOrNotOverridden || (
- settings.future && isTupleSymbol(sym) // SI-7294 step into the future and treat TupleN as final.
- )
+ sym.initialize.isEffectivelyFinalOrNotOverridden
)
def isNeverSubClass(sym1: Symbol, sym2: Symbol) = areIrreconcilableAsParents(sym1, sym2)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 9c1ba7ced1..caad4a907b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1346,7 +1346,7 @@ trait Namers extends MethodSynthesis {
val defRhs = rvparam.rhs
val defaultTree = atPos(vparam.pos.focus) {
- DefDef(Modifiers(paramFlagsToDefaultGetter(meth.flags)) | oflag, name, defTparams, defVparamss, defTpt, defRhs)
+ DefDef(Modifiers(paramFlagsToDefaultGetter(meth.flags), ddef.mods.privateWithin) | oflag, name, defTparams, defVparamss, defTpt, defRhs)
}
if (!isConstr)
methOwner.resetFlag(INTERFACE) // there's a concrete member now
@@ -1764,7 +1764,7 @@ trait Namers extends MethodSynthesis {
* bugs waiting to be reported? If not, why not? When exactly do we need to
* call this method?
*/
- def companionSymbolOf(original: Symbol, ctx: Context): Symbol = {
+ def companionSymbolOf(original: Symbol, ctx: Context): Symbol = if (original == NoSymbol) NoSymbol else {
val owner = original.owner
// SI-7264 Force the info of owners from previous compilation runs.
// Doing this generally would trigger cycles; that's what we also
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
index f90e61ff92..1df3449ce6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
@@ -79,6 +79,7 @@ trait PatternTypers {
// do not update the symbol if the tree's symbol's type does not define an unapply member
// (e.g. since it's some method that returns an object with an unapply member)
val fun = inPlaceAdHocOverloadingResolution(fun0)(hasUnapplyMember)
+ val canElide = treeInfo.isQualifierSafeToElide(fun)
val caseClass = companionSymbolOf(fun.tpe.typeSymbol.sourceModule, context)
val member = unapplyMember(fun.tpe)
def resultType = (fun.tpe memberType member).finalResultType
@@ -94,7 +95,7 @@ trait PatternTypers {
// Dueling test cases: pos/overloaded-unapply.scala, run/case-class-23.scala, pos/t5022.scala
// A case class with 23+ params has no unapply method.
// A case class constructor may be overloaded with unapply methods in the companion.
- if (caseClass.isCase && !member.isOverloaded)
+ if (canElide && caseClass.isCase && !member.isOverloaded)
logResult(s"convertToCaseConstructor($fun, $caseClass, pt=$pt)")(convertToCaseConstructor(fun, caseClass, pt))
else if (!reallyExists(member))
CaseClassConstructorError(fun, s"${fun.symbol} is not a case class, nor does it have an unapply/unapplySeq member")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 9fa3564b2b..ba104fb7a6 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2247,9 +2247,10 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
transformedOrTyped(ddef.rhs, EXPRmode, tpt1.tpe)
}
- if (meth.isClassConstructor && !isPastTyper && !meth.owner.isSubClass(AnyValClass)) {
- // At this point in AnyVal there is no supercall, which will blow up
- // in computeParamAliases; there's nothing to be computed for Anyval anyway.
+ if (meth.isClassConstructor && !isPastTyper && !meth.owner.isSubClass(AnyValClass) && !meth.isJava) {
+ // There are no supercalls for AnyVal or constructors from Java sources, which
+ // would blow up in computeParamAliases; there's nothing to be computed for them
+ // anyway.
if (meth.isPrimaryConstructor)
computeParamAliases(meth.owner, vparamss1, rhs1)
else
diff --git a/src/eclipse/interactive/.classpath b/src/eclipse/interactive/.classpath
index 721351a207..9c02e9bb1a 100644
--- a/src/eclipse/interactive/.classpath
+++ b/src/eclipse/interactive/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="interactive"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.1.0-scala-1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/scaladoc"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
diff --git a/src/eclipse/partest/.classpath b/src/eclipse/partest/.classpath
index 22afd65d43..74eb47032d 100644
--- a/src/eclipse/partest/.classpath
+++ b/src/eclipse/partest/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="partest-extras"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.1.0-scala-1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/repl"/>
<classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/diffutils-1.3.0.jar"/>
<classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/test-interface-1.0.jar"/>
@@ -9,6 +9,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M4-1.0.14.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M5-1.0.17.jar"/>
<classpathentry kind="output" path="build-quick-partest-extras"/>
</classpath>
diff --git a/src/eclipse/repl/.classpath b/src/eclipse/repl/.classpath
index 141f84e6bb..4b53690962 100644
--- a/src/eclipse/repl/.classpath
+++ b/src/eclipse/repl/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="repl"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.1.0-scala-1.jar"/>
<classpathentry kind="var" path="SCALA_BASEDIR/build/deps/repl/jline-2.14.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
diff --git a/src/eclipse/scala-compiler/.classpath b/src/eclipse/scala-compiler/.classpath
index 625b9b2e4b..c468305934 100644
--- a/src/eclipse/scala-compiler/.classpath
+++ b/src/eclipse/scala-compiler/.classpath
@@ -4,7 +4,7 @@
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/reflect"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scala-library"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.1.0-scala-1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="output" path="build-quick-compiler"/>
diff --git a/src/eclipse/scaladoc/.classpath b/src/eclipse/scaladoc/.classpath
index b4450df4ef..9ae1a1c1dd 100644
--- a/src/eclipse/scaladoc/.classpath
+++ b/src/eclipse/scaladoc/.classpath
@@ -2,12 +2,11 @@
<classpath>
<classpathentry kind="src" path="scaladoc"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.1.0-scala-1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-compiler"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/scaladoc/scala-xml_2.12.0-M4-1.0.5.jar"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/scaladoc/scala-parser-combinators_2.12.0-M4-1.0.4.jar"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M4-1.0.14.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/scaladoc/scala-xml_2.12.0-M5-1.0.5.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/partest/scala-partest_2.12.0-M5-1.0.17.jar"/>
<classpathentry kind="output" path="build-quick-scaladoc"/>
</classpath>
diff --git a/src/eclipse/test-junit/.classpath b/src/eclipse/test-junit/.classpath
index 1e1b510663..af112840b7 100644
--- a/src/eclipse/test-junit/.classpath
+++ b/src/eclipse/test-junit/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="test-junit"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.0.4-scala-3.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/asm/scala-asm-5.1.0-scala-1.jar"/>
<classpathentry kind="var" path="SCALA_BASEDIR/lib/ant/ant.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/reflect"/>
<classpathentry combineaccessrules="false" kind="src" path="/scala-library"/>
@@ -10,7 +10,7 @@
<classpathentry combineaccessrules="false" kind="src" path="/repl"/>
<classpathentry combineaccessrules="false" kind="src" path="/partest-extras"/>
<classpathentry combineaccessrules="false" kind="src" path="/scaladoc"/>
- <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/scaladoc/scala-xml_2.12.0-M4-1.0.5.jar"/>
+ <classpathentry kind="var" path="SCALA_BASEDIR/build/deps/scaladoc/scala-xml_2.12.0-M5-1.0.5.jar"/>
<classpathentry kind="var" path="SCALA_BASEDIR/build/deps/junit/jol-core-0.5.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="build-test-junit"/>
diff --git a/src/intellij/README.md b/src/intellij/README.md
index 41fef04183..7bd990288b 100644
--- a/src/intellij/README.md
+++ b/src/intellij/README.md
@@ -17,7 +17,7 @@ are ignored.
## Dependencies
-For every module in the IntelliJ project there is a corresponding `-deps` library, for exmaple `compiler-deps` provides `ant.jar` for the compiler codebase.
+For every module in the IntelliJ project there is a corresponding `-deps` library, for example `compiler-deps` provides `ant.jar` for the compiler codebase.
The `.jar` files in these `-deps` libraries can be easily kept up-to-date by running `sbt intellij` again.
This is necessary whenever the dependencies in the sbt build change, for example when the `starr` version is updated.
@@ -60,7 +60,7 @@ breakpoints within the Scala compiler.
## Running the Compiler and REPL
You can create run/debug configurations to run the compiler and REPL directly within
-IntelliJ, which might accelerate development and debugging of the the compiler.
+IntelliJ, which might accelerate development and debugging of the compiler.
To debug the Scala codebase you can also use "Remote" debug configuration and pass
the corresponding arguments to the jvm running the compiler / program.
diff --git a/src/intellij/scala.ipr.SAMPLE b/src/intellij/scala.ipr.SAMPLE
index 79ad2808f6..01f08c4efd 100644
--- a/src/intellij/scala.ipr.SAMPLE
+++ b/src/intellij/scala.ipr.SAMPLE
@@ -74,9 +74,8 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" />
</CLASSES>
<JAVADOC />
@@ -86,9 +85,8 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -97,14 +95,13 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M3-dc9effe/jars/scala-partest_2.12.0-M3-dc9effe-1.0.13.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/junit/junit/jars/junit-4.11.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/junit/junit/jars/junit-4.12.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
@@ -112,7 +109,7 @@
</library>
<library name="manual-deps">
<CLASSES>
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
</CLASSES>
@@ -123,11 +120,10 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M3-dc9effe/jars/scala-partest_2.12.0-M3-dc9effe-1.0.13.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" />
</CLASSES>
@@ -136,7 +132,7 @@
</library>
<library name="partest-javaagent-deps">
<CLASSES>
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -145,9 +141,8 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -156,9 +151,8 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" />
</CLASSES>
<JAVADOC />
@@ -259,10 +253,9 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M3-dc9effe/jars/scala-partest_2.12.0-M3-dc9effe-1.0.13.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" />
</CLASSES>
@@ -273,9 +266,8 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
@@ -284,12 +276,11 @@
<properties>
<option name="languageLevel" value="Scala_2_12" />
<compiler-classpath>
- <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M3-dc9effe/lib/scala-library.jar" />
- <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M3-dc9effe/lib/scala-compiler.jar" />
- <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M3-dc9effe/lib/scala-parser-combinators_2.12.0-M3-dc9effe.jar" />
- <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M3-dc9effe/lib/scala-reflect.jar" />
- <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M3-dc9effe/lib/scala-xml_2.12.0-M3-dc9effe.jar" />
- <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M3-dc9effe/lib/jline.jar" />
+ <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-library.jar" />
+ <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-compiler.jar" />
+ <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-reflect.jar" />
+ <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/scala-xml_2.12.0-M5.jar" />
+ <root url="file://$USER_HOME$/.sbt/boot/scala-2.12.0-M5/lib/jline.jar" />
</compiler-classpath>
</properties>
<CLASSES />
@@ -300,11 +291,10 @@
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.0.4-scala-3.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M3-dc9effe/bundles/scala-xml_2.12.0-M3-dc9effe-1.0.5.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.12.0-M3-dc9effe/bundles/scala-parser-combinators_2.12.0-M3-dc9effe-1.0.4.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-5.1.0-scala-1.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12.0-M5/bundles/scala-xml_2.12.0-M5-1.0.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/jline/jline/jars/jline-2.14.1.jar!/" />
- <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M3-dc9effe/jars/scala-partest_2.12.0-M3-dc9effe-1.0.13.jar!/" />
+ <root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-partest_2.12.0-M5/jars/scala-partest_2.12.0-M5-1.0.17.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.googlecode.java-diff-utils/diffutils/jars/diffutils-1.3.0.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar!/" />
</CLASSES>
diff --git a/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala b/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala
index 2cb4f5fd4a..00096dd359 100644
--- a/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala
+++ b/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala
@@ -78,10 +78,16 @@ abstract class InteractiveTest
}
protected def execute(): Unit = {
- loadSources()
- runDefaultTests()
+ util.stringFromStream { ostream =>
+ Console.withOut(ostream) {
+ loadSources()
+ runDefaultTests()
+ }
+ }.lines.map(normalize).foreach(println)
}
+ protected def normalize(s: String) = s
+
/** Load all sources before executing the test. */
protected def loadSources() {
// ask the presentation compiler to track all sources. We do
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 7282feebb6..39c583e63b 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -330,9 +330,11 @@ sealed abstract class Option[+A] extends Product with Serializable {
* @version 1.0, 16/07/2003
*/
@SerialVersionUID(1234815782226070388L) // value computed by serialver for 2.11.2, annotation added in 2.11.4
-final case class Some[+A](x: A) extends Option[A] {
+final case class Some[+A](@deprecatedName('x, "2.12.0") value: A) extends Option[A] {
def isEmpty = false
- def get = x
+ def get = value
+
+ @deprecated("Use .value instead.", "2.12.0") def x: A = value
}
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 5f1a6b0bbb..8de9754b50 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -71,7 +71,7 @@ import scala.io.StdIn
*
* @groupname assertions Assertions
* @groupprio assertions 20
- * @groupdesc assertions These methods support program verfication and runtime correctness.
+ * @groupdesc assertions These methods support program verification and runtime correctness.
*
* @groupname console-output Console Output
* @groupprio console-output 30
diff --git a/src/library/scala/Tuple1.scala b/src/library/scala/Tuple1.scala
index 5898b63e21..5544a5f63d 100644
--- a/src/library/scala/Tuple1.scala
+++ b/src/library/scala/Tuple1.scala
@@ -15,8 +15,7 @@ package scala
* @constructor Create a new tuple with 1 elements.
* @param _1 Element 1 of this Tuple1
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple1[@specialized(Int, Long, Double) +T1](_1: T1)
+final case class Tuple1[@specialized(Int, Long, Double) +T1](_1: T1)
extends Product1[T1]
{
override def toString() = "(" + _1 + ")"
diff --git a/src/library/scala/Tuple10.scala b/src/library/scala/Tuple10.scala
index 2b0239561d..c57acb7c6e 100644
--- a/src/library/scala/Tuple10.scala
+++ b/src/library/scala/Tuple10.scala
@@ -24,8 +24,7 @@ package scala
* @param _9 Element 9 of this Tuple10
* @param _10 Element 10 of this Tuple10
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple10[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10)
+final case class Tuple10[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10)
extends Product10[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + "," + _10 + ")"
diff --git a/src/library/scala/Tuple11.scala b/src/library/scala/Tuple11.scala
index 0d5294d547..06360e6679 100644
--- a/src/library/scala/Tuple11.scala
+++ b/src/library/scala/Tuple11.scala
@@ -25,8 +25,7 @@ package scala
* @param _10 Element 10 of this Tuple11
* @param _11 Element 11 of this Tuple11
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple11[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11)
+final case class Tuple11[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11)
extends Product11[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + "," + _10 + "," + _11 + ")"
diff --git a/src/library/scala/Tuple12.scala b/src/library/scala/Tuple12.scala
index d36c8275c1..e223de104d 100644
--- a/src/library/scala/Tuple12.scala
+++ b/src/library/scala/Tuple12.scala
@@ -26,8 +26,7 @@ package scala
* @param _11 Element 11 of this Tuple12
* @param _12 Element 12 of this Tuple12
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple12[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12)
+final case class Tuple12[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12)
extends Product12[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 +
diff --git a/src/library/scala/Tuple13.scala b/src/library/scala/Tuple13.scala
index edc37456fe..56e12b96b6 100644
--- a/src/library/scala/Tuple13.scala
+++ b/src/library/scala/Tuple13.scala
@@ -27,8 +27,7 @@ package scala
* @param _12 Element 12 of this Tuple13
* @param _13 Element 13 of this Tuple13
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple13[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13)
+final case class Tuple13[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13)
extends Product13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 +
diff --git a/src/library/scala/Tuple14.scala b/src/library/scala/Tuple14.scala
index 9896e736c9..53dd4d79bb 100644
--- a/src/library/scala/Tuple14.scala
+++ b/src/library/scala/Tuple14.scala
@@ -28,8 +28,7 @@ package scala
* @param _13 Element 13 of this Tuple14
* @param _14 Element 14 of this Tuple14
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple14[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14)
+final case class Tuple14[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14)
extends Product14[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 +
diff --git a/src/library/scala/Tuple15.scala b/src/library/scala/Tuple15.scala
index 45cd4f751f..0aca96d00d 100644
--- a/src/library/scala/Tuple15.scala
+++ b/src/library/scala/Tuple15.scala
@@ -29,8 +29,7 @@ package scala
* @param _14 Element 14 of this Tuple15
* @param _15 Element 15 of this Tuple15
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple15[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15)
+final case class Tuple15[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15)
extends Product15[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 +
diff --git a/src/library/scala/Tuple16.scala b/src/library/scala/Tuple16.scala
index 2e370a5b31..d4c0c31807 100644
--- a/src/library/scala/Tuple16.scala
+++ b/src/library/scala/Tuple16.scala
@@ -30,8 +30,7 @@ package scala
* @param _15 Element 15 of this Tuple16
* @param _16 Element 16 of this Tuple16
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple16[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16)
+final case class Tuple16[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16)
extends Product16[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 +
diff --git a/src/library/scala/Tuple17.scala b/src/library/scala/Tuple17.scala
index 2242a15fda..47df6cb59f 100644
--- a/src/library/scala/Tuple17.scala
+++ b/src/library/scala/Tuple17.scala
@@ -31,8 +31,7 @@ package scala
* @param _16 Element 16 of this Tuple17
* @param _17 Element 17 of this Tuple17
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple17[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17)
+final case class Tuple17[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17)
extends Product17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 +
diff --git a/src/library/scala/Tuple18.scala b/src/library/scala/Tuple18.scala
index 68f245c6ce..464b08fb28 100644
--- a/src/library/scala/Tuple18.scala
+++ b/src/library/scala/Tuple18.scala
@@ -32,8 +32,7 @@ package scala
* @param _17 Element 17 of this Tuple18
* @param _18 Element 18 of this Tuple18
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple18[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18)
+final case class Tuple18[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18)
extends Product18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 +
diff --git a/src/library/scala/Tuple19.scala b/src/library/scala/Tuple19.scala
index a8a49549fb..d64b3920b4 100644
--- a/src/library/scala/Tuple19.scala
+++ b/src/library/scala/Tuple19.scala
@@ -33,8 +33,7 @@ package scala
* @param _18 Element 18 of this Tuple19
* @param _19 Element 19 of this Tuple19
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple19[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19)
+final case class Tuple19[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19)
extends Product19[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 +
diff --git a/src/library/scala/Tuple2.scala b/src/library/scala/Tuple2.scala
index 9ea1469c5c..5faa4e9821 100644
--- a/src/library/scala/Tuple2.scala
+++ b/src/library/scala/Tuple2.scala
@@ -16,8 +16,7 @@ package scala
* @param _1 Element 1 of this Tuple2
* @param _2 Element 2 of this Tuple2
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple2[@specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) +T1, @specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) +T2](_1: T1, _2: T2)
+final case class Tuple2[@specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) +T1, @specialized(Int, Long, Double, Char, Boolean/*, AnyRef*/) +T2](_1: T1, _2: T2)
extends Product2[T1, T2]
{
override def toString() = "(" + _1 + "," + _2 + ")"
diff --git a/src/library/scala/Tuple20.scala b/src/library/scala/Tuple20.scala
index 0118d382ab..a96c41baa5 100644
--- a/src/library/scala/Tuple20.scala
+++ b/src/library/scala/Tuple20.scala
@@ -34,8 +34,7 @@ package scala
* @param _19 Element 19 of this Tuple20
* @param _20 Element 20 of this Tuple20
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple20[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19, _20: T20)
+final case class Tuple20[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19, _20: T20)
extends Product20[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + "," + _10 +
diff --git a/src/library/scala/Tuple21.scala b/src/library/scala/Tuple21.scala
index ceae94af41..6f240d1fba 100644
--- a/src/library/scala/Tuple21.scala
+++ b/src/library/scala/Tuple21.scala
@@ -35,8 +35,7 @@ package scala
* @param _20 Element 20 of this Tuple21
* @param _21 Element 21 of this Tuple21
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple21[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19, _20: T20, _21: T21)
+final case class Tuple21[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19, _20: T20, _21: T21)
extends Product21[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + "," + _10 +
diff --git a/src/library/scala/Tuple22.scala b/src/library/scala/Tuple22.scala
index ecd567a710..681b709f65 100644
--- a/src/library/scala/Tuple22.scala
+++ b/src/library/scala/Tuple22.scala
@@ -36,8 +36,7 @@ package scala
* @param _21 Element 21 of this Tuple22
* @param _22 Element 22 of this Tuple22
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple22[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21, +T22](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19, _20: T20, _21: T21, _22: T22)
+final case class Tuple22[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9, +T10, +T11, +T12, +T13, +T14, +T15, +T16, +T17, +T18, +T19, +T20, +T21, +T22](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9, _10: T10, _11: T11, _12: T12, _13: T13, _14: T14, _15: T15, _16: T16, _17: T17, _18: T18, _19: T19, _20: T20, _21: T21, _22: T22)
extends Product22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + "," + _10 + "," + _11 +
diff --git a/src/library/scala/Tuple3.scala b/src/library/scala/Tuple3.scala
index 6e71d3ae8c..86f8f7e1a4 100644
--- a/src/library/scala/Tuple3.scala
+++ b/src/library/scala/Tuple3.scala
@@ -17,8 +17,7 @@ package scala
* @param _2 Element 2 of this Tuple3
* @param _3 Element 3 of this Tuple3
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple3[+T1, +T2, +T3](_1: T1, _2: T2, _3: T3)
+final case class Tuple3[+T1, +T2, +T3](_1: T1, _2: T2, _3: T3)
extends Product3[T1, T2, T3]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + ")"
diff --git a/src/library/scala/Tuple4.scala b/src/library/scala/Tuple4.scala
index 4c84cfc674..f3266c262c 100644
--- a/src/library/scala/Tuple4.scala
+++ b/src/library/scala/Tuple4.scala
@@ -18,8 +18,7 @@ package scala
* @param _3 Element 3 of this Tuple4
* @param _4 Element 4 of this Tuple4
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple4[+T1, +T2, +T3, +T4](_1: T1, _2: T2, _3: T3, _4: T4)
+final case class Tuple4[+T1, +T2, +T3, +T4](_1: T1, _2: T2, _3: T3, _4: T4)
extends Product4[T1, T2, T3, T4]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + ")"
diff --git a/src/library/scala/Tuple5.scala b/src/library/scala/Tuple5.scala
index fe8e853f12..e6ac0a6245 100644
--- a/src/library/scala/Tuple5.scala
+++ b/src/library/scala/Tuple5.scala
@@ -19,8 +19,7 @@ package scala
* @param _4 Element 4 of this Tuple5
* @param _5 Element 5 of this Tuple5
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple5[+T1, +T2, +T3, +T4, +T5](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5)
+final case class Tuple5[+T1, +T2, +T3, +T4, +T5](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5)
extends Product5[T1, T2, T3, T4, T5]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + ")"
diff --git a/src/library/scala/Tuple6.scala b/src/library/scala/Tuple6.scala
index 6bf1c73d4b..cf69b9c10a 100644
--- a/src/library/scala/Tuple6.scala
+++ b/src/library/scala/Tuple6.scala
@@ -20,8 +20,7 @@ package scala
* @param _5 Element 5 of this Tuple6
* @param _6 Element 6 of this Tuple6
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple6[+T1, +T2, +T3, +T4, +T5, +T6](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6)
+final case class Tuple6[+T1, +T2, +T3, +T4, +T5, +T6](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6)
extends Product6[T1, T2, T3, T4, T5, T6]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + ")"
diff --git a/src/library/scala/Tuple7.scala b/src/library/scala/Tuple7.scala
index ea42709cb7..4f0200fe23 100644
--- a/src/library/scala/Tuple7.scala
+++ b/src/library/scala/Tuple7.scala
@@ -21,8 +21,7 @@ package scala
* @param _6 Element 6 of this Tuple7
* @param _7 Element 7 of this Tuple7
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple7[+T1, +T2, +T3, +T4, +T5, +T6, +T7](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7)
+final case class Tuple7[+T1, +T2, +T3, +T4, +T5, +T6, +T7](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7)
extends Product7[T1, T2, T3, T4, T5, T6, T7]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + ")"
diff --git a/src/library/scala/Tuple8.scala b/src/library/scala/Tuple8.scala
index c24f9454e0..ebd9f70252 100644
--- a/src/library/scala/Tuple8.scala
+++ b/src/library/scala/Tuple8.scala
@@ -22,8 +22,7 @@ package scala
* @param _7 Element 7 of this Tuple8
* @param _8 Element 8 of this Tuple8
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple8[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8)
+final case class Tuple8[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8)
extends Product8[T1, T2, T3, T4, T5, T6, T7, T8]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + ")"
diff --git a/src/library/scala/Tuple9.scala b/src/library/scala/Tuple9.scala
index ed02b30df2..854fe97b44 100644
--- a/src/library/scala/Tuple9.scala
+++ b/src/library/scala/Tuple9.scala
@@ -23,8 +23,7 @@ package scala
* @param _8 Element 8 of this Tuple9
* @param _9 Element 9 of this Tuple9
*/
-@deprecatedInheritance("Tuples will be made final in a future version.", "2.11.0")
-case class Tuple9[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9)
+final case class Tuple9[+T1, +T2, +T3, +T4, +T5, +T6, +T7, +T8, +T9](_1: T1, _2: T2, _3: T3, _4: T4, _5: T5, _6: T6, _7: T7, _8: T8, _9: T9)
extends Product9[T1, T2, T3, T4, T5, T6, T7, T8, T9]
{
override def toString() = "(" + _1 + "," + _2 + "," + _3 + "," + _4 + "," + _5 + "," + _6 + "," + _7 + "," + _8 + "," + _9 + ")"
diff --git a/src/library/scala/collection/BufferedIterator.scala b/src/library/scala/collection/BufferedIterator.scala
index e6e97d584c..1424ef2fd0 100644
--- a/src/library/scala/collection/BufferedIterator.scala
+++ b/src/library/scala/collection/BufferedIterator.scala
@@ -24,5 +24,11 @@ trait BufferedIterator[+A] extends Iterator[A] {
*/
def head: A
+ /** Returns an option of the next element of an iterator without advancing beyond it.
+ * @return the next element of this iterator if it has a next element
+ * `None` if it does not
+ */
+ def headOption : Option[A] = if (hasNext) Some(head) else None
+
override def buffered: this.type = this
}
diff --git a/src/library/scala/collection/GenMap.scala b/src/library/scala/collection/GenMap.scala
index d17a2de179..6bc507ae93 100644
--- a/src/library/scala/collection/GenMap.scala
+++ b/src/library/scala/collection/GenMap.scala
@@ -18,18 +18,18 @@ import generic._
* @author Aleksandar Prokopec
* @since 2.9
*/
-trait GenMap[A, +B]
-extends GenMapLike[A, B, GenMap[A, B]]
- with GenIterable[(A, B)]
+trait GenMap[K, +V]
+extends GenMapLike[K, V, GenMap[K, V]]
+ with GenIterable[(K, V)]
{
- def seq: Map[A, B]
+ def seq: Map[K, V]
- def updated [B1 >: B](key: A, value: B1): GenMap[A, B1]
+ def updated [V1 >: V](key: K, value: V1): GenMap[K, V1]
}
object GenMap extends GenMapFactory[GenMap] {
- def empty[A, B]: immutable.Map[A, B] = immutable.Map.empty
+ def empty[K, V]: immutable.Map[K, V] = immutable.Map.empty
/** $mapCanBuildFromInfo */
- implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), GenMap[A, B]] = new MapCanBuildFrom[A, B]
+ implicit def canBuildFrom[K, V]: CanBuildFrom[Coll, (K, V), GenMap[K, V]] = new MapCanBuildFrom[K, V]
}
diff --git a/src/library/scala/collection/GenMapLike.scala b/src/library/scala/collection/GenMapLike.scala
index 2b39fa2289..f6c2d071b5 100644
--- a/src/library/scala/collection/GenMapLike.scala
+++ b/src/library/scala/collection/GenMapLike.scala
@@ -22,13 +22,13 @@ package collection
* A map is a collection of bindings from keys to values, where there are
* no duplicate keys.
*/
-trait GenMapLike[A, +B, +Repr] extends GenIterableLike[(A, B), Repr] with Equals with Parallelizable[(A, B), parallel.ParMap[A, B]] {
- def default(key: A): B
- def get(key: A): Option[B]
- def apply(key: A): B
- def seq: Map[A, B]
- def +[B1 >: B](kv: (A, B1)): GenMap[A, B1]
- def - (key: A): Repr
+trait GenMapLike[K, +V, +Repr] extends GenIterableLike[(K, V), Repr] with Equals with Parallelizable[(K, V), parallel.ParMap[K, V]] {
+ def default(key: K): V
+ def get(key: K): Option[V]
+ def apply(key: K): V
+ def seq: Map[K, V]
+ def +[V1 >: V](kv: (K, V1)): GenMap[K, V1]
+ def - (key: K): Repr
// This hash code must be symmetric in the contents but ought not
// collide trivially.
@@ -41,17 +41,17 @@ trait GenMapLike[A, +B, +Repr] extends GenIterableLike[(A, B), Repr] with Equals
* @tparam B1 the result type of the default computation.
* @return the value associated with `key` if it exists,
* otherwise the result of the `default` computation.
- * @usecase def getOrElse(key: A, default: => B): B
+ * @usecase def getOrElse(key: K, default: => V): V
* @inheritdoc
*/
- def getOrElse[B1 >: B](key: A, default: => B1): B1
+ def getOrElse[V1 >: V](key: K, default: => V1): V1
/** Tests whether this map contains a binding for a key.
*
* @param key the key
* @return `true` if there is a binding for `key` in this map, `false` otherwise.
*/
- def contains(key: A): Boolean
+ def contains(key: K): Boolean
/** Tests whether this map contains a binding for a key. This method,
* which implements an abstract method of trait `PartialFunction`,
@@ -60,47 +60,47 @@ trait GenMapLike[A, +B, +Repr] extends GenIterableLike[(A, B), Repr] with Equals
* @param key the key
* @return `true` if there is a binding for `key` in this map, `false` otherwise.
*/
- def isDefinedAt(key: A): Boolean
+ def isDefinedAt(key: K): Boolean
- def keySet: GenSet[A]
+ def keySet: GenSet[K]
/** Collects all keys of this map in an iterable collection.
*
* @return the keys of this map as an iterable.
*/
- def keys: GenIterable[A]
+ def keys: GenIterable[K]
/** Collects all values of this map in an iterable collection.
*
* @return the values of this map as an iterable.
*/
- def values: GenIterable[B]
+ def values: GenIterable[V]
/** Creates an iterator for all keys.
*
* @return an iterator over all keys.
*/
- def keysIterator: Iterator[A]
+ def keysIterator: Iterator[K]
/** Creates an iterator for all values in this map.
*
* @return an iterator over all values that are associated with some key in this map.
*/
- def valuesIterator: Iterator[B]
+ def valuesIterator: Iterator[V]
/** Filters this map by retaining only keys satisfying a predicate.
* @param p the predicate used to test keys
* @return an immutable map consisting only of those key value pairs of this map where the key satisfies
* the predicate `p`. The resulting map wraps the original map without copying any elements.
*/
- def filterKeys(p: A => Boolean): GenMap[A, B]
+ def filterKeys(p: K => Boolean): GenMap[K, V]
/** Transforms this map by applying a function to every retrieved value.
* @param f the function used to transform values of this map.
* @return a map view which maps every key of this map
* to `f(this(key))`. The resulting map wraps the original map without copying any elements.
*/
- def mapValues[C](f: B => C): GenMap[A, C]
+ def mapValues[W](f: V => W): GenMap[K, W]
/** Compares two maps structurally; i.e., checks if all mappings
* contained in this map are also contained in the other map,
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala
index 1e40fd8c24..c9a943f1f7 100644
--- a/src/library/scala/collection/Map.scala
+++ b/src/library/scala/collection/Map.scala
@@ -12,7 +12,7 @@ package collection
import generic._
/**
- * A map from keys of type `A` to values of type `B`.
+ * A map from keys of type `K` to values of type `V`.
*
* $mapNote
*
@@ -22,15 +22,15 @@ import generic._
* '''Note:''' If your additions and mutations return the same kind of map as the map
* you are defining, you should inherit from `MapLike` as well.
*
- * @tparam A the type of the keys in this map.
- * @tparam B the type of the values associated with keys.
+ * @tparam K the type of the keys in this map.
+ * @tparam V the type of the values associated with keys.
*
* @since 1.0
*/
-trait Map[A, +B] extends Iterable[(A, B)] with GenMap[A, B] with MapLike[A, B, Map[A, B]] {
- def empty: Map[A, B] = Map.empty
+trait Map[K, +V] extends Iterable[(K, V)] with GenMap[K, V] with MapLike[K, V, Map[K, V]] {
+ def empty: Map[K, V] = Map.empty
- override def seq: Map[A, B] = this
+ override def seq: Map[K, V] = this
}
/** $factoryInfo
@@ -38,22 +38,22 @@ trait Map[A, +B] extends Iterable[(A, B)] with GenMap[A, B] with MapLike[A, B, M
* @define coll map
*/
object Map extends MapFactory[Map] {
- def empty[A, B]: immutable.Map[A, B] = immutable.Map.empty
+ def empty[K, V]: immutable.Map[K, V] = immutable.Map.empty
/** $mapCanBuildFromInfo */
- implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B]
+ implicit def canBuildFrom[K, V]: CanBuildFrom[Coll, (K, V), Map[K, V]] = new MapCanBuildFrom[K, V]
/** An abstract shell used by { mutable, immutable }.Map but not by collection.Map
* because of variance issues.
*/
- abstract class WithDefault[A, +B](underlying: Map[A, B], d: A => B) extends AbstractMap[A, B] with Map[A, B] with Serializable {
+ abstract class WithDefault[K, +V](underlying: Map[K, V], d: K => V) extends AbstractMap[K, V] with Map[K, V] with Serializable {
override def size = underlying.size
- def get(key: A) = underlying.get(key) // removed in 2.9: orElse Some(default(key))
+ def get(key: K) = underlying.get(key) // removed in 2.9: orElse Some(default(key))
def iterator = underlying.iterator
- override def default(key: A): B = d(key)
+ override def default(key: K): V = d(key)
}
}
/** Explicit instantiation of the `Map` trait to reduce class file size in subclasses. */
-abstract class AbstractMap[A, +B] extends AbstractIterable[(A, B)] with Map[A, B]
+abstract class AbstractMap[K, +V] extends AbstractIterable[(K, V)] with Map[K, V]
diff --git a/src/library/scala/collection/MapLike.scala b/src/library/scala/collection/MapLike.scala
index d4d85c43ec..a087cb0f45 100644
--- a/src/library/scala/collection/MapLike.scala
+++ b/src/library/scala/collection/MapLike.scala
@@ -28,10 +28,10 @@ import parallel.ParMap
* To implement a concrete map, you need to provide implementations of the
* following methods:
* {{{
- * def get(key: A): Option[B]
- * def iterator: Iterator[(A, B)]
- * def + [B1 >: B](kv: (A, B1)): This
- * def -(key: A): This
+ * def get(key: K): Option[V]
+ * def iterator: Iterator[(K, V)]
+ * def + [V1 >: V](kv: (K, V1)): This
+ * def -(key: K): This
* }}}
* If you wish that methods like `take`, `drop`, `filter` also return the same kind of map
* you should also override:
@@ -42,8 +42,8 @@ import parallel.ParMap
* `size` for efficiency.
*
* @define mapTags
- * @tparam A the type of the keys.
- * @tparam B the type of associated values.
+ * @tparam K the type of the keys.
+ * @tparam V the type of associated values.
* @tparam This the type of the map itself.
*
* @author Martin Odersky
@@ -54,12 +54,12 @@ import parallel.ParMap
* @define willNotTerminateInf
* @define mayNotTerminateInf
*/
-trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]]
- extends PartialFunction[A, B]
- with IterableLike[(A, B), This]
- with GenMapLike[A, B, This]
- with Subtractable[A, This]
- with Parallelizable[(A, B), ParMap[A, B]]
+trait MapLike[K, +V, +This <: MapLike[K, V, This] with Map[K, V]]
+ extends PartialFunction[K, V]
+ with IterableLike[(K, V), This]
+ with GenMapLike[K, V, This]
+ with Subtractable[K, This]
+ with Parallelizable[(K, V), ParMap[K, V]]
{
self =>
@@ -71,7 +71,7 @@ self =>
/** A common implementation of `newBuilder` for all maps in terms of `empty`.
* Overridden for mutable maps in `mutable.MapLike`.
*/
- override protected[this] def newBuilder: Builder[(A, B), This] = new MapBuilder[A, B, This](empty)
+ override protected[this] def newBuilder: Builder[(K, V), This] = new MapBuilder[K, V, This](empty)
/** Optionally returns the value associated with a key.
*
@@ -79,32 +79,32 @@ self =>
* @return an option value containing the value associated with `key` in this map,
* or `None` if none exists.
*/
- def get(key: A): Option[B]
+ def get(key: K): Option[V]
/** Creates a new iterator over all key/value pairs of this map
*
* @return the new iterator
*/
- def iterator: Iterator[(A, B)]
+ def iterator: Iterator[(K, V)]
/** Adds a key/value pair to this map, returning a new map.
* @param kv the key/value pair
- * @tparam B1 the type of the value in the key/value pair.
+ * @tparam V1 the type of the value in the key/value pair.
* @return a new map with the new binding added to this map
*
- * @usecase def + (kv: (A, B)): Map[A, B]
+ * @usecase def + (kv: (K, V)): Map[K, V]
* @inheritdoc
*/
- def + [B1 >: B] (kv: (A, B1)): Map[A, B1]
+ def + [V1 >: V] (kv: (K, V1)): Map[K, V1]
/** Removes a key from this map, returning a new map.
* @param key the key to be removed
* @return a new map without a binding for `key`
*
- * @usecase def - (key: A): Map[A, B]
+ * @usecase def - (key: K): Map[K, V]
* @inheritdoc
*/
- def - (key: A): This
+ def - (key: K): This
/** Tests whether the map is empty.
*
@@ -116,14 +116,14 @@ self =>
* @param key the key.
* @param default a computation that yields a default value in case no binding for `key` is
* found in the map.
- * @tparam B1 the result type of the default computation.
+ * @tparam V1 the result type of the default computation.
* @return the value associated with `key` if it exists,
* otherwise the result of the `default` computation.
*
- * @usecase def getOrElse(key: A, default: => B): B
+ * @usecase def getOrElse(key: K, default: => V): V
* @inheritdoc
*/
- def getOrElse[B1 >: B](key: A, default: => B1): B1 = get(key) match {
+ def getOrElse[V1 >: V](key: K, default: => V1): V1 = get(key) match {
case Some(v) => v
case None => default
}
@@ -137,7 +137,7 @@ self =>
* @return the value associated with the given key, or the result of the
* map's `default` method, if none exists.
*/
- def apply(key: A): B = get(key) match {
+ def apply(key: K): V = get(key) match {
case None => default(key)
case Some(value) => value
}
@@ -147,7 +147,7 @@ self =>
* @param key the key
* @return `true` if there is a binding for `key` in this map, `false` otherwise.
*/
- def contains(key: A): Boolean = get(key).isDefined
+ def contains(key: K): Boolean = get(key).isDefined
/** Tests whether this map contains a binding for a key. This method,
* which implements an abstract method of trait `PartialFunction`,
@@ -156,33 +156,33 @@ self =>
* @param key the key
* @return `true` if there is a binding for `key` in this map, `false` otherwise.
*/
- def isDefinedAt(key: A) = contains(key)
+ def isDefinedAt(key: K) = contains(key)
override /*PartialFunction*/
- def applyOrElse[A1 <: A, B1 >: B](x: A1, default: A1 => B1): B1 =
+ def applyOrElse[K1 <: K, V1 >: V](x: K1, default: K1 => V1): V1 =
getOrElse(x, default(x))
/** Collects all keys of this map in a set.
* @return a set containing all keys of this map.
*/
- def keySet: Set[A] = new DefaultKeySet
+ def keySet: Set[K] = new DefaultKeySet
/** The implementation class of the set returned by `keySet`.
*/
- protected class DefaultKeySet extends AbstractSet[A] with Set[A] with Serializable {
- def contains(key : A) = self.contains(key)
+ protected class DefaultKeySet extends AbstractSet[K] with Set[K] with Serializable {
+ def contains(key : K) = self.contains(key)
def iterator = keysIterator
- def + (elem: A): Set[A] = (Set[A]() ++ this + elem).asInstanceOf[Set[A]] // !!! concrete overrides abstract problem
- def - (elem: A): Set[A] = (Set[A]() ++ this - elem).asInstanceOf[Set[A]] // !!! concrete overrides abstract problem
+ def + (elem: K): Set[K] = (Set[K]() ++ this + elem).asInstanceOf[Set[K]] // !!! concrete overrides abstract problem
+ def - (elem: K): Set[K] = (Set[K]() ++ this - elem).asInstanceOf[Set[K]] // !!! concrete overrides abstract problem
override def size = self.size
- override def foreach[U](f: A => U) = self.keysIterator foreach f
+ override def foreach[U](f: K => U) = self.keysIterator foreach f
}
/** Creates an iterator for all keys.
*
* @return an iterator over all keys.
*/
- def keysIterator: Iterator[A] = new AbstractIterator[A] {
+ def keysIterator: Iterator[K] = new AbstractIterator[K] {
val iter = self.iterator
def hasNext = iter.hasNext
def next() = iter.next()._1
@@ -192,29 +192,29 @@ self =>
*
* @return the keys of this map as an iterable.
*/
- @migration("`keys` returns `Iterable[A]` rather than `Iterator[A]`.", "2.8.0")
- def keys: Iterable[A] = keySet
+ @migration("`keys` returns `Iterable[K]` rather than `Iterator[K]`.", "2.8.0")
+ def keys: Iterable[K] = keySet
/** Collects all values of this map in an iterable collection.
*
* @return the values of this map as an iterable.
*/
- @migration("`values` returns `Iterable[B]` rather than `Iterator[B]`.", "2.8.0")
- def values: Iterable[B] = new DefaultValuesIterable
+ @migration("`values` returns `Iterable[V]` rather than `Iterator[V]`.", "2.8.0")
+ def values: Iterable[V] = new DefaultValuesIterable
/** The implementation class of the iterable returned by `values`.
*/
- protected class DefaultValuesIterable extends AbstractIterable[B] with Iterable[B] with Serializable {
+ protected class DefaultValuesIterable extends AbstractIterable[V] with Iterable[V] with Serializable {
def iterator = valuesIterator
override def size = self.size
- override def foreach[U](f: B => U) = self.valuesIterator foreach f
+ override def foreach[U](f: V => U) = self.valuesIterator foreach f
}
/** Creates an iterator for all values in this map.
*
* @return an iterator over all values that are associated with some key in this map.
*/
- def valuesIterator: Iterator[B] = new AbstractIterator[B] {
+ def valuesIterator: Iterator[V] = new AbstractIterator[V] {
val iter = self.iterator
def hasNext = iter.hasNext
def next() = iter.next()._2
@@ -228,33 +228,33 @@ self =>
* @param key the given key value for which a binding is missing.
* @throws NoSuchElementException
*/
- def default(key: A): B =
+ def default(key: K): V =
throw new NoSuchElementException("key not found: " + key)
- protected class FilteredKeys(p: A => Boolean) extends AbstractMap[A, B] with DefaultMap[A, B] {
- override def foreach[U](f: ((A, B)) => U): Unit = for (kv <- self) if (p(kv._1)) f(kv)
+ protected class FilteredKeys(p: K => Boolean) extends AbstractMap[K, V] with DefaultMap[K, V] {
+ override def foreach[U](f: ((K, V)) => U): Unit = for (kv <- self) if (p(kv._1)) f(kv)
def iterator = self.iterator.filter(kv => p(kv._1))
- override def contains(key: A) = p(key) && self.contains(key)
- def get(key: A) = if (!p(key)) None else self.get(key)
+ override def contains(key: K) = p(key) && self.contains(key)
+ def get(key: K) = if (!p(key)) None else self.get(key)
}
/** Filters this map by retaining only keys satisfying a predicate.
*
- * '''Note''': the predicate must accept any key of type `A`, not just those already
+ * '''Note''': the predicate must accept any key of type `K`, not just those already
* present in the map, as the predicate is tested before the underlying map is queried.
*
* @param p the predicate used to test keys
* @return an immutable map consisting only of those key value pairs of this map where the key satisfies
* the predicate `p`. The resulting map wraps the original map without copying any elements.
*/
- def filterKeys(p: A => Boolean): Map[A, B] = new FilteredKeys(p)
+ def filterKeys(p: K => Boolean): Map[K, V] = new FilteredKeys(p)
- protected class MappedValues[C](f: B => C) extends AbstractMap[A, C] with DefaultMap[A, C] {
- override def foreach[U](g: ((A, C)) => U): Unit = for ((k, v) <- self) g((k, f(v)))
+ protected class MappedValues[W](f: V => W) extends AbstractMap[K, W] with DefaultMap[K, W] {
+ override def foreach[U](g: ((K, W)) => U): Unit = for ((k, v) <- self) g((k, f(v)))
def iterator = for ((k, v) <- self.iterator) yield (k, f(v))
override def size = self.size
- override def contains(key: A) = self.contains(key)
- def get(key: A) = self.get(key).map(f)
+ override def contains(key: K) = self.contains(key)
+ def get(key: K) = self.get(key).map(f)
}
/** Transforms this map by applying a function to every retrieved value.
@@ -262,22 +262,22 @@ self =>
* @return a map view which maps every key of this map
* to `f(this(key))`. The resulting map wraps the original map without copying any elements.
*/
- def mapValues[C](f: B => C): Map[A, C] = new MappedValues(f)
+ def mapValues[W](f: V => W): Map[K, W] = new MappedValues(f)
// The following 5 operations (updated, two times +, two times ++) should really be
- // generic, returning This[B]. We need better covariance support to express that though.
+ // generic, returning This[V]. We need better covariance support to express that though.
// So right now we do the brute force approach of code duplication.
/** Creates a new map obtained by updating this map with a given key/value pair.
* @param key the key
* @param value the value
- * @tparam B1 the type of the added value
+ * @tparam V1 the type of the added value
* @return A new map with the new key/value mapping added to this map.
*
- * @usecase def updated(key: A, value: B): Map[A, B]
+ * @usecase def updated(key: K, value: V): Map[K, V]
* @inheritdoc
*/
- def updated [B1 >: B](key: A, value: B1): Map[A, B1] = this + ((key, value))
+ def updated [V1 >: V](key: K, value: V1): Map[K, V1] = this + ((key, value))
/** Adds key/value pairs to this map, returning a new map.
*
@@ -287,27 +287,27 @@ self =>
* @param kv1 the first key/value pair
* @param kv2 the second key/value pair
* @param kvs the remaining key/value pairs
- * @tparam B1 the type of the added values
+ * @tparam V1 the type of the added values
* @return a new map with the given bindings added to this map
*
- * @usecase def + (kvs: (A, B)*): Map[A, B]
+ * @usecase def + (kvs: (K, V)*): Map[K, V]
* @inheritdoc
* @param kvs the key/value pairs
*/
- def + [B1 >: B] (kv1: (A, B1), kv2: (A, B1), kvs: (A, B1) *): Map[A, B1] =
+ def + [V1 >: V] (kv1: (K, V1), kv2: (K, V1), kvs: (K, V1) *): Map[K, V1] =
this + kv1 + kv2 ++ kvs
/** Adds all key/value pairs in a traversable collection to this map, returning a new map.
*
* @param xs the collection containing the added key/value pairs
- * @tparam B1 the type of the added values
+ * @tparam V1 the type of the added values
* @return a new map with the given bindings added to this map
*
- * @usecase def ++ (xs: Traversable[(A, B)]): Map[A, B]
+ * @usecase def ++ (xs: Traversable[(K, V)]): Map[K, V]
* @inheritdoc
*/
- def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): Map[A, B1] =
- ((repr: Map[A, B1]) /: xs.seq) (_ + _)
+ def ++[V1 >: V](xs: GenTraversableOnce[(K, V1)]): Map[K, V1] =
+ ((repr: Map[K, V1]) /: xs.seq) (_ + _)
/** Returns a new map obtained by removing all key/value pairs for which the predicate
* `p` returns `true`.
@@ -320,31 +320,31 @@ self =>
* @param p A predicate over key-value pairs
* @return A new map containing elements not satisfying the predicate.
*/
- override def filterNot(p: ((A, B)) => Boolean): This = {
+ override def filterNot(p: ((K, V)) => Boolean): This = {
var res: This = repr
for (kv <- this)
if (p(kv)) res = (res - kv._1).asInstanceOf[This] // !!! concrete overrides abstract problem
res
}
- override def toSeq: Seq[(A, B)] = {
- if (isEmpty) Vector.empty[(A, B)]
+ override def toSeq: Seq[(K, V)] = {
+ if (isEmpty) Vector.empty[(K, V)]
else {
// Default appropriate for immutable collections; mutable collections override this
- val vb = Vector.newBuilder[(A, B)]
+ val vb = Vector.newBuilder[(K, V)]
foreach(vb += _)
vb.result
}
}
- override def toBuffer[C >: (A, B)]: mutable.Buffer[C] = {
- val result = new mutable.ArrayBuffer[C](size)
+ override def toBuffer[E >: (K, V)]: mutable.Buffer[E] = {
+ val result = new mutable.ArrayBuffer[E](size)
// Faster to let the map iterate itself than to defer through copyToBuffer
foreach(result += _)
result
}
- protected[this] override def parCombiner = ParMap.newCombiner[A, B]
+ protected[this] override def parCombiner = ParMap.newCombiner[K, V]
/** Appends all bindings of this map to a string builder using start, end, and separator strings.
* The written text begins with the string `start` and ends with the string
diff --git a/src/library/scala/collection/immutable/Map.scala b/src/library/scala/collection/immutable/Map.scala
index 6f135cd35f..cbdf7b39f5 100644
--- a/src/library/scala/collection/immutable/Map.scala
+++ b/src/library/scala/collection/immutable/Map.scala
@@ -18,30 +18,30 @@ import generic._
* functionality for the abstract methods in `Map`:
*
* {{{
- * def get(key: A): Option[B]
- * def iterator: Iterator[(A, B)]
- * def + [B1 >: B](kv: (A, B1)): Map[A, B1]
- * def -(key: A): Map[A, B]
+ * def get(key: K): Option[V]
+ * def iterator: Iterator[(K, V)]
+ * def + [V1 >: V](kv: (K, V1)): Map[K, V1]
+ * def -(key: K): Map[K, V]
* }}}
*
* @since 1
*/
-trait Map[A, +B] extends Iterable[(A, B)]
-// with GenMap[A, B]
- with scala.collection.Map[A, B]
- with MapLike[A, B, Map[A, B]] { self =>
+trait Map[K, +V] extends Iterable[(K, V)]
+// with GenMap[K, V]
+ with scala.collection.Map[K, V]
+ with MapLike[K, V, Map[K, V]] { self =>
- override def empty: Map[A, B] = Map.empty
+ override def empty: Map[K, V] = Map.empty
/** Returns this $coll as an immutable map.
*
* A new map will not be built; lazy collections will stay lazy.
*/
@deprecatedOverriding("Immutable maps should do nothing on toMap except return themselves cast as a map.", "2.11.0")
- override def toMap[T, U](implicit ev: (A, B) <:< (T, U)): immutable.Map[T, U] =
+ override def toMap[T, U](implicit ev: (K, V) <:< (T, U)): immutable.Map[T, U] =
self.asInstanceOf[immutable.Map[T, U]]
- override def seq: Map[A, B] = this
+ override def seq: Map[K, V] = this
/** The same map with a given default function.
* Note: `get`, `contains`, `iterator`, `keys`, etc are not affected by `withDefault`.
@@ -51,7 +51,7 @@ trait Map[A, +B] extends Iterable[(A, B)]
* @param d the function mapping keys to values, used for non-present keys
* @return a wrapper of the map with a default value
*/
- def withDefault[B1 >: B](d: A => B1): immutable.Map[A, B1] = new Map.WithDefault[A, B1](this, d)
+ def withDefault[V1 >: V](d: K => V1): immutable.Map[K, V1] = new Map.WithDefault[K, V1](this, d)
/** The same map with a given default value.
* Note: `get`, `contains`, `iterator`, `keys`, etc are not affected by `withDefaultValue`.
@@ -61,15 +61,15 @@ trait Map[A, +B] extends Iterable[(A, B)]
* @param d default value used for non-present keys
* @return a wrapper of the map with a default value
*/
- def withDefaultValue[B1 >: B](d: B1): immutable.Map[A, B1] = new Map.WithDefault[A, B1](this, x => d)
+ def withDefaultValue[V1 >: V](d: V1): immutable.Map[K, V1] = new Map.WithDefault[K, V1](this, x => d)
/** Add a key/value pair to this map.
* @param key the key
* @param value the value
* @return A new map with the new binding added to this map
*/
- override def updated [B1 >: B](key: A, value: B1): Map[A, B1]
- def + [B1 >: B](kv: (A, B1)): Map[A, B1]
+ override def updated [V1 >: V](key: K, value: V1): Map[K, V1]
+ def + [V1 >: V](kv: (K, V1)): Map[K, V1]
}
/** $factoryInfo
@@ -79,17 +79,17 @@ trait Map[A, +B] extends Iterable[(A, B)]
object Map extends ImmutableMapFactory[Map] {
/** $mapCanBuildFromInfo */
- implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B]
+ implicit def canBuildFrom[K, V]: CanBuildFrom[Coll, (K, V), Map[K, V]] = new MapCanBuildFrom[K, V]
- def empty[A, B]: Map[A, B] = EmptyMap.asInstanceOf[Map[A, B]]
+ def empty[K, V]: Map[K, V] = EmptyMap.asInstanceOf[Map[K, V]]
- class WithDefault[A, +B](underlying: Map[A, B], d: A => B) extends scala.collection.Map.WithDefault[A, B](underlying, d) with Map[A, B] {
+ class WithDefault[K, +V](underlying: Map[K, V], d: K => V) extends scala.collection.Map.WithDefault[K, V](underlying, d) with Map[K, V] {
override def empty = new WithDefault(underlying.empty, d)
- override def updated[B1 >: B](key: A, value: B1): WithDefault[A, B1] = new WithDefault[A, B1](underlying.updated[B1](key, value), d)
- override def + [B1 >: B](kv: (A, B1)): WithDefault[A, B1] = updated(kv._1, kv._2)
- override def - (key: A): WithDefault[A, B] = new WithDefault(underlying - key, d)
- override def withDefault[B1 >: B](d: A => B1): immutable.Map[A, B1] = new WithDefault[A, B1](underlying, d)
- override def withDefaultValue[B1 >: B](d: B1): immutable.Map[A, B1] = new WithDefault[A, B1](underlying, x => d)
+ override def updated[V1 >: V](key: K, value: V1): WithDefault[K, V1] = new WithDefault[K, V1](underlying.updated[V1](key, value), d)
+ override def + [V1 >: V](kv: (K, V1)): WithDefault[K, V1] = updated(kv._1, kv._2)
+ override def - (key: K): WithDefault[K, V] = new WithDefault(underlying - key, d)
+ override def withDefault[V1 >: V](d: K => V1): immutable.Map[K, V1] = new WithDefault[K, V1](underlying, d)
+ override def withDefaultValue[V1 >: V](d: V1): immutable.Map[K, V1] = new WithDefault[K, V1](underlying, x => d)
}
private object EmptyMap extends AbstractMap[Any, Nothing] with Map[Any, Nothing] with Serializable {
@@ -98,119 +98,119 @@ object Map extends ImmutableMapFactory[Map] {
override def contains(key: Any) = false
def get(key: Any): Option[Nothing] = None
def iterator: Iterator[(Any, Nothing)] = Iterator.empty
- override def updated [B1] (key: Any, value: B1): Map[Any, B1] = new Map1(key, value)
- def + [B1](kv: (Any, B1)): Map[Any, B1] = updated(kv._1, kv._2)
+ override def updated [V1] (key: Any, value: V1): Map[Any, V1] = new Map1(key, value)
+ def + [V1](kv: (Any, V1)): Map[Any, V1] = updated(kv._1, kv._2)
def - (key: Any): Map[Any, Nothing] = this
}
- class Map1[A, +B](key1: A, value1: B) extends AbstractMap[A, B] with Map[A, B] with Serializable {
+ class Map1[K, +V](key1: K, value1: V) extends AbstractMap[K, V] with Map[K, V] with Serializable {
override def size = 1
- override def apply(key: A) = if (key == key1) value1 else throw new NoSuchElementException("key not found: " + key)
- override def contains(key: A) = key == key1
- def get(key: A): Option[B] =
+ override def apply(key: K) = if (key == key1) value1 else throw new NoSuchElementException("key not found: " + key)
+ override def contains(key: K) = key == key1
+ def get(key: K): Option[V] =
if (key == key1) Some(value1) else None
def iterator = Iterator((key1, value1))
- override def updated [B1 >: B] (key: A, value: B1): Map[A, B1] =
+ override def updated [V1 >: V] (key: K, value: V1): Map[K, V1] =
if (key == key1) new Map1(key1, value)
else new Map2(key1, value1, key, value)
- def + [B1 >: B](kv: (A, B1)): Map[A, B1] = updated(kv._1, kv._2)
- def - (key: A): Map[A, B] =
+ def + [V1 >: V](kv: (K, V1)): Map[K, V1] = updated(kv._1, kv._2)
+ def - (key: K): Map[K, V] =
if (key == key1) Map.empty else this
- override def foreach[U](f: ((A, B)) => U): Unit = {
+ override def foreach[U](f: ((K, V)) => U): Unit = {
f((key1, value1))
}
}
- class Map2[A, +B](key1: A, value1: B, key2: A, value2: B) extends AbstractMap[A, B] with Map[A, B] with Serializable {
+ class Map2[K, +V](key1: K, value1: V, key2: K, value2: V) extends AbstractMap[K, V] with Map[K, V] with Serializable {
override def size = 2
- override def apply(key: A) =
+ override def apply(key: K) =
if (key == key1) value1
else if (key == key2) value2
else throw new NoSuchElementException("key not found: " + key)
- override def contains(key: A) = (key == key1) || (key == key2)
- def get(key: A): Option[B] =
+ override def contains(key: K) = (key == key1) || (key == key2)
+ def get(key: K): Option[V] =
if (key == key1) Some(value1)
else if (key == key2) Some(value2)
else None
def iterator = Iterator((key1, value1), (key2, value2))
- override def updated [B1 >: B] (key: A, value: B1): Map[A, B1] =
+ override def updated [V1 >: V] (key: K, value: V1): Map[K, V1] =
if (key == key1) new Map2(key1, value, key2, value2)
else if (key == key2) new Map2(key1, value1, key2, value)
else new Map3(key1, value1, key2, value2, key, value)
- def + [B1 >: B](kv: (A, B1)): Map[A, B1] = updated(kv._1, kv._2)
- def - (key: A): Map[A, B] =
+ def + [V1 >: V](kv: (K, V1)): Map[K, V1] = updated(kv._1, kv._2)
+ def - (key: K): Map[K, V] =
if (key == key1) new Map1(key2, value2)
else if (key == key2) new Map1(key1, value1)
else this
- override def foreach[U](f: ((A, B)) => U): Unit = {
+ override def foreach[U](f: ((K, V)) => U): Unit = {
f((key1, value1)); f((key2, value2))
}
}
- class Map3[A, +B](key1: A, value1: B, key2: A, value2: B, key3: A, value3: B) extends AbstractMap[A, B] with Map[A, B] with Serializable {
+ class Map3[K, +V](key1: K, value1: V, key2: K, value2: V, key3: K, value3: V) extends AbstractMap[K, V] with Map[K, V] with Serializable {
override def size = 3
- override def apply(key: A) =
+ override def apply(key: K) =
if (key == key1) value1
else if (key == key2) value2
else if (key == key3) value3
else throw new NoSuchElementException("key not found: " + key)
- override def contains(key: A) = (key == key1) || (key == key2) || (key == key3)
- def get(key: A): Option[B] =
+ override def contains(key: K) = (key == key1) || (key == key2) || (key == key3)
+ def get(key: K): Option[V] =
if (key == key1) Some(value1)
else if (key == key2) Some(value2)
else if (key == key3) Some(value3)
else None
def iterator = Iterator((key1, value1), (key2, value2), (key3, value3))
- override def updated [B1 >: B] (key: A, value: B1): Map[A, B1] =
+ override def updated [V1 >: V] (key: K, value: V1): Map[K, V1] =
if (key == key1) new Map3(key1, value, key2, value2, key3, value3)
else if (key == key2) new Map3(key1, value1, key2, value, key3, value3)
else if (key == key3) new Map3(key1, value1, key2, value2, key3, value)
else new Map4(key1, value1, key2, value2, key3, value3, key, value)
- def + [B1 >: B](kv: (A, B1)): Map[A, B1] = updated(kv._1, kv._2)
- def - (key: A): Map[A, B] =
+ def + [V1 >: V](kv: (K, V1)): Map[K, V1] = updated(kv._1, kv._2)
+ def - (key: K): Map[K, V] =
if (key == key1) new Map2(key2, value2, key3, value3)
else if (key == key2) new Map2(key1, value1, key3, value3)
else if (key == key3) new Map2(key1, value1, key2, value2)
else this
- override def foreach[U](f: ((A, B)) => U): Unit = {
+ override def foreach[U](f: ((K, V)) => U): Unit = {
f((key1, value1)); f((key2, value2)); f((key3, value3))
}
}
- class Map4[A, +B](key1: A, value1: B, key2: A, value2: B, key3: A, value3: B, key4: A, value4: B) extends AbstractMap[A, B] with Map[A, B] with Serializable {
+ class Map4[K, +V](key1: K, value1: V, key2: K, value2: V, key3: K, value3: V, key4: K, value4: V) extends AbstractMap[K, V] with Map[K, V] with Serializable {
override def size = 4
- override def apply(key: A) =
+ override def apply(key: K) =
if (key == key1) value1
else if (key == key2) value2
else if (key == key3) value3
else if (key == key4) value4
else throw new NoSuchElementException("key not found: " + key)
- override def contains(key: A) = (key == key1) || (key == key2) || (key == key3) || (key == key4)
- def get(key: A): Option[B] =
+ override def contains(key: K) = (key == key1) || (key == key2) || (key == key3) || (key == key4)
+ def get(key: K): Option[V] =
if (key == key1) Some(value1)
else if (key == key2) Some(value2)
else if (key == key3) Some(value3)
else if (key == key4) Some(value4)
else None
def iterator = Iterator((key1, value1), (key2, value2), (key3, value3), (key4, value4))
- override def updated [B1 >: B] (key: A, value: B1): Map[A, B1] =
+ override def updated [V1 >: V] (key: K, value: V1): Map[K, V1] =
if (key == key1) new Map4(key1, value, key2, value2, key3, value3, key4, value4)
else if (key == key2) new Map4(key1, value1, key2, value, key3, value3, key4, value4)
else if (key == key3) new Map4(key1, value1, key2, value2, key3, value, key4, value4)
else if (key == key4) new Map4(key1, value1, key2, value2, key3, value3, key4, value)
else new HashMap + ((key1, value1), (key2, value2), (key3, value3), (key4, value4), (key, value))
- def + [B1 >: B](kv: (A, B1)): Map[A, B1] = updated(kv._1, kv._2)
- def - (key: A): Map[A, B] =
+ def + [V1 >: V](kv: (K, V1)): Map[K, V1] = updated(kv._1, kv._2)
+ def - (key: K): Map[K, V] =
if (key == key1) new Map3(key2, value2, key3, value3, key4, value4)
else if (key == key2) new Map3(key1, value1, key3, value3, key4, value4)
else if (key == key3) new Map3(key1, value1, key2, value2, key4, value4)
else if (key == key4) new Map3(key1, value1, key2, value2, key3, value3)
else this
- override def foreach[U](f: ((A, B)) => U): Unit = {
+ override def foreach[U](f: ((K, V)) => U): Unit = {
f((key1, value1)); f((key2, value2)); f((key3, value3)); f((key4, value4))
}
}
}
/** Explicit instantiation of the `Map` trait to reduce class file size in subclasses. */
-abstract class AbstractMap[A, +B] extends scala.collection.AbstractMap[A, B] with Map[A, B]
+abstract class AbstractMap[K, +V] extends scala.collection.AbstractMap[K, V] with Map[K, V]
diff --git a/src/library/scala/collection/immutable/MapLike.scala b/src/library/scala/collection/immutable/MapLike.scala
index bd5b9c9faf..5867383b52 100644
--- a/src/library/scala/collection/immutable/MapLike.scala
+++ b/src/library/scala/collection/immutable/MapLike.scala
@@ -14,16 +14,16 @@ import generic._
import parallel.immutable.ParMap
/**
- * A generic template for immutable maps from keys of type `A`
- * to values of type `B`.
+ * A generic template for immutable maps from keys of type `K`
+ * to values of type `V`.
* To implement a concrete map, you need to provide implementations of the
* following methods (where `This` is the type of the actual map implementation):
*
* {{{
- * def get(key: A): Option[B]
- * def iterator: Iterator[(A, B)]
- * def + [B1 >: B](kv: (A, B)): Map[A, B1]
- * def - (key: A): This
+ * def get(key: K): Option[V]
+ * def iterator: Iterator[(K, V)]
+ * def + [V1 >: V](kv: (K, V)): Map[K, V1]
+ * def - (key: K): This
* }}}
*
* If you wish that transformer methods like `take`, `drop`, `filter` return the
@@ -36,8 +36,8 @@ import parallel.immutable.ParMap
* It is also good idea to override methods `foreach` and
* `size` for efficiency.
*
- * @tparam A the type of the keys contained in this collection.
- * @tparam B the type of the values associated with the keys.
+ * @tparam K the type of the keys contained in this collection.
+ * @tparam V the type of the values associated with the keys.
* @tparam This The type of the actual map implementation.
*
* @author Martin Odersky
@@ -46,26 +46,26 @@ import parallel.immutable.ParMap
* @define Coll immutable.Map
* @define coll immutable map
*/
-trait MapLike[A, +B, +This <: MapLike[A, B, This] with Map[A, B]]
- extends scala.collection.MapLike[A, B, This]
- with Parallelizable[(A, B), ParMap[A, B]]
+trait MapLike[K, +V, +This <: MapLike[K, V, This] with Map[K, V]]
+ extends scala.collection.MapLike[K, V, This]
+ with Parallelizable[(K, V), ParMap[K, V]]
{
self =>
- protected[this] override def parCombiner = ParMap.newCombiner[A, B]
+ protected[this] override def parCombiner = ParMap.newCombiner[K, V]
/** A new immutable map containing updating this map with a given key/value mapping.
* @param key the key
* @param value the value
* @return A new map with the new key/value mapping
*/
- override def updated [B1 >: B](key: A, value: B1): immutable.Map[A, B1] = this + ((key, value))
+ override def updated [V1 >: V](key: K, value: V1): immutable.Map[K, V1] = this + ((key, value))
/** Add a key/value pair to this map, returning a new map.
* @param kv the key/value pair.
* @return A new map with the new binding added to this map.
*/
- def + [B1 >: B] (kv: (A, B1)): immutable.Map[A, B1]
+ def + [V1 >: V] (kv: (K, V1)): immutable.Map[K, V1]
/** Adds two or more elements to this collection and returns
* a new collection.
@@ -75,7 +75,7 @@ self =>
* @param elems the remaining elements to add.
* @return A new map with the new bindings added to this map.
*/
- override def + [B1 >: B] (elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *): immutable.Map[A, B1] =
+ override def + [V1 >: V] (elem1: (K, V1), elem2: (K, V1), elems: (K, V1) *): immutable.Map[K, V1] =
this + elem1 + elem2 ++ elems
/** Adds a number of elements provided by a traversable object
@@ -84,40 +84,40 @@ self =>
* @param xs the traversable object consisting of key-value pairs.
* @return a new immutable map with the bindings of this map and those from `xs`.
*/
- override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): immutable.Map[A, B1] =
- ((repr: immutable.Map[A, B1]) /: xs.seq) (_ + _)
+ override def ++[V1 >: V](xs: GenTraversableOnce[(K, V1)]): immutable.Map[K, V1] =
+ ((repr: immutable.Map[K, V1]) /: xs.seq) (_ + _)
/** Filters this map by retaining only keys satisfying a predicate.
* @param p the predicate used to test keys
* @return an immutable map consisting only of those key value pairs of this map where the key satisfies
* the predicate `p`. The resulting map wraps the original map without copying any elements.
*/
- override def filterKeys(p: A => Boolean): Map[A, B] = new FilteredKeys(p) with DefaultMap[A, B]
+ override def filterKeys(p: K => Boolean): Map[K, V] = new FilteredKeys(p) with DefaultMap[K, V]
/** Transforms this map by applying a function to every retrieved value.
* @param f the function used to transform values of this map.
* @return a map view which maps every key of this map
* to `f(this(key))`. The resulting map wraps the original map without copying any elements.
*/
- override def mapValues[C](f: B => C): Map[A, C] = new MappedValues(f) with DefaultMap[A, C]
+ override def mapValues[W](f: V => W): Map[K, W] = new MappedValues(f) with DefaultMap[K, W]
/** Collects all keys of this map in a set.
* @return a set containing all keys of this map.
*/
- override def keySet: immutable.Set[A] = new ImmutableDefaultKeySet
+ override def keySet: immutable.Set[K] = new ImmutableDefaultKeySet
- protected class ImmutableDefaultKeySet extends super.DefaultKeySet with immutable.Set[A] {
- override def + (elem: A): immutable.Set[A] =
+ protected class ImmutableDefaultKeySet extends super.DefaultKeySet with immutable.Set[K] {
+ override def + (elem: K): immutable.Set[K] =
if (this(elem)) this
- else immutable.Set[A]() ++ this + elem
- override def - (elem: A): immutable.Set[A] =
- if (this(elem)) immutable.Set[A]() ++ this - elem
+ else immutable.Set[K]() ++ this + elem
+ override def - (elem: K): immutable.Set[K] =
+ if (this(elem)) immutable.Set[K]() ++ this - elem
else this
// ImmutableDefaultKeySet is only protected, so we won't warn on override.
// Someone could override in a way that makes widening not okay
// (e.g. by overriding +, though the version in this class is fine)
- override def toSet[B >: A]: Set[B] = this.asInstanceOf[Set[B]]
+ override def toSet[B >: K]: Set[B] = this.asInstanceOf[Set[B]]
}
/** This function transforms all the values of mappings contained
@@ -126,10 +126,9 @@ self =>
* @param f A function over keys and values
* @return the updated map
*/
- def transform[C, That](f: (A, B) => C)(implicit bf: CanBuildFrom[This, (A, C), That]): That = {
+ def transform[W, That](f: (K, V) => W)(implicit bf: CanBuildFrom[This, (K, W), That]): That = {
val b = bf(repr)
for ((key, value) <- this) b += ((key, f(key, value)))
b.result()
}
}
-
diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala
index 3ad6656636..1dd0d7683a 100644
--- a/src/library/scala/collection/immutable/Queue.scala
+++ b/src/library/scala/collection/immutable/Queue.scala
@@ -84,6 +84,14 @@ sealed class Queue[+A] protected(protected val in: List[A], protected val out: L
else if (in.nonEmpty) new Queue(Nil, in.reverse.tail)
else throw new NoSuchElementException("tail on empty queue")
+ /* This is made to avoid inefficient implementation of iterator. */
+ override def forall(p: A => Boolean): Boolean =
+ in.forall(p) && out.forall(p)
+
+ /* This is made to avoid inefficient implementation of iterator. */
+ override def exists(p: A => Boolean): Boolean =
+ in.exists(p) || out.exists(p)
+
/** Returns the length of the queue.
*/
override def length = in.length + out.length
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala
index 2e56750115..82203b3d1a 100644
--- a/src/library/scala/collection/immutable/Range.scala
+++ b/src/library/scala/collection/immutable/Range.scala
@@ -437,7 +437,7 @@ object Range {
def count(start: Int, end: Int, step: Int): Int =
count(start, end, step, isInclusive = false)
- class Inclusive(start: Int, end: Int, step: Int) extends Range(start, end, step) {
+ final class Inclusive(start: Int, end: Int, step: Int) extends Range(start, end, step) {
// override def par = new ParRange(this)
override def isInclusive = true
override protected def copy(start: Int, end: Int, step: Int): Range = new Inclusive(start, end, step)
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala
index b48a32fa37..bb15788bdf 100644
--- a/src/library/scala/collection/mutable/HashTable.scala
+++ b/src/library/scala/collection/mutable/HashTable.scala
@@ -183,6 +183,7 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
table(h) = e.next
tableSize = tableSize - 1
nnSizeMapRemove(h)
+ e.next = null
return e
} else {
var e1 = e.next
@@ -194,6 +195,7 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
e.next = e1.next
tableSize = tableSize - 1
nnSizeMapRemove(h)
+ e1.next = null
return e1
}
}
@@ -227,8 +229,9 @@ trait HashTable[A, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashU
var es = iterTable(idx)
while (es != null) {
+ val next = es.next // Cache next in case f removes es.
f(es.asInstanceOf[Entry])
- es = es.next
+ es = next
while (es == null && idx > 0) {
idx -= 1
diff --git a/src/library/scala/collection/mutable/LinkedHashMap.scala b/src/library/scala/collection/mutable/LinkedHashMap.scala
index 275f490675..a731b1bbdc 100644
--- a/src/library/scala/collection/mutable/LinkedHashMap.scala
+++ b/src/library/scala/collection/mutable/LinkedHashMap.scala
@@ -81,6 +81,8 @@ class LinkedHashMap[A, B] extends AbstractMap[A, B]
else e.earlier.later = e.later
if (e.later eq null) lastEntry = e.earlier
else e.later.earlier = e.earlier
+ e.earlier = null // Null references to prevent nepotism
+ e.later = null
Some(e.value)
}
}
diff --git a/src/library/scala/collection/mutable/LinkedHashSet.scala b/src/library/scala/collection/mutable/LinkedHashSet.scala
index 756a2f73c1..f00cbd90dc 100644
--- a/src/library/scala/collection/mutable/LinkedHashSet.scala
+++ b/src/library/scala/collection/mutable/LinkedHashSet.scala
@@ -73,6 +73,8 @@ class LinkedHashSet[A] extends AbstractSet[A]
else e.earlier.later = e.later
if (e.later eq null) lastEntry = e.earlier
else e.later.earlier = e.earlier
+ e.earlier = null // Null references to prevent nepotism
+ e.later = null
true
}
}
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala
index 2ac3cb65b5..460a8b8f77 100644
--- a/src/library/scala/collection/mutable/Map.scala
+++ b/src/library/scala/collection/mutable/Map.scala
@@ -20,15 +20,15 @@ import generic._
* @since 1.0
* @author Matthias Zenger
*/
-trait Map[A, B]
- extends Iterable[(A, B)]
-// with GenMap[A, B]
- with scala.collection.Map[A, B]
- with MapLike[A, B, Map[A, B]] {
+trait Map[K, V]
+ extends Iterable[(K, V)]
+// with GenMap[K, V]
+ with scala.collection.Map[K, V]
+ with MapLike[K, V, Map[K, V]] {
- override def empty: Map[A, B] = Map.empty
+ override def empty: Map[K, V] = Map.empty
- override def seq: Map[A, B] = this
+ override def seq: Map[K, V] = this
/** The same map with a given default function.
*
@@ -37,7 +37,7 @@ trait Map[A, B]
* @param d the function mapping keys to values, used for non-present keys
* @return a wrapper of the map with a default value
*/
- def withDefault(d: A => B): mutable.Map[A, B] = new Map.WithDefault[A, B](this, d)
+ def withDefault(d: K => V): mutable.Map[K, V] = new Map.WithDefault[K, V](this, d)
/** The same map with a given default value.
*
@@ -46,7 +46,7 @@ trait Map[A, B]
* @param d default value used for non-present keys
* @return a wrapper of the map with a default value
*/
- def withDefaultValue(d: B): mutable.Map[A, B] = new Map.WithDefault[A, B](this, x => d)
+ def withDefaultValue(d: V): mutable.Map[K, V] = new Map.WithDefault[K, V](this, x => d)
}
/** $factoryInfo
@@ -56,25 +56,25 @@ trait Map[A, B]
*/
object Map extends MutableMapFactory[Map] {
/** $canBuildFromInfo */
- implicit def canBuildFrom[A, B]: CanBuildFrom[Coll, (A, B), Map[A, B]] = new MapCanBuildFrom[A, B]
+ implicit def canBuildFrom[K, V]: CanBuildFrom[Coll, (K, V), Map[K, V]] = new MapCanBuildFrom[K, V]
- def empty[A, B]: Map[A, B] = new HashMap[A, B]
+ def empty[K, V]: Map[K, V] = new HashMap[K, V]
- class WithDefault[A, B](underlying: Map[A, B], d: A => B) extends scala.collection.Map.WithDefault(underlying, d) with Map[A, B] {
- override def += (kv: (A, B)) = {underlying += kv; this}
- def -= (key: A) = {underlying -= key; this}
+ class WithDefault[K, V](underlying: Map[K, V], d: K => V) extends scala.collection.Map.WithDefault(underlying, d) with Map[K, V] {
+ override def += (kv: (K, V)) = {underlying += kv; this}
+ def -= (key: K) = {underlying -= key; this}
override def empty = new WithDefault(underlying.empty, d)
- override def updated[B1 >: B](key: A, value: B1): WithDefault[A, B1] = new WithDefault[A, B1](underlying.updated[B1](key, value), d)
- override def + [B1 >: B](kv: (A, B1)): WithDefault[A, B1] = updated(kv._1, kv._2)
- override def - (key: A): WithDefault[A, B] = new WithDefault(underlying - key, d)
+ override def updated[V1 >: V](key: K, value: V1): WithDefault[K, V1] = new WithDefault[K, V1](underlying.updated[V1](key, value), d)
+ override def + [V1 >: V](kv: (K, V1)): WithDefault[K, V1] = updated(kv._1, kv._2)
+ override def - (key: K): WithDefault[K, V] = new WithDefault(underlying - key, d)
/** If these methods aren't overridden to thread through the underlying map,
* successive calls to withDefault* have no effect.
*/
- override def withDefault(d: A => B): mutable.Map[A, B] = new WithDefault[A, B](underlying, d)
- override def withDefaultValue(d: B): mutable.Map[A, B] = new WithDefault[A, B](underlying, x => d)
+ override def withDefault(d: K => V): mutable.Map[K, V] = new WithDefault[K, V](underlying, d)
+ override def withDefaultValue(d: V): mutable.Map[K, V] = new WithDefault[K, V](underlying, x => d)
}
}
/** Explicit instantiation of the `Map` trait to reduce class file size in subclasses. */
-abstract class AbstractMap[A, B] extends scala.collection.AbstractMap[A, B] with Map[A, B]
+abstract class AbstractMap[K, V] extends scala.collection.AbstractMap[K, V] with Map[K, V]
diff --git a/src/library/scala/collection/mutable/MapLike.scala b/src/library/scala/collection/mutable/MapLike.scala
index 949e5e3536..238b6d1be1 100644
--- a/src/library/scala/collection/mutable/MapLike.scala
+++ b/src/library/scala/collection/mutable/MapLike.scala
@@ -31,10 +31,10 @@ import scala.collection.parallel.mutable.ParMap
* To implement a concrete mutable map, you need to provide
* implementations of the following methods:
* {{{
- * def get(key: A): Option[B]
- * def iterator: Iterator[(A, B)]
- * def += (kv: (A, B)): This
- * def -= (key: A): This
+ * def get(key: K): Option[V]
+ * def iterator: Iterator[(K, V)]
+ * def += (kv: (K, V)): This
+ * def -= (key: K): This
* }}}
* If you wish that methods like `take`, `drop`, `filter` also return the same kind of map
* you should also override:
@@ -44,13 +44,13 @@ import scala.collection.parallel.mutable.ParMap
* It is also good idea to override methods `foreach` and
* `size` for efficiency.
*/
-trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
- extends scala.collection.MapLike[A, B, This]
- with Builder[(A, B), This]
- with Growable[(A, B)]
- with Shrinkable[A]
+trait MapLike[K, V, +This <: MapLike[K, V, This] with Map[K, V]]
+ extends scala.collection.MapLike[K, V, This]
+ with Builder[(K, V), This]
+ with Growable[(K, V)]
+ with Shrinkable[K]
with Cloneable[This]
- with Parallelizable[(A, B), ParMap[A, B]]
+ with Parallelizable[(K, V), ParMap[K, V]]
{ self =>
/** A common implementation of `newBuilder` for all mutable maps
@@ -58,17 +58,17 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
*
* Overrides `MapLike` implementation for better efficiency.
*/
- override protected[this] def newBuilder: Builder[(A, B), This] = empty
+ override protected[this] def newBuilder: Builder[(K, V), This] = empty
- protected[this] override def parCombiner = ParMap.newCombiner[A, B]
+ protected[this] override def parCombiner = ParMap.newCombiner[K, V]
/** Converts this $coll to a sequence.
*
* ```Note```: assumes a fast `size` method. Subclasses should override if this is not true.
*/
- override def toSeq: collection.Seq[(A, B)] = {
+ override def toSeq: collection.Seq[(K, V)] = {
// ArrayBuffer for efficiency, preallocated to the right size.
- val result = new ArrayBuffer[(A, B)](size)
+ val result = new ArrayBuffer[(K, V)](size)
foreach(result += _)
result
}
@@ -84,7 +84,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* before the `put` operation was executed, or `None` if `key`
* was not defined in the map before.
*/
- def put(key: A, value: B): Option[B] = {
+ def put(key: K, value: V): Option[V] = {
val r = get(key)
update(key, value)
r
@@ -97,7 +97,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @param key The key to update
* @param value The new value
*/
- def update(key: A, value: B) { this += ((key, value)) }
+ def update(key: K, value: V) { this += ((key, value)) }
/** Adds a new key/value pair to this map.
* If the map already contains a
@@ -105,7 +105,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @param kv the key/value pair.
* @return the map itself
*/
- def += (kv: (A, B)): this.type
+ def += (kv: (K, V)): this.type
/** Creates a new map consisting of all key/value pairs of the current map
* plus a new pair of a given key and value.
@@ -115,7 +115,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return A fresh immutable map with the binding from `key` to
* `value` added to this map.
*/
- override def updated[B1 >: B](key: A, value: B1): Map[A, B1] = this + ((key, value))
+ override def updated[V1 >: V](key: K, value: V1): Map[K, V1] = this + ((key, value))
/** Creates a new map containing a new key/value mapping and all the key/value mappings
* of this map.
@@ -126,7 +126,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return a new map containing mappings of this map and the mapping `kv`.
*/
@migration("`+` creates a new map. Use `+=` to add an element to this map and return that map itself.", "2.8.0")
- def + [B1 >: B] (kv: (A, B1)): Map[A, B1] = clone().asInstanceOf[Map[A, B1]] += kv
+ def + [V1 >: V] (kv: (K, V1)): Map[K, V1] = clone().asInstanceOf[Map[K, V1]] += kv
/** Creates a new map containing two or more key/value mappings and all the key/value
* mappings of this map.
@@ -139,8 +139,8 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return a new map containing mappings of this map and two or more specified mappings.
*/
@migration("`+` creates a new map. Use `+=` to add an element to this map and return that map itself.", "2.8.0")
- override def + [B1 >: B] (elem1: (A, B1), elem2: (A, B1), elems: (A, B1) *): Map[A, B1] =
- clone().asInstanceOf[Map[A, B1]] += elem1 += elem2 ++= elems
+ override def + [V1 >: V] (elem1: (K, V1), elem2: (K, V1), elems: (K, V1) *): Map[K, V1] =
+ clone().asInstanceOf[Map[K, V1]] += elem1 += elem2 ++= elems
/** Creates a new map containing the key/value mappings provided by the specified traversable object
* and all the key/value mappings of this map.
@@ -151,8 +151,8 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return a new map containing mappings of this map and those provided by `xs`.
*/
@migration("`++` creates a new map. Use `++=` to add an element to this map and return that map itself.", "2.8.0")
- override def ++[B1 >: B](xs: GenTraversableOnce[(A, B1)]): Map[A, B1] =
- clone().asInstanceOf[Map[A, B1]] ++= xs.seq
+ override def ++[V1 >: V](xs: GenTraversableOnce[(K, V1)]): Map[K, V1] =
+ clone().asInstanceOf[Map[K, V1]] ++= xs.seq
/** Removes a key from this map, returning the value associated previously
* with that key as an option.
@@ -160,7 +160,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return an option value containing the value associated previously with `key`,
* or `None` if `key` was not defined in the map before.
*/
- def remove(key: A): Option[B] = {
+ def remove(key: K): Option[V] = {
val r = get(key)
this -= key
r
@@ -170,7 +170,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @param key the key to be removed
* @return the map itself.
*/
- def -= (key: A): this.type
+ def -= (key: K): this.type
/** Creates a new map with all the key/value mappings of this map except the key/value mapping
* with the specified key.
@@ -179,7 +179,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return a new map with all the mappings of this map except that with a key `key`.
*/
@migration("`-` creates a new map. Use `-=` to remove an element from this map and return that map itself.", "2.8.0")
- override def -(key: A): This = clone() -= key
+ override def -(key: K): This = clone() -= key
/** Removes all bindings from the map. After this operation has completed,
* the map will be empty.
@@ -200,7 +200,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @return the value associated with key (either previously or as a result
* of executing the method).
*/
- def getOrElseUpdate(key: A, op: => B): B =
+ def getOrElseUpdate(key: K, op: => V): V =
get(key) match {
case Some(v) => v
case None => val d = op; this(key) = d; d
@@ -213,7 +213,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* @param f the transformation to apply
* @return the map itself.
*/
- def transform(f: (A, B) => B): this.type = {
+ def transform(f: (K, V) => V): this.type = {
this.iterator foreach {
case (key, value) => update(key, f(key, value))
}
@@ -225,7 +225,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
*
* @param p The test predicate
*/
- def retain(p: (A, B) => Boolean): this.type = {
+ def retain(p: (K, V) => Boolean): this.type = {
for ((k, v) <- this.toList) // SI-7269 toList avoids ConcurrentModificationException
if (!p(k, v)) this -= k
@@ -249,7 +249,7 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* with a key equal to `elem1`, `elem2` or any of `elems`.
*/
@migration("`-` creates a new map. Use `-=` to remove an element from this map and return that map itself.", "2.8.0")
- override def -(elem1: A, elem2: A, elems: A*): This =
+ override def -(elem1: K, elem2: K, elems: K*): This =
clone() -= elem1 -= elem2 --= elems
/** Creates a new map with all the key/value mappings of this map except mappings with keys
@@ -260,5 +260,5 @@ trait MapLike[A, B, +This <: MapLike[A, B, This] with Map[A, B]]
* with a key equal to a key from `xs`.
*/
@migration("`--` creates a new map. Use `--=` to remove an element from this map and return that map itself.", "2.8.0")
- override def --(xs: GenTraversableOnce[A]): This = clone() --= xs.seq
+ override def --(xs: GenTraversableOnce[K]): This = clone() --= xs.seq
}
diff --git a/src/library/scala/collection/parallel/immutable/package.scala b/src/library/scala/collection/parallel/immutable/package.scala
index 8fd84eaf4d..3cafdba5f7 100644
--- a/src/library/scala/collection/parallel/immutable/package.scala
+++ b/src/library/scala/collection/parallel/immutable/package.scala
@@ -20,7 +20,12 @@ package immutable {
self =>
def apply(idx: Int) = if (0 <= idx && idx < length) elem else throw new IndexOutOfBoundsException("" + idx)
- override def seq = throw new UnsupportedOperationException
+ override def seq: collection.immutable.Seq[T] = new collection.AbstractSeq[T] with collection.immutable.Seq[T] {
+ override def length: Int = self.length
+ override def apply(idx: Int): T = self.apply(idx)
+ override def iterator: Iterator[T] = Iterator.continually(elem).take(length)
+ override def par: ParSeq[T] = self
+ }
def update(idx: Int, elem: T) = throw new UnsupportedOperationException
class ParIterator(var i: Int = 0, val until: Int = length, elem: T = self.elem) extends SeqSplitter[T] {
diff --git a/src/library/scala/math/package.scala b/src/library/scala/math/package.scala
index 0e39af2feb..546efef114 100644
--- a/src/library/scala/math/package.scala
+++ b/src/library/scala/math/package.scala
@@ -11,28 +11,90 @@ package scala
/** The package object `scala.math` contains methods for performing basic
* numeric operations such as elementary exponential, logarithmic, root and
* trigonometric functions.
+ *
+ * All methods forward to [[java.lang.Math]] unless otherwise noted.
+ *
+ * @see [[java.lang.Math]]
+ *
+ * @groupname math-const Mathematical Constants
+ * @groupprio math-const 10
+ *
+ * @groupname minmax Minimum and Maximum
+ * @groupdesc minmax Find the min or max of two numbers. Note: [[scala.collection.TraversableOnce]] has
+ * min and max methods which determine the min or max of a collection.
+ * @groupprio minmax 20
+ *
+ * @groupname rounding Rounding
+ * @groupprio rounding 30
+ *
+ * @groupname explog Exponential and Logarithmic
+ * @groupprio explog 40
+ *
+ * @groupname trig Trigonometric
+ * @groupdesc trig Arguments in radians
+ * @groupprio trig 50
+ *
+ * @groupname angle-conversion Angular Measurement Conversion
+ * @groupprio angle-conversion 60
+ *
+ * @groupname hyperbolic Hyperbolic
+ * @groupprio hyperbolic 70
+ *
+ * @groupname abs Absolute Values
+ * @groupdesc abs Determine the magnitude of a value by discarding the sign. Results are >= 0.
+ * @groupprio abs 80
+ *
+ * @groupname signum Signs
+ * @groupdesc signum Extract the sign of a value. Results are -1, 0 or 1.
+ * Note that these are not pure forwarders to the java versions.
+ * In particular, the return type of java.lang.Long.signum is Int,
+ * but here it is widened to Long so that each overloaded variant
+ * will return the same numeric type it is passed.
+ * @groupprio signum 90
+ *
+ * @groupname root-extraction Root Extraction
+ * @groupprio root-extraction 100
+ *
+ * @groupname polar-coords Polar Coordinates
+ * @groupprio polar-coords 110
+ *
+ * @groupname ulp Unit of Least Precision
+ * @groupprio ulp 120
+ *
+ * @groupname randomisation Pseudo Random Number Generation
+ * @groupprio randomisation 130
*/
package object math {
- /** The `double` value that is closer than any other to `e`, the base of
+ /** The `Double` value that is closer than any other to `e`, the base of
* the natural logarithms.
+ * @group math-const
*/
@inline final val E = java.lang.Math.E
- /** The `double` value that is closer than any other to `pi`, the ratio of
+ /** The `Double` value that is closer than any other to `pi`, the ratio of
* the circumference of a circle to its diameter.
+ * @group math-const
*/
@inline final val Pi = java.lang.Math.PI
- /** Returns a `double` value with a positive sign, greater than or equal
+ /** Returns a `Double` value with a positive sign, greater than or equal
* to `0.0` and less than `1.0`.
+ *
+ * @group randomisation
*/
def random(): Double = java.lang.Math.random()
+ /** @group trig */
def sin(x: Double): Double = java.lang.Math.sin(x)
+ /** @group trig */
def cos(x: Double): Double = java.lang.Math.cos(x)
+ /** @group trig */
def tan(x: Double): Double = java.lang.Math.tan(x)
+ /** @group trig */
def asin(x: Double): Double = java.lang.Math.asin(x)
+ /** @group trig */
def acos(x: Double): Double = java.lang.Math.acos(x)
+ /** @group trig */
def atan(x: Double): Double = java.lang.Math.atan(x)
/** Converts an angle measured in degrees to an approximately equivalent
@@ -40,6 +102,7 @@ package object math {
*
* @param x an angle, in degrees
* @return the measurement of the angle `x` in radians.
+ * @group angle-conversion
*/
def toRadians(x: Double): Double = java.lang.Math.toRadians(x)
@@ -48,44 +111,10 @@ package object math {
*
* @param x angle, in radians
* @return the measurement of the angle `x` in degrees.
+ * @group angle-conversion
*/
def toDegrees(x: Double): Double = java.lang.Math.toDegrees(x)
- /** Returns Euler's number `e` raised to the power of a `double` value.
- *
- * @param x the exponent to raise `e` to.
- * @return the value `e^a^`, where `e` is the base of the natural
- * logarithms.
- */
- def exp(x: Double): Double = java.lang.Math.exp(x)
-
- /** Returns the natural logarithm of a `double` value.
- *
- * @param x the number to take the natural logarithm of
- * @return the value `logâ‚‘(x)` where `e` is Eulers number
- */
- def log(x: Double): Double = java.lang.Math.log(x)
-
- /** Returns the square root of a `double` value.
- *
- * @param x the number to take the square root of
- * @return the value √x
- */
- def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
- def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
-
- def ceil(x: Double): Double = java.lang.Math.ceil(x)
- def floor(x: Double): Double = java.lang.Math.floor(x)
-
- /** Returns the `double` value that is closest in value to the
- * argument and is equal to a mathematical integer.
- *
- * @param x a `double` value
- * @return the closest floating-point value to a that is equal to a
- * mathematical integer.
- */
- def rint(x: Double): Double = java.lang.Math.rint(x)
-
/** Converts rectangular coordinates `(x, y)` to polar `(r, theta)`.
*
* @param x the ordinate coordinate
@@ -93,19 +122,44 @@ package object math {
* @return the ''theta'' component of the point `(r, theta)` in polar
* coordinates that corresponds to the point `(x, y)` in
* Cartesian coordinates.
+ * @group polar-coords
*/
def atan2(y: Double, x: Double): Double = java.lang.Math.atan2(y, x)
- /** Returns the value of the first argument raised to the power of the
- * second argument.
+ /** Returns the square root of the sum of the squares of both given `Double`
+ * values without intermediate underflow or overflow.
+ *
+ * The ''r'' component of the point `(r, theta)` in polar
+ * coordinates that corresponds to the point `(x, y)` in
+ * Cartesian coordinates.
+ * @group polar-coords
+ */
+ def hypot(x: Double, y: Double): Double = java.lang.Math.hypot(x, y)
+
+ // -----------------------------------------------------------------------
+ // rounding functions
+ // -----------------------------------------------------------------------
+
+ /** @group rounding */
+ def ceil(x: Double): Double = java.lang.Math.ceil(x)
+ /** @group rounding */
+ def floor(x: Double): Double = java.lang.Math.floor(x)
+
+ /** Returns the `Double` value that is closest in value to the
+ * argument and is equal to a mathematical integer.
+ *
+ * @param x a `Double` value
+ * @return the closest floating-point value to a that is equal to a
+ * mathematical integer.
+ * @group rounding
+ */
+ def rint(x: Double): Double = java.lang.Math.rint(x)
+
+ /** There is no reason to round a `Long`, but this method prevents unintended conversion to `Float` followed by rounding to `Int`.
*
- * @param x the base.
- * @param y the exponent.
- * @return the value `x^y^`.
+ * @note Does not forward to [[java.lang.Math]]
+ * @group rounding
*/
- def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
-
- /** There is no reason to round a `Long`, but this method prevents unintended conversion to `Float` followed by rounding to `Int`. */
@deprecated("This is an integer type; there is no reason to round it. Perhaps you meant to call this with a floating-point value?", "2.11.0")
def round(x: Long): Long = x
@@ -113,6 +167,7 @@ package object math {
*
* @param x a floating-point value to be rounded to a `Int`.
* @return the value of the argument rounded to the nearest `Int` value.
+ * @group rounding
*/
def round(x: Float): Int = java.lang.Math.round(x)
@@ -120,83 +175,153 @@ package object math {
*
* @param x a floating-point value to be rounded to a `Long`.
* @return the value of the argument rounded to the nearest`long` value.
+ * @group rounding
*/
def round(x: Double): Long = java.lang.Math.round(x)
+ /** @group abs */
def abs(x: Int): Int = java.lang.Math.abs(x)
+ /** @group abs */
def abs(x: Long): Long = java.lang.Math.abs(x)
+ /** @group abs */
def abs(x: Float): Float = java.lang.Math.abs(x)
+ /** @group abs */
def abs(x: Double): Double = java.lang.Math.abs(x)
+ /** @group minmax */
def max(x: Int, y: Int): Int = java.lang.Math.max(x, y)
+ /** @group minmax */
def max(x: Long, y: Long): Long = java.lang.Math.max(x, y)
+ /** @group minmax */
def max(x: Float, y: Float): Float = java.lang.Math.max(x, y)
+ /** @group minmax */
def max(x: Double, y: Double): Double = java.lang.Math.max(x, y)
+ /** @group minmax */
def min(x: Int, y: Int): Int = java.lang.Math.min(x, y)
+ /** @group minmax */
def min(x: Long, y: Long): Long = java.lang.Math.min(x, y)
+ /** @group minmax */
def min(x: Float, y: Float): Float = java.lang.Math.min(x, y)
+ /** @group minmax */
def min(x: Double, y: Double): Double = java.lang.Math.min(x, y)
- /** Note that these are not pure forwarders to the java versions.
- * In particular, the return type of java.lang.Long.signum is Int,
- * but here it is widened to Long so that each overloaded variant
- * will return the same numeric type it is passed.
- */
+ /** @group signum
+ * @note Forwards to [[java.lang.Integer]]
+ */
def signum(x: Int): Int = java.lang.Integer.signum(x)
+ /** @group signum
+ * @note Forwards to [[java.lang.Long]]
+ */
def signum(x: Long): Long = java.lang.Long.signum(x)
+ /** @group signum */
def signum(x: Float): Float = java.lang.Math.signum(x)
+ /** @group signum */
def signum(x: Double): Double = java.lang.Math.signum(x)
// -----------------------------------------------------------------------
// root functions
// -----------------------------------------------------------------------
- /** Returns the cube root of the given `Double` value. */
+ /** Returns the square root of a `Double` value.
+ *
+ * @param x the number to take the square root of
+ * @return the value √x
+ * @group root-extraction
+ */
+ def sqrt(x: Double): Double = java.lang.Math.sqrt(x)
+
+ /** Returns the cube root of the given `Double` value.
+ *
+ * @param x the number to take the cube root of
+ * @return the value ∛x
+ * @group root-extraction
+ */
def cbrt(x: Double): Double = java.lang.Math.cbrt(x)
// -----------------------------------------------------------------------
// exponential functions
// -----------------------------------------------------------------------
- /** Returns `exp(x) - 1`. */
+ /** Returns the value of the first argument raised to the power of the
+ * second argument.
+ *
+ * @param x the base.
+ * @param y the exponent.
+ * @return the value `x^y^`.
+ * @group explog
+ */
+ def pow(x: Double, y: Double): Double = java.lang.Math.pow(x, y)
+
+ /** Returns Euler's number `e` raised to the power of a `Double` value.
+ *
+ * @param x the exponent to raise `e` to.
+ * @return the value `e^a^`, where `e` is the base of the natural
+ * logarithms.
+ * @group explog
+ */
+ def exp(x: Double): Double = java.lang.Math.exp(x)
+
+ /** Returns `exp(x) - 1`.
+ * @group explog
+ */
def expm1(x: Double): Double = java.lang.Math.expm1(x)
// -----------------------------------------------------------------------
// logarithmic functions
// -----------------------------------------------------------------------
- /** Returns the natural logarithm of the sum of the given `Double` value and 1. */
+ /** Returns the natural logarithm of a `Double` value.
+ *
+ * @param x the number to take the natural logarithm of
+ * @return the value `logâ‚‘(x)` where `e` is Eulers number
+ * @group explog
+ */
+ def log(x: Double): Double = java.lang.Math.log(x)
+
+ /** Returns the natural logarithm of the sum of the given `Double` value and 1.
+ * @group explog
+ */
def log1p(x: Double): Double = java.lang.Math.log1p(x)
- /** Returns the base 10 logarithm of the given `Double` value. */
+ /** Returns the base 10 logarithm of the given `Double` value.
+ * @group explog
+ */
def log10(x: Double): Double = java.lang.Math.log10(x)
// -----------------------------------------------------------------------
// trigonometric functions
// -----------------------------------------------------------------------
- /** Returns the hyperbolic sine of the given `Double` value. */
+ /** Returns the hyperbolic sine of the given `Double` value.
+ * @group hyperbolic
+ */
def sinh(x: Double): Double = java.lang.Math.sinh(x)
- /** Returns the hyperbolic cosine of the given `Double` value. */
+ /** Returns the hyperbolic cosine of the given `Double` value.
+ * @group hyperbolic
+ */
def cosh(x: Double): Double = java.lang.Math.cosh(x)
- /** Returns the hyperbolic tangent of the given `Double` value. */
+ /** Returns the hyperbolic tangent of the given `Double` value.
+ * @group hyperbolic
+ */
def tanh(x: Double):Double = java.lang.Math.tanh(x)
// -----------------------------------------------------------------------
// miscellaneous functions
// -----------------------------------------------------------------------
- /** Returns the square root of the sum of the squares of both given `Double`
- * values without intermediate underflow or overflow.
+ /** Returns the size of an ulp of the given `Double` value.
+ * @group ulp
*/
- def hypot(x: Double, y: Double): Double = java.lang.Math.hypot(x, y)
-
- /** Returns the size of an ulp of the given `Double` value. */
def ulp(x: Double): Double = java.lang.Math.ulp(x)
- /** Returns the size of an ulp of the given `Float` value. */
+ /** Returns the size of an ulp of the given `Float` value.
+ * @group ulp
+ */
def ulp(x: Float): Float = java.lang.Math.ulp(x)
+
+ /** @group rounding */
+ def IEEEremainder(x: Double, y: Double): Double = java.lang.Math.IEEEremainder(x, y)
}
diff --git a/src/library/scala/reflect/ClassTag.scala b/src/library/scala/reflect/ClassTag.scala
index 1811d3a00f..3a300e0593 100644
--- a/src/library/scala/reflect/ClassTag.scala
+++ b/src/library/scala/reflect/ClassTag.scala
@@ -134,6 +134,8 @@ object ClassTag {
val Nothing : ClassTag[scala.Nothing] = Manifest.Nothing
val Null : ClassTag[scala.Null] = Manifest.Null
+ private class GenericClassTag[T](val runtimeClass: jClass[_]) extends ClassTag[T]
+
def apply[T](runtimeClass1: jClass[_]): ClassTag[T] =
runtimeClass1 match {
case java.lang.Byte.TYPE => ClassTag.Byte.asInstanceOf[ClassTag[T]]
@@ -148,7 +150,7 @@ object ClassTag {
case ObjectTYPE => ClassTag.Object.asInstanceOf[ClassTag[T]]
case NothingTYPE => ClassTag.Nothing.asInstanceOf[ClassTag[T]]
case NullTYPE => ClassTag.Null.asInstanceOf[ClassTag[T]]
- case _ => new ClassTag[T]{ def runtimeClass = runtimeClass1 }
+ case _ => new GenericClassTag[T](runtimeClass1)
}
def unapply[T](ctag: ClassTag[T]): Option[Class[_]] = Some(ctag.runtimeClass)
diff --git a/src/library/scala/reflect/Manifest.scala b/src/library/scala/reflect/Manifest.scala
index 369676c273..9c38864194 100644
--- a/src/library/scala/reflect/Manifest.scala
+++ b/src/library/scala/reflect/Manifest.scala
@@ -9,7 +9,7 @@
package scala
package reflect
-import scala.collection.mutable.{ ArrayBuilder, WrappedArray }
+import scala.collection.mutable.{ArrayBuilder, WrappedArray}
/** A `Manifest[T]` is an opaque descriptor for type T. Its supported use
* is to give access to the erasure of the type as a `Class` instance, as
@@ -21,23 +21,22 @@ import scala.collection.mutable.{ ArrayBuilder, WrappedArray }
* which are not yet adequately represented in manifests.
*
* Example usages:
-{{{
- def arr[T] = new Array[T](0) // does not compile
- def arr[T](implicit m: Manifest[T]) = new Array[T](0) // compiles
- def arr[T: Manifest] = new Array[T](0) // shorthand for the preceding
-
- // Methods manifest, classManifest, and optManifest are in [[scala.Predef]].
- def isApproxSubType[T: Manifest, U: Manifest] = manifest[T] <:< manifest[U]
- isApproxSubType[List[String], List[AnyRef]] // true
- isApproxSubType[List[String], List[Int]] // false
-
- def methods[T: ClassManifest] = classManifest[T].erasure.getMethods
- def retType[T: ClassManifest](name: String) =
- methods[T] find (_.getName == name) map (_.getGenericReturnType)
-
- retType[Map[_, _]]("values") // Some(scala.collection.Iterable<B>)
-}}}
+ * {{{
+ * def arr[T] = new Array[T](0) // does not compile
+ * def arr[T](implicit m: Manifest[T]) = new Array[T](0) // compiles
+ * def arr[T: Manifest] = new Array[T](0) // shorthand for the preceding
*
+ * // Methods manifest, classManifest, and optManifest are in [[scala.Predef]].
+ * def isApproxSubType[T: Manifest, U: Manifest] = manifest[T] <:< manifest[U]
+ * isApproxSubType[List[String], List[AnyRef]] // true
+ * isApproxSubType[List[String], List[Int]] // false
+ *
+ * def methods[T: ClassManifest] = classManifest[T].erasure.getMethods
+ * def retType[T: ClassManifest](name: String) =
+ * methods[T] find (_.getName == name) map (_.getGenericReturnType)
+ *
+ * retType[Map[_, _]]("values") // Some(scala.collection.Iterable<B>)
+ * }}}
*/
@scala.annotation.implicitNotFound(msg = "No Manifest available for ${T}.")
// TODO undeprecated until Scala reflection becomes non-experimental
@@ -88,71 +87,79 @@ object ManifestFactory {
def valueManifests: List[AnyValManifest[_]] =
List(Byte, Short, Char, Int, Long, Float, Double, Boolean, Unit)
- val Byte: AnyValManifest[Byte] = new AnyValManifest[scala.Byte]("Byte") {
+ private class ByteManifest extends AnyValManifest[scala.Byte]("Byte") {
def runtimeClass = java.lang.Byte.TYPE
override def newArray(len: Int): Array[Byte] = new Array[Byte](len)
override def newWrappedArray(len: Int): WrappedArray[Byte] = new WrappedArray.ofByte(new Array[Byte](len))
override def newArrayBuilder(): ArrayBuilder[Byte] = new ArrayBuilder.ofByte()
private def readResolve(): Any = Manifest.Byte
}
+ val Byte: AnyValManifest[Byte] = new ByteManifest
- val Short: AnyValManifest[Short] = new AnyValManifest[scala.Short]("Short") {
+ private class ShortManifest extends AnyValManifest[scala.Short]("Short") {
def runtimeClass = java.lang.Short.TYPE
override def newArray(len: Int): Array[Short] = new Array[Short](len)
override def newWrappedArray(len: Int): WrappedArray[Short] = new WrappedArray.ofShort(new Array[Short](len))
override def newArrayBuilder(): ArrayBuilder[Short] = new ArrayBuilder.ofShort()
private def readResolve(): Any = Manifest.Short
}
+ val Short: AnyValManifest[Short] = new ShortManifest
- val Char: AnyValManifest[Char] = new AnyValManifest[scala.Char]("Char") {
+ private class CharManifest extends AnyValManifest[scala.Char]("Char") {
def runtimeClass = java.lang.Character.TYPE
override def newArray(len: Int): Array[Char] = new Array[Char](len)
override def newWrappedArray(len: Int): WrappedArray[Char] = new WrappedArray.ofChar(new Array[Char](len))
override def newArrayBuilder(): ArrayBuilder[Char] = new ArrayBuilder.ofChar()
private def readResolve(): Any = Manifest.Char
}
+ val Char: AnyValManifest[Char] = new CharManifest
- val Int: AnyValManifest[Int] = new AnyValManifest[scala.Int]("Int") {
+ private class IntManifest extends AnyValManifest[scala.Int]("Int") {
def runtimeClass = java.lang.Integer.TYPE
override def newArray(len: Int): Array[Int] = new Array[Int](len)
override def newWrappedArray(len: Int): WrappedArray[Int] = new WrappedArray.ofInt(new Array[Int](len))
override def newArrayBuilder(): ArrayBuilder[Int] = new ArrayBuilder.ofInt()
private def readResolve(): Any = Manifest.Int
}
+ val Int: AnyValManifest[Int] = new IntManifest
- val Long: AnyValManifest[Long] = new AnyValManifest[scala.Long]("Long") {
+ private class LongManifest extends AnyValManifest[scala.Long]("Long") {
def runtimeClass = java.lang.Long.TYPE
override def newArray(len: Int): Array[Long] = new Array[Long](len)
override def newWrappedArray(len: Int): WrappedArray[Long] = new WrappedArray.ofLong(new Array[Long](len))
override def newArrayBuilder(): ArrayBuilder[Long] = new ArrayBuilder.ofLong()
private def readResolve(): Any = Manifest.Long
}
+ val Long: AnyValManifest[Long] = new LongManifest
- val Float: AnyValManifest[Float] = new AnyValManifest[scala.Float]("Float") {
+ private class FloatManifest extends AnyValManifest[scala.Float]("Float") {
def runtimeClass = java.lang.Float.TYPE
override def newArray(len: Int): Array[Float] = new Array[Float](len)
override def newWrappedArray(len: Int): WrappedArray[Float] = new WrappedArray.ofFloat(new Array[Float](len))
override def newArrayBuilder(): ArrayBuilder[Float] = new ArrayBuilder.ofFloat()
private def readResolve(): Any = Manifest.Float
}
+ val Float: AnyValManifest[Float] = new FloatManifest
- val Double: AnyValManifest[Double] = new AnyValManifest[scala.Double]("Double") {
+ private class DoubleManifest extends AnyValManifest[scala.Double]("Double") {
def runtimeClass = java.lang.Double.TYPE
override def newArray(len: Int): Array[Double] = new Array[Double](len)
override def newWrappedArray(len: Int): WrappedArray[Double] = new WrappedArray.ofDouble(new Array[Double](len))
override def newArrayBuilder(): ArrayBuilder[Double] = new ArrayBuilder.ofDouble()
private def readResolve(): Any = Manifest.Double
}
+ val Double: AnyValManifest[Double] = new DoubleManifest
- val Boolean: AnyValManifest[Boolean] = new AnyValManifest[scala.Boolean]("Boolean") {
+ private class BooleanManifest extends AnyValManifest[scala.Boolean]("Boolean") {
def runtimeClass = java.lang.Boolean.TYPE
override def newArray(len: Int): Array[Boolean] = new Array[Boolean](len)
override def newWrappedArray(len: Int): WrappedArray[Boolean] = new WrappedArray.ofBoolean(new Array[Boolean](len))
override def newArrayBuilder(): ArrayBuilder[Boolean] = new ArrayBuilder.ofBoolean()
private def readResolve(): Any = Manifest.Boolean
}
+ val Boolean: AnyValManifest[Boolean] = new BooleanManifest
- val Unit: AnyValManifest[Unit] = new AnyValManifest[scala.Unit]("Unit") {
+ private class UnitManifest extends AnyValManifest[scala.Unit]("Unit") {
def runtimeClass = java.lang.Void.TYPE
override def newArray(len: Int): Array[Unit] = new Array[Unit](len)
override def newWrappedArray(len: Int): WrappedArray[Unit] = new WrappedArray.ofUnit(new Array[Unit](len))
@@ -162,43 +169,49 @@ object ManifestFactory {
else super.arrayClass(tp)
private def readResolve(): Any = Manifest.Unit
}
+ val Unit: AnyValManifest[Unit] = new UnitManifest
private val ObjectTYPE = classOf[java.lang.Object]
private val NothingTYPE = classOf[scala.runtime.Nothing$]
private val NullTYPE = classOf[scala.runtime.Null$]
- val Any: Manifest[scala.Any] = new PhantomManifest[scala.Any](ObjectTYPE, "Any") {
+ private class AnyManifest extends PhantomManifest[scala.Any](ObjectTYPE, "Any") {
override def newArray(len: Int) = new Array[scala.Any](len)
override def <:<(that: ClassManifest[_]): Boolean = (that eq this)
private def readResolve(): Any = Manifest.Any
}
+ val Any: Manifest[scala.Any] = new AnyManifest
- val Object: Manifest[java.lang.Object] = new PhantomManifest[java.lang.Object](ObjectTYPE, "Object") {
+ private class ObjectManifest extends PhantomManifest[java.lang.Object](ObjectTYPE, "Object") {
override def newArray(len: Int) = new Array[java.lang.Object](len)
override def <:<(that: ClassManifest[_]): Boolean = (that eq this) || (that eq Any)
private def readResolve(): Any = Manifest.Object
}
+ val Object: Manifest[java.lang.Object] = new ObjectManifest
val AnyRef: Manifest[scala.AnyRef] = Object.asInstanceOf[Manifest[scala.AnyRef]]
- val AnyVal: Manifest[scala.AnyVal] = new PhantomManifest[scala.AnyVal](ObjectTYPE, "AnyVal") {
+ private class AnyValPhantomManifest extends PhantomManifest[scala.AnyVal](ObjectTYPE, "AnyVal") {
override def newArray(len: Int) = new Array[scala.AnyVal](len)
override def <:<(that: ClassManifest[_]): Boolean = (that eq this) || (that eq Any)
private def readResolve(): Any = Manifest.AnyVal
}
+ val AnyVal: Manifest[scala.AnyVal] = new AnyValPhantomManifest
- val Null: Manifest[scala.Null] = new PhantomManifest[scala.Null](NullTYPE, "Null") {
+ private class NullManifest extends PhantomManifest[scala.Null](NullTYPE, "Null") {
override def newArray(len: Int) = new Array[scala.Null](len)
override def <:<(that: ClassManifest[_]): Boolean =
(that ne null) && (that ne Nothing) && !(that <:< AnyVal)
private def readResolve(): Any = Manifest.Null
}
+ val Null: Manifest[scala.Null] = new NullManifest
- val Nothing: Manifest[scala.Nothing] = new PhantomManifest[scala.Nothing](NothingTYPE, "Nothing") {
+ private class NothingManifest extends PhantomManifest[scala.Nothing](NothingTYPE, "Nothing") {
override def newArray(len: Int) = new Array[scala.Nothing](len)
override def <:<(that: ClassManifest[_]): Boolean = (that ne null)
private def readResolve(): Any = Manifest.Nothing
}
+ val Nothing: Manifest[scala.Nothing] = new NothingManifest
private class SingletonTypeManifest[T <: AnyRef](value: AnyRef) extends Manifest[T] {
lazy val runtimeClass = value.getClass
@@ -251,31 +264,37 @@ object ManifestFactory {
def arrayType[T](arg: Manifest[_]): Manifest[Array[T]] =
arg.asInstanceOf[Manifest[T]].arrayManifest
+ private class AbstractTypeManifest[T](prefix: Manifest[_], name: String, upperBound: Predef.Class[_], args: Seq[Manifest[_]]) extends Manifest[T] {
+ def runtimeClass = upperBound
+ override val typeArguments = args.toList
+ override def toString = prefix.toString+"#"+name+argString
+ }
+
/** Manifest for the abstract type `prefix # name`. `upperBound` is not
* strictly necessary as it could be obtained by reflection. It was
* added so that erasure can be calculated without reflection. */
def abstractType[T](prefix: Manifest[_], name: String, upperBound: Predef.Class[_], args: Manifest[_]*): Manifest[T] =
- new Manifest[T] {
- def runtimeClass = upperBound
- override val typeArguments = args.toList
- override def toString = prefix.toString+"#"+name+argString
- }
+ new AbstractTypeManifest[T](prefix, name, upperBound, args)
+
+ private class WildcardManifest[T](lowerBound: Manifest[_], upperBound: Manifest[_]) extends Manifest[T] {
+ def runtimeClass = upperBound.runtimeClass
+ override def toString =
+ "_" +
+ (if (lowerBound eq Nothing) "" else " >: "+lowerBound) +
+ (if (upperBound eq Nothing) "" else " <: "+upperBound)
+ }
/** Manifest for the unknown type `_ >: L <: U` in an existential.
*/
def wildcardType[T](lowerBound: Manifest[_], upperBound: Manifest[_]): Manifest[T] =
- new Manifest[T] {
- def runtimeClass = upperBound.runtimeClass
- override def toString =
- "_" +
- (if (lowerBound eq Nothing) "" else " >: "+lowerBound) +
- (if (upperBound eq Nothing) "" else " <: "+upperBound)
- }
+ new WildcardManifest[T](lowerBound, upperBound)
+
+ private class IntersectionTypeManifest[T](parents: Seq[Manifest[_]]) extends Manifest[T] {
+ def runtimeClass = parents.head.runtimeClass
+ override def toString = parents.mkString(" with ")
+ }
/** Manifest for the intersection type `parents_0 with ... with parents_n`. */
def intersectionType[T](parents: Manifest[_]*): Manifest[T] =
- new Manifest[T] {
- def runtimeClass = parents.head.runtimeClass
- override def toString = parents.mkString(" with ")
- }
+ new IntersectionTypeManifest[T](parents)
}
diff --git a/src/library/scala/remote.scala b/src/library/scala/remote.scala
index 4b16651af9..7265a15194 100644
--- a/src/library/scala/remote.scala
+++ b/src/library/scala/remote.scala
@@ -24,4 +24,5 @@ package scala
* }
* }}}
*/
+@deprecated("extend java.rmi.Remote instead and add @throws[java.rmi.RemoteException] to public methods", "2.12.0")
class remote extends scala.annotation.StaticAnnotation {}
diff --git a/src/library/scala/runtime/java8/JFunction.java b/src/library/scala/runtime/java8/JFunction.java
deleted file mode 100644
index 326aad3fec..0000000000
--- a/src/library/scala/runtime/java8/JFunction.java
+++ /dev/null
@@ -1,146 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-public final class JFunction {
- private JFunction() {}
- public static <R> scala.Function0<R> func(JFunction0<R> f) { return f; }
- public static scala.Function0<BoxedUnit> proc(JProcedure0 p) { return p; }
- public static scala.Function0<BoxedUnit> procSpecialized(JFunction0$mcV$sp f) { return f; }
- public static scala.Function0<Byte> funcSpecialized(JFunction0$mcB$sp f) { return f; }
- public static scala.Function0<Short> funcSpecialized(JFunction0$mcS$sp f) { return f; }
- public static scala.Function0<Integer> funcSpecialized(JFunction0$mcI$sp f) { return f; }
- public static scala.Function0<Long> funcSpecialized(JFunction0$mcJ$sp f) { return f; }
- public static scala.Function0<Character> funcSpecialized(JFunction0$mcC$sp f) { return f; }
- public static scala.Function0<Float> funcSpecialized(JFunction0$mcF$sp f) { return f; }
- public static scala.Function0<Double> funcSpecialized(JFunction0$mcD$sp f) { return f; }
- public static scala.Function0<Boolean> funcSpecialized(JFunction0$mcZ$sp f) { return f; }
- public static <T1, R> scala.Function1<T1, R> func(JFunction1<T1, R> f) { return f; }
- public static <T1> scala.Function1<T1, BoxedUnit> proc(JProcedure1<T1> p) { return p; }
- public static scala.Function1<Integer, BoxedUnit> procSpecialized(JFunction1$mcVI$sp f) { return f; }
- public static scala.Function1<Integer, Boolean> funcSpecialized(JFunction1$mcZI$sp f) { return f; }
- public static scala.Function1<Integer, Integer> funcSpecialized(JFunction1$mcII$sp f) { return f; }
- public static scala.Function1<Integer, Float> funcSpecialized(JFunction1$mcFI$sp f) { return f; }
- public static scala.Function1<Integer, Long> funcSpecialized(JFunction1$mcJI$sp f) { return f; }
- public static scala.Function1<Integer, Double> funcSpecialized(JFunction1$mcDI$sp f) { return f; }
- public static scala.Function1<Long, BoxedUnit> procSpecialized(JFunction1$mcVJ$sp f) { return f; }
- public static scala.Function1<Long, Boolean> funcSpecialized(JFunction1$mcZJ$sp f) { return f; }
- public static scala.Function1<Long, Integer> funcSpecialized(JFunction1$mcIJ$sp f) { return f; }
- public static scala.Function1<Long, Float> funcSpecialized(JFunction1$mcFJ$sp f) { return f; }
- public static scala.Function1<Long, Long> funcSpecialized(JFunction1$mcJJ$sp f) { return f; }
- public static scala.Function1<Long, Double> funcSpecialized(JFunction1$mcDJ$sp f) { return f; }
- public static scala.Function1<Float, BoxedUnit> procSpecialized(JFunction1$mcVF$sp f) { return f; }
- public static scala.Function1<Float, Boolean> funcSpecialized(JFunction1$mcZF$sp f) { return f; }
- public static scala.Function1<Float, Integer> funcSpecialized(JFunction1$mcIF$sp f) { return f; }
- public static scala.Function1<Float, Float> funcSpecialized(JFunction1$mcFF$sp f) { return f; }
- public static scala.Function1<Float, Long> funcSpecialized(JFunction1$mcJF$sp f) { return f; }
- public static scala.Function1<Float, Double> funcSpecialized(JFunction1$mcDF$sp f) { return f; }
- public static scala.Function1<Double, BoxedUnit> procSpecialized(JFunction1$mcVD$sp f) { return f; }
- public static scala.Function1<Double, Boolean> funcSpecialized(JFunction1$mcZD$sp f) { return f; }
- public static scala.Function1<Double, Integer> funcSpecialized(JFunction1$mcID$sp f) { return f; }
- public static scala.Function1<Double, Float> funcSpecialized(JFunction1$mcFD$sp f) { return f; }
- public static scala.Function1<Double, Long> funcSpecialized(JFunction1$mcJD$sp f) { return f; }
- public static scala.Function1<Double, Double> funcSpecialized(JFunction1$mcDD$sp f) { return f; }
- public static <T1, T2, R> scala.Function2<T1, T2, R> func(JFunction2<T1, T2, R> f) { return f; }
- public static <T1, T2> scala.Function2<T1, T2, BoxedUnit> proc(JProcedure2<T1, T2> p) { return p; }
- public static scala.Function2<Integer, Integer, BoxedUnit> procSpecialized(JFunction2$mcVII$sp f) { return f; }
- public static scala.Function2<Integer, Integer, Boolean> funcSpecialized(JFunction2$mcZII$sp f) { return f; }
- public static scala.Function2<Integer, Integer, Integer> funcSpecialized(JFunction2$mcIII$sp f) { return f; }
- public static scala.Function2<Integer, Integer, Float> funcSpecialized(JFunction2$mcFII$sp f) { return f; }
- public static scala.Function2<Integer, Integer, Long> funcSpecialized(JFunction2$mcJII$sp f) { return f; }
- public static scala.Function2<Integer, Integer, Double> funcSpecialized(JFunction2$mcDII$sp f) { return f; }
- public static scala.Function2<Integer, Long, BoxedUnit> procSpecialized(JFunction2$mcVIJ$sp f) { return f; }
- public static scala.Function2<Integer, Long, Boolean> funcSpecialized(JFunction2$mcZIJ$sp f) { return f; }
- public static scala.Function2<Integer, Long, Integer> funcSpecialized(JFunction2$mcIIJ$sp f) { return f; }
- public static scala.Function2<Integer, Long, Float> funcSpecialized(JFunction2$mcFIJ$sp f) { return f; }
- public static scala.Function2<Integer, Long, Long> funcSpecialized(JFunction2$mcJIJ$sp f) { return f; }
- public static scala.Function2<Integer, Long, Double> funcSpecialized(JFunction2$mcDIJ$sp f) { return f; }
- public static scala.Function2<Integer, Double, BoxedUnit> procSpecialized(JFunction2$mcVID$sp f) { return f; }
- public static scala.Function2<Integer, Double, Boolean> funcSpecialized(JFunction2$mcZID$sp f) { return f; }
- public static scala.Function2<Integer, Double, Integer> funcSpecialized(JFunction2$mcIID$sp f) { return f; }
- public static scala.Function2<Integer, Double, Float> funcSpecialized(JFunction2$mcFID$sp f) { return f; }
- public static scala.Function2<Integer, Double, Long> funcSpecialized(JFunction2$mcJID$sp f) { return f; }
- public static scala.Function2<Integer, Double, Double> funcSpecialized(JFunction2$mcDID$sp f) { return f; }
- public static scala.Function2<Long, Integer, BoxedUnit> procSpecialized(JFunction2$mcVJI$sp f) { return f; }
- public static scala.Function2<Long, Integer, Boolean> funcSpecialized(JFunction2$mcZJI$sp f) { return f; }
- public static scala.Function2<Long, Integer, Integer> funcSpecialized(JFunction2$mcIJI$sp f) { return f; }
- public static scala.Function2<Long, Integer, Float> funcSpecialized(JFunction2$mcFJI$sp f) { return f; }
- public static scala.Function2<Long, Integer, Long> funcSpecialized(JFunction2$mcJJI$sp f) { return f; }
- public static scala.Function2<Long, Integer, Double> funcSpecialized(JFunction2$mcDJI$sp f) { return f; }
- public static scala.Function2<Long, Long, BoxedUnit> procSpecialized(JFunction2$mcVJJ$sp f) { return f; }
- public static scala.Function2<Long, Long, Boolean> funcSpecialized(JFunction2$mcZJJ$sp f) { return f; }
- public static scala.Function2<Long, Long, Integer> funcSpecialized(JFunction2$mcIJJ$sp f) { return f; }
- public static scala.Function2<Long, Long, Float> funcSpecialized(JFunction2$mcFJJ$sp f) { return f; }
- public static scala.Function2<Long, Long, Long> funcSpecialized(JFunction2$mcJJJ$sp f) { return f; }
- public static scala.Function2<Long, Long, Double> funcSpecialized(JFunction2$mcDJJ$sp f) { return f; }
- public static scala.Function2<Long, Double, BoxedUnit> procSpecialized(JFunction2$mcVJD$sp f) { return f; }
- public static scala.Function2<Long, Double, Boolean> funcSpecialized(JFunction2$mcZJD$sp f) { return f; }
- public static scala.Function2<Long, Double, Integer> funcSpecialized(JFunction2$mcIJD$sp f) { return f; }
- public static scala.Function2<Long, Double, Float> funcSpecialized(JFunction2$mcFJD$sp f) { return f; }
- public static scala.Function2<Long, Double, Long> funcSpecialized(JFunction2$mcJJD$sp f) { return f; }
- public static scala.Function2<Long, Double, Double> funcSpecialized(JFunction2$mcDJD$sp f) { return f; }
- public static scala.Function2<Double, Integer, BoxedUnit> procSpecialized(JFunction2$mcVDI$sp f) { return f; }
- public static scala.Function2<Double, Integer, Boolean> funcSpecialized(JFunction2$mcZDI$sp f) { return f; }
- public static scala.Function2<Double, Integer, Integer> funcSpecialized(JFunction2$mcIDI$sp f) { return f; }
- public static scala.Function2<Double, Integer, Float> funcSpecialized(JFunction2$mcFDI$sp f) { return f; }
- public static scala.Function2<Double, Integer, Long> funcSpecialized(JFunction2$mcJDI$sp f) { return f; }
- public static scala.Function2<Double, Integer, Double> funcSpecialized(JFunction2$mcDDI$sp f) { return f; }
- public static scala.Function2<Double, Long, BoxedUnit> procSpecialized(JFunction2$mcVDJ$sp f) { return f; }
- public static scala.Function2<Double, Long, Boolean> funcSpecialized(JFunction2$mcZDJ$sp f) { return f; }
- public static scala.Function2<Double, Long, Integer> funcSpecialized(JFunction2$mcIDJ$sp f) { return f; }
- public static scala.Function2<Double, Long, Float> funcSpecialized(JFunction2$mcFDJ$sp f) { return f; }
- public static scala.Function2<Double, Long, Long> funcSpecialized(JFunction2$mcJDJ$sp f) { return f; }
- public static scala.Function2<Double, Long, Double> funcSpecialized(JFunction2$mcDDJ$sp f) { return f; }
- public static scala.Function2<Double, Double, BoxedUnit> procSpecialized(JFunction2$mcVDD$sp f) { return f; }
- public static scala.Function2<Double, Double, Boolean> funcSpecialized(JFunction2$mcZDD$sp f) { return f; }
- public static scala.Function2<Double, Double, Integer> funcSpecialized(JFunction2$mcIDD$sp f) { return f; }
- public static scala.Function2<Double, Double, Float> funcSpecialized(JFunction2$mcFDD$sp f) { return f; }
- public static scala.Function2<Double, Double, Long> funcSpecialized(JFunction2$mcJDD$sp f) { return f; }
- public static scala.Function2<Double, Double, Double> funcSpecialized(JFunction2$mcDDD$sp f) { return f; }
- public static <T1, T2, T3, R> scala.Function3<T1, T2, T3, R> func(JFunction3<T1, T2, T3, R> f) { return f; }
- public static <T1, T2, T3> scala.Function3<T1, T2, T3, BoxedUnit> proc(JProcedure3<T1, T2, T3> p) { return p; }
- public static <T1, T2, T3, T4, R> scala.Function4<T1, T2, T3, T4, R> func(JFunction4<T1, T2, T3, T4, R> f) { return f; }
- public static <T1, T2, T3, T4> scala.Function4<T1, T2, T3, T4, BoxedUnit> proc(JProcedure4<T1, T2, T3, T4> p) { return p; }
- public static <T1, T2, T3, T4, T5, R> scala.Function5<T1, T2, T3, T4, T5, R> func(JFunction5<T1, T2, T3, T4, T5, R> f) { return f; }
- public static <T1, T2, T3, T4, T5> scala.Function5<T1, T2, T3, T4, T5, BoxedUnit> proc(JProcedure5<T1, T2, T3, T4, T5> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, R> scala.Function6<T1, T2, T3, T4, T5, T6, R> func(JFunction6<T1, T2, T3, T4, T5, T6, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6> scala.Function6<T1, T2, T3, T4, T5, T6, BoxedUnit> proc(JProcedure6<T1, T2, T3, T4, T5, T6> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, R> scala.Function7<T1, T2, T3, T4, T5, T6, T7, R> func(JFunction7<T1, T2, T3, T4, T5, T6, T7, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7> scala.Function7<T1, T2, T3, T4, T5, T6, T7, BoxedUnit> proc(JProcedure7<T1, T2, T3, T4, T5, T6, T7> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, R> scala.Function8<T1, T2, T3, T4, T5, T6, T7, T8, R> func(JFunction8<T1, T2, T3, T4, T5, T6, T7, T8, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8> scala.Function8<T1, T2, T3, T4, T5, T6, T7, T8, BoxedUnit> proc(JProcedure8<T1, T2, T3, T4, T5, T6, T7, T8> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> scala.Function9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> func(JFunction9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> scala.Function9<T1, T2, T3, T4, T5, T6, T7, T8, T9, BoxedUnit> proc(JProcedure9<T1, T2, T3, T4, T5, T6, T7, T8, T9> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> scala.Function10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> func(JFunction10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> scala.Function10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, BoxedUnit> proc(JProcedure10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R> scala.Function11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R> func(JFunction11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> scala.Function11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, BoxedUnit> proc(JProcedure11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R> scala.Function12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R> func(JFunction12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> scala.Function12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, BoxedUnit> proc(JProcedure12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R> scala.Function13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R> func(JFunction13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> scala.Function13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, BoxedUnit> proc(JProcedure13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R> scala.Function14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R> func(JFunction14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> scala.Function14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, BoxedUnit> proc(JProcedure14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R> scala.Function15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R> func(JFunction15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> scala.Function15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, BoxedUnit> proc(JProcedure15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R> scala.Function16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R> func(JFunction16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> scala.Function16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, BoxedUnit> proc(JProcedure16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R> scala.Function17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R> func(JFunction17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> scala.Function17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, BoxedUnit> proc(JProcedure17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R> scala.Function18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R> func(JFunction18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> scala.Function18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, BoxedUnit> proc(JProcedure18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R> scala.Function19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R> func(JFunction19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> scala.Function19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, BoxedUnit> proc(JProcedure19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R> scala.Function20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R> func(JFunction20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> scala.Function20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, BoxedUnit> proc(JProcedure20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R> scala.Function21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R> func(JFunction21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> scala.Function21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, BoxedUnit> proc(JProcedure21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> p) { return p; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R> scala.Function22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R> func(JFunction22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R> f) { return f; }
- public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> scala.Function22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, BoxedUnit> proc(JProcedure22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> p) { return p; }
-}
-
diff --git a/src/library/scala/runtime/java8/JFunction0$mcB$sp.java b/src/library/scala/runtime/java8/JFunction0$mcB$sp.java
index c882757630..622dbabcf1 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcB$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcB$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcB$sp extends JFunction0 {
+public interface JFunction0$mcB$sp extends scala.Function0, java.io.Serializable {
byte apply$mcB$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToByte(apply$mcB$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcC$sp.java b/src/library/scala/runtime/java8/JFunction0$mcC$sp.java
index c804529f71..ad9a14ffa8 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcC$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcC$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcC$sp extends JFunction0 {
+public interface JFunction0$mcC$sp extends scala.Function0, java.io.Serializable {
char apply$mcC$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToCharacter(apply$mcC$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcD$sp.java b/src/library/scala/runtime/java8/JFunction0$mcD$sp.java
index dacf50237c..291b50db4b 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcD$sp extends JFunction0 {
+public interface JFunction0$mcD$sp extends scala.Function0, java.io.Serializable {
double apply$mcD$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcD$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcF$sp.java b/src/library/scala/runtime/java8/JFunction0$mcF$sp.java
index 2a9f824924..73b31dea0f 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcF$sp extends JFunction0 {
+public interface JFunction0$mcF$sp extends scala.Function0, java.io.Serializable {
float apply$mcF$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcF$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcI$sp.java b/src/library/scala/runtime/java8/JFunction0$mcI$sp.java
index 75c612f916..f9b2d659ad 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcI$sp extends JFunction0 {
+public interface JFunction0$mcI$sp extends scala.Function0, java.io.Serializable {
int apply$mcI$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcI$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcJ$sp.java b/src/library/scala/runtime/java8/JFunction0$mcJ$sp.java
index d08984c794..73c41976b7 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcJ$sp extends JFunction0 {
+public interface JFunction0$mcJ$sp extends scala.Function0, java.io.Serializable {
long apply$mcJ$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJ$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcS$sp.java b/src/library/scala/runtime/java8/JFunction0$mcS$sp.java
index d9e36a39f0..5fbabb2358 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcS$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcS$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcS$sp extends JFunction0 {
+public interface JFunction0$mcS$sp extends scala.Function0, java.io.Serializable {
short apply$mcS$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToShort(apply$mcS$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcV$sp.java b/src/library/scala/runtime/java8/JFunction0$mcV$sp.java
index abd5e6ebbe..735843796c 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcV$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcV$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcV$sp extends JFunction0 {
+public interface JFunction0$mcV$sp extends scala.Function0, java.io.Serializable {
void apply$mcV$sp();
default Object apply() { apply$mcV$sp(); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction0$mcZ$sp.java b/src/library/scala/runtime/java8/JFunction0$mcZ$sp.java
index e1cd62a913..01234c1728 100644
--- a/src/library/scala/runtime/java8/JFunction0$mcZ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction0$mcZ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction0$mcZ$sp extends JFunction0 {
+public interface JFunction0$mcZ$sp extends scala.Function0, java.io.Serializable {
boolean apply$mcZ$sp();
default Object apply() { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZ$sp()); }
diff --git a/src/library/scala/runtime/java8/JFunction0.java b/src/library/scala/runtime/java8/JFunction0.java
deleted file mode 100644
index 13426cc8af..0000000000
--- a/src/library/scala/runtime/java8/JFunction0.java
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction0<R> extends scala.Function0<R>, java.io.Serializable {
- default void $init$() {
- };
- default void apply$mcV$sp() {
- apply();
- }
- default byte apply$mcB$sp() {
- return scala.runtime.BoxesRunTime.unboxToByte(apply());
- }
- default short apply$mcS$sp() {
- return scala.runtime.BoxesRunTime.unboxToShort(apply());
- }
- default int apply$mcI$sp() {
- return scala.runtime.BoxesRunTime.unboxToInt(apply());
- }
- default long apply$mcJ$sp() {
- return scala.runtime.BoxesRunTime.unboxToLong(apply());
- }
- default char apply$mcC$sp() {
- return scala.runtime.BoxesRunTime.unboxToChar(apply());
- }
- default float apply$mcF$sp() {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply());
- }
- default double apply$mcD$sp() {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply());
- }
- default boolean apply$mcZ$sp() {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply());
- }
-}
diff --git a/src/library/scala/runtime/java8/JFunction1$mcDD$sp.java b/src/library/scala/runtime/java8/JFunction1$mcDD$sp.java
index 4fbb370b8b..07b85eed59 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcDD$sp extends JFunction1 {
+public interface JFunction1$mcDD$sp extends scala.Function1, java.io.Serializable {
double apply$mcDD$sp(double v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcDF$sp.java b/src/library/scala/runtime/java8/JFunction1$mcDF$sp.java
index ce45666dd1..f09edd2ce2 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcDF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcDF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcDF$sp extends JFunction1 {
+public interface JFunction1$mcDF$sp extends scala.Function1, java.io.Serializable {
double apply$mcDF$sp(float v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDF$sp(scala.runtime.BoxesRunTime.unboxToFloat(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcDI$sp.java b/src/library/scala/runtime/java8/JFunction1$mcDI$sp.java
index 09cac947c9..3cf40cb749 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcDI$sp extends JFunction1 {
+public interface JFunction1$mcDI$sp extends scala.Function1, java.io.Serializable {
double apply$mcDI$sp(int v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDI$sp(scala.runtime.BoxesRunTime.unboxToInt(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcDJ$sp.java b/src/library/scala/runtime/java8/JFunction1$mcDJ$sp.java
index f5154c3854..4023f30bc0 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcDJ$sp extends JFunction1 {
+public interface JFunction1$mcDJ$sp extends scala.Function1, java.io.Serializable {
double apply$mcDJ$sp(long v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDJ$sp(scala.runtime.BoxesRunTime.unboxToLong(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcFD$sp.java b/src/library/scala/runtime/java8/JFunction1$mcFD$sp.java
index 758b432d99..d460895838 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcFD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcFD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcFD$sp extends JFunction1 {
+public interface JFunction1$mcFD$sp extends scala.Function1, java.io.Serializable {
float apply$mcFD$sp(double v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFD$sp(scala.runtime.BoxesRunTime.unboxToDouble(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcFF$sp.java b/src/library/scala/runtime/java8/JFunction1$mcFF$sp.java
index 7e13e287a5..6c591800ca 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcFF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcFF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcFF$sp extends JFunction1 {
+public interface JFunction1$mcFF$sp extends scala.Function1, java.io.Serializable {
float apply$mcFF$sp(float v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFF$sp(scala.runtime.BoxesRunTime.unboxToFloat(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcFI$sp.java b/src/library/scala/runtime/java8/JFunction1$mcFI$sp.java
index e3c4a203c7..6669195914 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcFI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcFI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcFI$sp extends JFunction1 {
+public interface JFunction1$mcFI$sp extends scala.Function1, java.io.Serializable {
float apply$mcFI$sp(int v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFI$sp(scala.runtime.BoxesRunTime.unboxToInt(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcFJ$sp.java b/src/library/scala/runtime/java8/JFunction1$mcFJ$sp.java
index d989fa1ea8..cd953677ae 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcFJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcFJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcFJ$sp extends JFunction1 {
+public interface JFunction1$mcFJ$sp extends scala.Function1, java.io.Serializable {
float apply$mcFJ$sp(long v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFJ$sp(scala.runtime.BoxesRunTime.unboxToLong(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcID$sp.java b/src/library/scala/runtime/java8/JFunction1$mcID$sp.java
index bde5d88d46..37f6864936 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcID$sp extends JFunction1 {
+public interface JFunction1$mcID$sp extends scala.Function1, java.io.Serializable {
int apply$mcID$sp(double v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcID$sp(scala.runtime.BoxesRunTime.unboxToDouble(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcIF$sp.java b/src/library/scala/runtime/java8/JFunction1$mcIF$sp.java
index d1d235aef1..8a7656a286 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcIF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcIF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcIF$sp extends JFunction1 {
+public interface JFunction1$mcIF$sp extends scala.Function1, java.io.Serializable {
int apply$mcIF$sp(float v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIF$sp(scala.runtime.BoxesRunTime.unboxToFloat(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcII$sp.java b/src/library/scala/runtime/java8/JFunction1$mcII$sp.java
index ef44b3830c..792627b400 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcII$sp extends JFunction1 {
+public interface JFunction1$mcII$sp extends scala.Function1, java.io.Serializable {
int apply$mcII$sp(int v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcII$sp(scala.runtime.BoxesRunTime.unboxToInt(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcIJ$sp.java b/src/library/scala/runtime/java8/JFunction1$mcIJ$sp.java
index 373d13cd46..01c47a67da 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcIJ$sp extends JFunction1 {
+public interface JFunction1$mcIJ$sp extends scala.Function1, java.io.Serializable {
int apply$mcIJ$sp(long v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIJ$sp(scala.runtime.BoxesRunTime.unboxToLong(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcJD$sp.java b/src/library/scala/runtime/java8/JFunction1$mcJD$sp.java
index 86fd7b7779..d8d5274ca1 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcJD$sp extends JFunction1 {
+public interface JFunction1$mcJD$sp extends scala.Function1, java.io.Serializable {
long apply$mcJD$sp(double v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJD$sp(scala.runtime.BoxesRunTime.unboxToDouble(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcJF$sp.java b/src/library/scala/runtime/java8/JFunction1$mcJF$sp.java
index 3bcf264034..cc1fad36d0 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcJF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcJF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcJF$sp extends JFunction1 {
+public interface JFunction1$mcJF$sp extends scala.Function1, java.io.Serializable {
long apply$mcJF$sp(float v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJF$sp(scala.runtime.BoxesRunTime.unboxToFloat(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcJI$sp.java b/src/library/scala/runtime/java8/JFunction1$mcJI$sp.java
index 11bc15ef6e..fe941dd61a 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcJI$sp extends JFunction1 {
+public interface JFunction1$mcJI$sp extends scala.Function1, java.io.Serializable {
long apply$mcJI$sp(int v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJI$sp(scala.runtime.BoxesRunTime.unboxToInt(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcJJ$sp.java b/src/library/scala/runtime/java8/JFunction1$mcJJ$sp.java
index 2e1ad7878f..7034115bad 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcJJ$sp extends JFunction1 {
+public interface JFunction1$mcJJ$sp extends scala.Function1, java.io.Serializable {
long apply$mcJJ$sp(long v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcVD$sp.java b/src/library/scala/runtime/java8/JFunction1$mcVD$sp.java
index c8077e1268..dde9f55722 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcVD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcVD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcVD$sp extends JFunction1 {
+public interface JFunction1$mcVD$sp extends scala.Function1, java.io.Serializable {
void apply$mcVD$sp(double v1);
default Object apply(Object t) { apply$mcVD$sp(scala.runtime.BoxesRunTime.unboxToDouble(t)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcVF$sp.java b/src/library/scala/runtime/java8/JFunction1$mcVF$sp.java
index e7be77f8e3..0ffd80621f 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcVF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcVF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcVF$sp extends JFunction1 {
+public interface JFunction1$mcVF$sp extends scala.Function1, java.io.Serializable {
void apply$mcVF$sp(float v1);
default Object apply(Object t) { apply$mcVF$sp(scala.runtime.BoxesRunTime.unboxToFloat(t)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcVI$sp.java b/src/library/scala/runtime/java8/JFunction1$mcVI$sp.java
index 7597ca5294..2543d23e31 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcVI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcVI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcVI$sp extends JFunction1 {
+public interface JFunction1$mcVI$sp extends scala.Function1, java.io.Serializable {
void apply$mcVI$sp(int v1);
default Object apply(Object t) { apply$mcVI$sp(scala.runtime.BoxesRunTime.unboxToInt(t)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcVJ$sp.java b/src/library/scala/runtime/java8/JFunction1$mcVJ$sp.java
index 55c6c3997f..7564175402 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcVJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcVJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcVJ$sp extends JFunction1 {
+public interface JFunction1$mcVJ$sp extends scala.Function1, java.io.Serializable {
void apply$mcVJ$sp(long v1);
default Object apply(Object t) { apply$mcVJ$sp(scala.runtime.BoxesRunTime.unboxToLong(t)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcZD$sp.java b/src/library/scala/runtime/java8/JFunction1$mcZD$sp.java
index 883a0e84fa..ce5bd30029 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcZD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcZD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcZD$sp extends JFunction1 {
+public interface JFunction1$mcZD$sp extends scala.Function1, java.io.Serializable {
boolean apply$mcZD$sp(double v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZD$sp(scala.runtime.BoxesRunTime.unboxToDouble(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcZF$sp.java b/src/library/scala/runtime/java8/JFunction1$mcZF$sp.java
index 884832ca37..baa691e548 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcZF$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcZF$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcZF$sp extends JFunction1 {
+public interface JFunction1$mcZF$sp extends scala.Function1, java.io.Serializable {
boolean apply$mcZF$sp(float v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZF$sp(scala.runtime.BoxesRunTime.unboxToFloat(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcZI$sp.java b/src/library/scala/runtime/java8/JFunction1$mcZI$sp.java
index 8a51aa99a2..bf04b5922b 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcZI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcZI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcZI$sp extends JFunction1 {
+public interface JFunction1$mcZI$sp extends scala.Function1, java.io.Serializable {
boolean apply$mcZI$sp(int v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZI$sp(scala.runtime.BoxesRunTime.unboxToInt(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1$mcZJ$sp.java b/src/library/scala/runtime/java8/JFunction1$mcZJ$sp.java
index dc619666dc..808eea87b8 100644
--- a/src/library/scala/runtime/java8/JFunction1$mcZJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction1$mcZJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction1$mcZJ$sp extends JFunction1 {
+public interface JFunction1$mcZJ$sp extends scala.Function1, java.io.Serializable {
boolean apply$mcZJ$sp(long v1);
default Object apply(Object t) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZJ$sp(scala.runtime.BoxesRunTime.unboxToLong(t))); }
diff --git a/src/library/scala/runtime/java8/JFunction1.java b/src/library/scala/runtime/java8/JFunction1.java
deleted file mode 100644
index e1f886dad7..0000000000
--- a/src/library/scala/runtime/java8/JFunction1.java
+++ /dev/null
@@ -1,228 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction1<T1, R> extends scala.Function1<T1, R>, java.io.Serializable {
- default void apply$mcVI$sp(int v1) {
- apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1));
- }
- default boolean apply$mcZI$sp(int v1) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1)));
- }
- default int apply$mcII$sp(int v1) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1)));
- }
- default float apply$mcFI$sp(int v1) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1)));
- }
- default long apply$mcJI$sp(int v1) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1)));
- }
- default double apply$mcDI$sp(int v1) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1)));
- }
- default void apply$mcVJ$sp(long v1) {
- apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1));
- }
- default boolean apply$mcZJ$sp(long v1) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1)));
- }
- default int apply$mcIJ$sp(long v1) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1)));
- }
- default float apply$mcFJ$sp(long v1) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1)));
- }
- default long apply$mcJJ$sp(long v1) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1)));
- }
- default double apply$mcDJ$sp(long v1) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1)));
- }
- default void apply$mcVF$sp(float v1) {
- apply((T1) scala.runtime.BoxesRunTime.boxToFloat(v1));
- }
- default boolean apply$mcZF$sp(float v1) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToFloat(v1)));
- }
- default int apply$mcIF$sp(float v1) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToFloat(v1)));
- }
- default float apply$mcFF$sp(float v1) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToFloat(v1)));
- }
- default long apply$mcJF$sp(float v1) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToFloat(v1)));
- }
- default double apply$mcDF$sp(float v1) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToFloat(v1)));
- }
- default void apply$mcVD$sp(double v1) {
- apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1));
- }
- default boolean apply$mcZD$sp(double v1) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1)));
- }
- default int apply$mcID$sp(double v1) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1)));
- }
- default float apply$mcFD$sp(double v1) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1)));
- }
- default long apply$mcJD$sp(double v1) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1)));
- }
- default double apply$mcDD$sp(double v1) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1)));
- }
-
- default scala.Function1 compose$mcVI$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcZI$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcII$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcFI$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcJI$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcDI$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcVJ$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcZJ$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcIJ$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcFJ$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcJJ$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcDJ$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcVF$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcZF$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcIF$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcFF$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcJF$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcDF$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcVD$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcZD$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcID$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcFD$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcJD$sp(scala.Function1 g) {
- return compose(g);
- }
- default scala.Function1 compose$mcDD$sp(scala.Function1 g) {
- return compose(g);
- }
-
- default scala.Function1 andThen$mcVI$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcZI$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcII$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcFI$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcJI$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcDI$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcVJ$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcZJ$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcIJ$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcFJ$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcJJ$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcDJ$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcVF$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcZF$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcIF$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcFF$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcJF$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcDF$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcVD$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcZD$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcID$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcFD$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcJD$sp(scala.Function1 g) {
- return andThen(g);
- }
- default scala.Function1 andThen$mcDD$sp(scala.Function1 g) {
- return andThen(g);
- }
-}
diff --git a/src/library/scala/runtime/java8/JFunction10.java b/src/library/scala/runtime/java8/JFunction10.java
deleted file mode 100644
index f7a25c0df2..0000000000
--- a/src/library/scala/runtime/java8/JFunction10.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R> extends scala.Function10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction11.java b/src/library/scala/runtime/java8/JFunction11.java
deleted file mode 100644
index 9a548b8fc9..0000000000
--- a/src/library/scala/runtime/java8/JFunction11.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R> extends scala.Function11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction12.java b/src/library/scala/runtime/java8/JFunction12.java
deleted file mode 100644
index 12fb73faaf..0000000000
--- a/src/library/scala/runtime/java8/JFunction12.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R> extends scala.Function12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction13.java b/src/library/scala/runtime/java8/JFunction13.java
deleted file mode 100644
index c85c63448a..0000000000
--- a/src/library/scala/runtime/java8/JFunction13.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R> extends scala.Function13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction14.java b/src/library/scala/runtime/java8/JFunction14.java
deleted file mode 100644
index 9a578833aa..0000000000
--- a/src/library/scala/runtime/java8/JFunction14.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R> extends scala.Function14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction15.java b/src/library/scala/runtime/java8/JFunction15.java
deleted file mode 100644
index e993643953..0000000000
--- a/src/library/scala/runtime/java8/JFunction15.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R> extends scala.Function15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction16.java b/src/library/scala/runtime/java8/JFunction16.java
deleted file mode 100644
index a252cb5303..0000000000
--- a/src/library/scala/runtime/java8/JFunction16.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R> extends scala.Function16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction17.java b/src/library/scala/runtime/java8/JFunction17.java
deleted file mode 100644
index 045aa7196f..0000000000
--- a/src/library/scala/runtime/java8/JFunction17.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R> extends scala.Function17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction18.java b/src/library/scala/runtime/java8/JFunction18.java
deleted file mode 100644
index ba2bf31206..0000000000
--- a/src/library/scala/runtime/java8/JFunction18.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R> extends scala.Function18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction19.java b/src/library/scala/runtime/java8/JFunction19.java
deleted file mode 100644
index dde4824293..0000000000
--- a/src/library/scala/runtime/java8/JFunction19.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R> extends scala.Function19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDDD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDDD$sp.java
index 1c11fb5252..80ab5203d9 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDDD$sp extends JFunction2 {
+public interface JFunction2$mcDDD$sp extends scala.Function2, java.io.Serializable {
double apply$mcDDD$sp(double v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDDI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDDI$sp.java
index e080bc87fa..8e92338b82 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDDI$sp extends JFunction2 {
+public interface JFunction2$mcDDI$sp extends scala.Function2, java.io.Serializable {
double apply$mcDDI$sp(double v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDDI$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDDJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDDJ$sp.java
index f96b19dff7..3d4f4a7cde 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDDJ$sp extends JFunction2 {
+public interface JFunction2$mcDDJ$sp extends scala.Function2, java.io.Serializable {
double apply$mcDDJ$sp(double v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDDJ$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDID$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDID$sp.java
index 944f469a6d..bd6652e51a 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDID$sp extends JFunction2 {
+public interface JFunction2$mcDID$sp extends scala.Function2, java.io.Serializable {
double apply$mcDID$sp(int v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDID$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDII$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDII$sp.java
index a04f616b5a..d06a246d33 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDII$sp extends JFunction2 {
+public interface JFunction2$mcDII$sp extends scala.Function2, java.io.Serializable {
double apply$mcDII$sp(int v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDII$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDIJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDIJ$sp.java
index 3a7d33d4a5..cda23c4dcd 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDIJ$sp extends JFunction2 {
+public interface JFunction2$mcDIJ$sp extends scala.Function2, java.io.Serializable {
double apply$mcDIJ$sp(int v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDIJ$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDJD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDJD$sp.java
index 86b48486e6..723efd8451 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDJD$sp extends JFunction2 {
+public interface JFunction2$mcDJD$sp extends scala.Function2, java.io.Serializable {
double apply$mcDJD$sp(long v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDJD$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDJI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDJI$sp.java
index b9375c7870..c90352ef30 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDJI$sp extends JFunction2 {
+public interface JFunction2$mcDJI$sp extends scala.Function2, java.io.Serializable {
double apply$mcDJI$sp(long v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDJI$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcDJJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcDJJ$sp.java
index 4adbd17e14..3361219787 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcDJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcDJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcDJJ$sp extends JFunction2 {
+public interface JFunction2$mcDJJ$sp extends scala.Function2, java.io.Serializable {
double apply$mcDJJ$sp(long v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToDouble(apply$mcDJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFDD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFDD$sp.java
index 7e53d117c7..2b9236b5d1 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFDD$sp extends JFunction2 {
+public interface JFunction2$mcFDD$sp extends scala.Function2, java.io.Serializable {
float apply$mcFDD$sp(double v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFDI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFDI$sp.java
index 64c4b2f133..2c564962a7 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFDI$sp extends JFunction2 {
+public interface JFunction2$mcFDI$sp extends scala.Function2, java.io.Serializable {
float apply$mcFDI$sp(double v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFDI$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFDJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFDJ$sp.java
index c7ffcbc66a..a0785f4cd2 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFDJ$sp extends JFunction2 {
+public interface JFunction2$mcFDJ$sp extends scala.Function2, java.io.Serializable {
float apply$mcFDJ$sp(double v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFDJ$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFID$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFID$sp.java
index 43944751e6..ba67ddb593 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFID$sp extends JFunction2 {
+public interface JFunction2$mcFID$sp extends scala.Function2, java.io.Serializable {
float apply$mcFID$sp(int v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFID$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFII$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFII$sp.java
index a9a4540ca3..d58284b752 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFII$sp extends JFunction2 {
+public interface JFunction2$mcFII$sp extends scala.Function2, java.io.Serializable {
float apply$mcFII$sp(int v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFII$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFIJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFIJ$sp.java
index 217615c7a3..4bc6eeb908 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFIJ$sp extends JFunction2 {
+public interface JFunction2$mcFIJ$sp extends scala.Function2, java.io.Serializable {
float apply$mcFIJ$sp(int v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFIJ$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFJD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFJD$sp.java
index 8400e47876..f2435e23f7 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFJD$sp extends JFunction2 {
+public interface JFunction2$mcFJD$sp extends scala.Function2, java.io.Serializable {
float apply$mcFJD$sp(long v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFJD$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFJI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFJI$sp.java
index e6b6259f96..1362d00e94 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFJI$sp extends JFunction2 {
+public interface JFunction2$mcFJI$sp extends scala.Function2, java.io.Serializable {
float apply$mcFJI$sp(long v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFJI$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcFJJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcFJJ$sp.java
index 68a4c8ecc0..c9bcf515b7 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcFJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcFJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcFJJ$sp extends JFunction2 {
+public interface JFunction2$mcFJJ$sp extends scala.Function2, java.io.Serializable {
float apply$mcFJJ$sp(long v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToFloat(apply$mcFJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIDD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIDD$sp.java
index 76fe0b6ead..28693910a5 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIDD$sp extends JFunction2 {
+public interface JFunction2$mcIDD$sp extends scala.Function2, java.io.Serializable {
int apply$mcIDD$sp(double v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIDI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIDI$sp.java
index 908078f735..50c775fbd9 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIDI$sp extends JFunction2 {
+public interface JFunction2$mcIDI$sp extends scala.Function2, java.io.Serializable {
int apply$mcIDI$sp(double v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIDI$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIDJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIDJ$sp.java
index 35c943e324..3231aa7a88 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIDJ$sp extends JFunction2 {
+public interface JFunction2$mcIDJ$sp extends scala.Function2, java.io.Serializable {
int apply$mcIDJ$sp(double v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIDJ$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIID$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIID$sp.java
index f245ec8788..01568b2fd6 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIID$sp extends JFunction2 {
+public interface JFunction2$mcIID$sp extends scala.Function2, java.io.Serializable {
int apply$mcIID$sp(int v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIID$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIII$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIII$sp.java
index f3a7a56dff..e0fba76675 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIII$sp extends JFunction2 {
+public interface JFunction2$mcIII$sp extends scala.Function2, java.io.Serializable {
int apply$mcIII$sp(int v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIII$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIIJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIIJ$sp.java
index 9736196b9e..7155548e9f 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIIJ$sp extends JFunction2 {
+public interface JFunction2$mcIIJ$sp extends scala.Function2, java.io.Serializable {
int apply$mcIIJ$sp(int v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIIJ$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIJD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIJD$sp.java
index 3211432ccb..f541cfdef4 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIJD$sp extends JFunction2 {
+public interface JFunction2$mcIJD$sp extends scala.Function2, java.io.Serializable {
int apply$mcIJD$sp(long v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIJD$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIJI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIJI$sp.java
index 74f76404e0..e484efe427 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIJI$sp extends JFunction2 {
+public interface JFunction2$mcIJI$sp extends scala.Function2, java.io.Serializable {
int apply$mcIJI$sp(long v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIJI$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcIJJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcIJJ$sp.java
index 7b9060bcb8..ec3538779c 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcIJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcIJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcIJJ$sp extends JFunction2 {
+public interface JFunction2$mcIJJ$sp extends scala.Function2, java.io.Serializable {
int apply$mcIJJ$sp(long v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToInteger(apply$mcIJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJDD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJDD$sp.java
index b4595cdf6a..b13502de5b 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJDD$sp extends JFunction2 {
+public interface JFunction2$mcJDD$sp extends scala.Function2, java.io.Serializable {
long apply$mcJDD$sp(double v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJDI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJDI$sp.java
index 59aad669e7..9ec9adda60 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJDI$sp extends JFunction2 {
+public interface JFunction2$mcJDI$sp extends scala.Function2, java.io.Serializable {
long apply$mcJDI$sp(double v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJDI$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJDJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJDJ$sp.java
index 8111e03617..68ef9ead14 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJDJ$sp extends JFunction2 {
+public interface JFunction2$mcJDJ$sp extends scala.Function2, java.io.Serializable {
long apply$mcJDJ$sp(double v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJDJ$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJID$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJID$sp.java
index 8a06a40a4a..29c9c5e3d3 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJID$sp extends JFunction2 {
+public interface JFunction2$mcJID$sp extends scala.Function2, java.io.Serializable {
long apply$mcJID$sp(int v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJID$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJII$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJII$sp.java
index 3d2e03ddbc..bb23086125 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJII$sp extends JFunction2 {
+public interface JFunction2$mcJII$sp extends scala.Function2, java.io.Serializable {
long apply$mcJII$sp(int v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJII$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJIJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJIJ$sp.java
index 32408269c8..649fe24325 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJIJ$sp extends JFunction2 {
+public interface JFunction2$mcJIJ$sp extends scala.Function2, java.io.Serializable {
long apply$mcJIJ$sp(int v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJIJ$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJJD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJJD$sp.java
index cf75bc5c19..8e6071d448 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJJD$sp extends JFunction2 {
+public interface JFunction2$mcJJD$sp extends scala.Function2, java.io.Serializable {
long apply$mcJJD$sp(long v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJJD$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJJI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJJI$sp.java
index eddcea671d..61366ac26d 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJJI$sp extends JFunction2 {
+public interface JFunction2$mcJJI$sp extends scala.Function2, java.io.Serializable {
long apply$mcJJI$sp(long v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJJI$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcJJJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcJJJ$sp.java
index 4f5626a3e6..a44e97318e 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcJJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcJJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcJJJ$sp extends JFunction2 {
+public interface JFunction2$mcJJJ$sp extends scala.Function2, java.io.Serializable {
long apply$mcJJJ$sp(long v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToLong(apply$mcJJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVDD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVDD$sp.java
index 45b9739c91..8e7cbd7d1b 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVDD$sp extends JFunction2 {
+public interface JFunction2$mcVDD$sp extends scala.Function2, java.io.Serializable {
void apply$mcVDD$sp(double v1, double v2);
default Object apply(Object v1, Object v2) { apply$mcVDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVDI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVDI$sp.java
index c344ea5017..1dee353d6b 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVDI$sp extends JFunction2 {
+public interface JFunction2$mcVDI$sp extends scala.Function2, java.io.Serializable {
void apply$mcVDI$sp(double v1, int v2);
default Object apply(Object v1, Object v2) { apply$mcVDI$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToInt(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVDJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVDJ$sp.java
index 94b01d59d5..0b95608684 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVDJ$sp extends JFunction2 {
+public interface JFunction2$mcVDJ$sp extends scala.Function2, java.io.Serializable {
void apply$mcVDJ$sp(double v1, long v2);
default Object apply(Object v1, Object v2) { apply$mcVDJ$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToLong(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVID$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVID$sp.java
index 47c29525a7..f0ed7e7e97 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVID$sp extends JFunction2 {
+public interface JFunction2$mcVID$sp extends scala.Function2, java.io.Serializable {
void apply$mcVID$sp(int v1, double v2);
default Object apply(Object v1, Object v2) { apply$mcVID$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVII$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVII$sp.java
index 546a994cb9..52d7922cc1 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVII$sp extends JFunction2 {
+public interface JFunction2$mcVII$sp extends scala.Function2, java.io.Serializable {
void apply$mcVII$sp(int v1, int v2);
default Object apply(Object v1, Object v2) { apply$mcVII$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToInt(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVIJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVIJ$sp.java
index d9871efee3..ac256bf163 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVIJ$sp extends JFunction2 {
+public interface JFunction2$mcVIJ$sp extends scala.Function2, java.io.Serializable {
void apply$mcVIJ$sp(int v1, long v2);
default Object apply(Object v1, Object v2) { apply$mcVIJ$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToLong(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVJD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVJD$sp.java
index 525c8ee059..6e2dea3fbf 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVJD$sp extends JFunction2 {
+public interface JFunction2$mcVJD$sp extends scala.Function2, java.io.Serializable {
void apply$mcVJD$sp(long v1, double v2);
default Object apply(Object v1, Object v2) { apply$mcVJD$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVJI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVJI$sp.java
index 98f33bf942..d1cba439e6 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVJI$sp extends JFunction2 {
+public interface JFunction2$mcVJI$sp extends scala.Function2, java.io.Serializable {
void apply$mcVJI$sp(long v1, int v2);
default Object apply(Object v1, Object v2) { apply$mcVJI$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToInt(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcVJJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcVJJ$sp.java
index adb8934b57..67f848a60e 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcVJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcVJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcVJJ$sp extends JFunction2 {
+public interface JFunction2$mcVJJ$sp extends scala.Function2, java.io.Serializable {
void apply$mcVJJ$sp(long v1, long v2);
default Object apply(Object v1, Object v2) { apply$mcVJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToLong(v2)); return scala.runtime.BoxedUnit.UNIT; }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZDD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZDD$sp.java
index 9272e025a6..b430c5f134 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZDD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZDD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZDD$sp extends JFunction2 {
+public interface JFunction2$mcZDD$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZDD$sp(double v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZDD$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZDI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZDI$sp.java
index 4406e00abd..01fb8ba003 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZDI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZDI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZDI$sp extends JFunction2 {
+public interface JFunction2$mcZDI$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZDI$sp(double v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZDI$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZDJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZDJ$sp.java
index 1f92dddfaf..a7d28e3cfc 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZDJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZDJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZDJ$sp extends JFunction2 {
+public interface JFunction2$mcZDJ$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZDJ$sp(double v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZDJ$sp(scala.runtime.BoxesRunTime.unboxToDouble(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZID$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZID$sp.java
index 06b73f9897..e77719bf75 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZID$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZID$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZID$sp extends JFunction2 {
+public interface JFunction2$mcZID$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZID$sp(int v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZID$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZII$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZII$sp.java
index 729f86063f..5f1f83aaf8 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZII$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZII$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZII$sp extends JFunction2 {
+public interface JFunction2$mcZII$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZII$sp(int v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZII$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZIJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZIJ$sp.java
index 38da681cd1..38fabd6f69 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZIJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZIJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZIJ$sp extends JFunction2 {
+public interface JFunction2$mcZIJ$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZIJ$sp(int v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZIJ$sp(scala.runtime.BoxesRunTime.unboxToInt(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZJD$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZJD$sp.java
index 6dc9534811..59c82cb01e 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZJD$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZJD$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZJD$sp extends JFunction2 {
+public interface JFunction2$mcZJD$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZJD$sp(long v1, double v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZJD$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToDouble(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZJI$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZJI$sp.java
index a86f63be36..3e73b8a794 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZJI$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZJI$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZJI$sp extends JFunction2 {
+public interface JFunction2$mcZJI$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZJI$sp(long v1, int v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZJI$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToInt(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2$mcZJJ$sp.java b/src/library/scala/runtime/java8/JFunction2$mcZJJ$sp.java
index 728a781e8e..96a14e98a5 100644
--- a/src/library/scala/runtime/java8/JFunction2$mcZJJ$sp.java
+++ b/src/library/scala/runtime/java8/JFunction2$mcZJJ$sp.java
@@ -6,7 +6,7 @@
package scala.runtime.java8;
@FunctionalInterface
-public interface JFunction2$mcZJJ$sp extends JFunction2 {
+public interface JFunction2$mcZJJ$sp extends scala.Function2, java.io.Serializable {
boolean apply$mcZJJ$sp(long v1, long v2);
default Object apply(Object v1, Object v2) { return scala.runtime.BoxesRunTime.boxToBoolean(apply$mcZJJ$sp(scala.runtime.BoxesRunTime.unboxToLong(v1), scala.runtime.BoxesRunTime.unboxToLong(v2))); }
diff --git a/src/library/scala/runtime/java8/JFunction2.java b/src/library/scala/runtime/java8/JFunction2.java
deleted file mode 100644
index 548ff60cf6..0000000000
--- a/src/library/scala/runtime/java8/JFunction2.java
+++ /dev/null
@@ -1,498 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction2<T1, T2, R> extends scala.Function2<T1, T2, R>, java.io.Serializable {
- default void apply$mcVII$sp(int v1, int v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2));
- }
- default boolean apply$mcZII$sp(int v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default int apply$mcIII$sp(int v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default float apply$mcFII$sp(int v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default long apply$mcJII$sp(int v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default double apply$mcDII$sp(int v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default void apply$mcVIJ$sp(int v1, long v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2));
- }
- default boolean apply$mcZIJ$sp(int v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default int apply$mcIIJ$sp(int v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default float apply$mcFIJ$sp(int v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default long apply$mcJIJ$sp(int v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default double apply$mcDIJ$sp(int v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default void apply$mcVID$sp(int v1, double v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2));
- }
- default boolean apply$mcZID$sp(int v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default int apply$mcIID$sp(int v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default float apply$mcFID$sp(int v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default long apply$mcJID$sp(int v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default double apply$mcDID$sp(int v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToInteger(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default void apply$mcVJI$sp(long v1, int v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2));
- }
- default boolean apply$mcZJI$sp(long v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default int apply$mcIJI$sp(long v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default float apply$mcFJI$sp(long v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default long apply$mcJJI$sp(long v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default double apply$mcDJI$sp(long v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default void apply$mcVJJ$sp(long v1, long v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2));
- }
- default boolean apply$mcZJJ$sp(long v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default int apply$mcIJJ$sp(long v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default float apply$mcFJJ$sp(long v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default long apply$mcJJJ$sp(long v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default double apply$mcDJJ$sp(long v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default void apply$mcVJD$sp(long v1, double v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2));
- }
- default boolean apply$mcZJD$sp(long v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default int apply$mcIJD$sp(long v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default float apply$mcFJD$sp(long v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default long apply$mcJJD$sp(long v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default double apply$mcDJD$sp(long v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToLong(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default void apply$mcVDI$sp(double v1, int v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2));
- }
- default boolean apply$mcZDI$sp(double v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default int apply$mcIDI$sp(double v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default float apply$mcFDI$sp(double v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default long apply$mcJDI$sp(double v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default double apply$mcDDI$sp(double v1, int v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToInteger(v2)));
- }
- default void apply$mcVDJ$sp(double v1, long v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2));
- }
- default boolean apply$mcZDJ$sp(double v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default int apply$mcIDJ$sp(double v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default float apply$mcFDJ$sp(double v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default long apply$mcJDJ$sp(double v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default double apply$mcDDJ$sp(double v1, long v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToLong(v2)));
- }
- default void apply$mcVDD$sp(double v1, double v2) {
- apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2));
- }
- default boolean apply$mcZDD$sp(double v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToBoolean(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default int apply$mcIDD$sp(double v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToInt(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default float apply$mcFDD$sp(double v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToFloat(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default long apply$mcJDD$sp(double v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToLong(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
- default double apply$mcDDD$sp(double v1, double v2) {
- return scala.runtime.BoxesRunTime.unboxToDouble(apply((T1) scala.runtime.BoxesRunTime.boxToDouble(v1), (T2) scala.runtime.BoxesRunTime.boxToDouble(v2)));
- }
-
- default scala.Function1 curried$mcVII$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZII$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIII$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFII$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJII$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDII$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVIJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZIJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIIJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFIJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJIJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDIJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVID$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZID$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIID$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFID$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJID$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDID$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVJI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZJI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIJI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFJI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJJI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDJI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVJJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZJJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIJJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFJJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJJJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDJJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVJD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZJD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIJD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFJD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJJD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDJD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVDI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZDI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIDI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFDI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJDI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDDI$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVDJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZDJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIDJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFDJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJDJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDDJ$sp() {
- return curried();
- }
- default scala.Function1 curried$mcVDD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcZDD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcIDD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcFDD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcJDD$sp() {
- return curried();
- }
- default scala.Function1 curried$mcDDD$sp() {
- return curried();
- }
-
- default scala.Function1 tupled$mcVII$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZII$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIII$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFII$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJII$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDII$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVIJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZIJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIIJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFIJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJIJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDIJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVID$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZID$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIID$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFID$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJID$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDID$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVJI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZJI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIJI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFJI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJJI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDJI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVJJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZJJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIJJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFJJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJJJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDJJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVJD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZJD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIJD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFJD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJJD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDJD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVDI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZDI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIDI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFDI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJDI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDDI$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVDJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZDJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIDJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFDJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJDJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDDJ$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcVDD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcZDD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcIDD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcFDD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcJDD$sp() {
- return tupled();
- }
- default scala.Function1 tupled$mcDDD$sp() {
- return tupled();
- }
-}
diff --git a/src/library/scala/runtime/java8/JFunction20.java b/src/library/scala/runtime/java8/JFunction20.java
deleted file mode 100644
index 5505743c20..0000000000
--- a/src/library/scala/runtime/java8/JFunction20.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R> extends scala.Function20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction21.java b/src/library/scala/runtime/java8/JFunction21.java
deleted file mode 100644
index 80e96d3715..0000000000
--- a/src/library/scala/runtime/java8/JFunction21.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R> extends scala.Function21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction22.java b/src/library/scala/runtime/java8/JFunction22.java
deleted file mode 100644
index 45e689458b..0000000000
--- a/src/library/scala/runtime/java8/JFunction22.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R> extends scala.Function22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction3.java b/src/library/scala/runtime/java8/JFunction3.java
deleted file mode 100644
index 6d81bb3a18..0000000000
--- a/src/library/scala/runtime/java8/JFunction3.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction3<T1, T2, T3, R> extends scala.Function3<T1, T2, T3, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction4.java b/src/library/scala/runtime/java8/JFunction4.java
deleted file mode 100644
index 6c5cd3b61d..0000000000
--- a/src/library/scala/runtime/java8/JFunction4.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction4<T1, T2, T3, T4, R> extends scala.Function4<T1, T2, T3, T4, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction5.java b/src/library/scala/runtime/java8/JFunction5.java
deleted file mode 100644
index eca1a406a6..0000000000
--- a/src/library/scala/runtime/java8/JFunction5.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction5<T1, T2, T3, T4, T5, R> extends scala.Function5<T1, T2, T3, T4, T5, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction6.java b/src/library/scala/runtime/java8/JFunction6.java
deleted file mode 100644
index 1c9daed5aa..0000000000
--- a/src/library/scala/runtime/java8/JFunction6.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction6<T1, T2, T3, T4, T5, T6, R> extends scala.Function6<T1, T2, T3, T4, T5, T6, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction7.java b/src/library/scala/runtime/java8/JFunction7.java
deleted file mode 100644
index c1aa130ba1..0000000000
--- a/src/library/scala/runtime/java8/JFunction7.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction7<T1, T2, T3, T4, T5, T6, T7, R> extends scala.Function7<T1, T2, T3, T4, T5, T6, T7, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction8.java b/src/library/scala/runtime/java8/JFunction8.java
deleted file mode 100644
index 425e694df8..0000000000
--- a/src/library/scala/runtime/java8/JFunction8.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction8<T1, T2, T3, T4, T5, T6, T7, T8, R> extends scala.Function8<T1, T2, T3, T4, T5, T6, T7, T8, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JFunction9.java b/src/library/scala/runtime/java8/JFunction9.java
deleted file mode 100644
index 21c3c8c6e3..0000000000
--- a/src/library/scala/runtime/java8/JFunction9.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-@FunctionalInterface
-public interface JFunction9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R> extends scala.Function9<T1, T2, T3, T4, T5, T6, T7, T8, T9, R>, java.io.Serializable {
-}
diff --git a/src/library/scala/runtime/java8/JProcedure0.java b/src/library/scala/runtime/java8/JProcedure0.java
deleted file mode 100644
index 6004364d03..0000000000
--- a/src/library/scala/runtime/java8/JProcedure0.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure0 extends JFunction0<BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid();
-
- default BoxedUnit apply() {
- applyVoid();
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure1.java b/src/library/scala/runtime/java8/JProcedure1.java
deleted file mode 100644
index 184d943042..0000000000
--- a/src/library/scala/runtime/java8/JProcedure1.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure1<T1> extends JFunction1<T1, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1);
-
- default BoxedUnit apply(T1 t1) {
- applyVoid(t1);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure10.java b/src/library/scala/runtime/java8/JProcedure10.java
deleted file mode 100644
index 2aadd7d215..0000000000
--- a/src/library/scala/runtime/java8/JProcedure10.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> extends JFunction10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure11.java b/src/library/scala/runtime/java8/JProcedure11.java
deleted file mode 100644
index c29853be1f..0000000000
--- a/src/library/scala/runtime/java8/JProcedure11.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> extends JFunction11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure12.java b/src/library/scala/runtime/java8/JProcedure12.java
deleted file mode 100644
index 0607600c33..0000000000
--- a/src/library/scala/runtime/java8/JProcedure12.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> extends JFunction12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure13.java b/src/library/scala/runtime/java8/JProcedure13.java
deleted file mode 100644
index c390fed2a5..0000000000
--- a/src/library/scala/runtime/java8/JProcedure13.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> extends JFunction13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure14.java b/src/library/scala/runtime/java8/JProcedure14.java
deleted file mode 100644
index d67cff1b5a..0000000000
--- a/src/library/scala/runtime/java8/JProcedure14.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> extends JFunction14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure15.java b/src/library/scala/runtime/java8/JProcedure15.java
deleted file mode 100644
index 81e0f524f5..0000000000
--- a/src/library/scala/runtime/java8/JProcedure15.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> extends JFunction15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure16.java b/src/library/scala/runtime/java8/JProcedure16.java
deleted file mode 100644
index 3d29ae25c5..0000000000
--- a/src/library/scala/runtime/java8/JProcedure16.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> extends JFunction16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure17.java b/src/library/scala/runtime/java8/JProcedure17.java
deleted file mode 100644
index 85f40b2cd5..0000000000
--- a/src/library/scala/runtime/java8/JProcedure17.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> extends JFunction17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure18.java b/src/library/scala/runtime/java8/JProcedure18.java
deleted file mode 100644
index fe2ab6f22c..0000000000
--- a/src/library/scala/runtime/java8/JProcedure18.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> extends JFunction18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure19.java b/src/library/scala/runtime/java8/JProcedure19.java
deleted file mode 100644
index 9289d639a5..0000000000
--- a/src/library/scala/runtime/java8/JProcedure19.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> extends JFunction19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure2.java b/src/library/scala/runtime/java8/JProcedure2.java
deleted file mode 100644
index 273357a3b0..0000000000
--- a/src/library/scala/runtime/java8/JProcedure2.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure2<T1, T2> extends JFunction2<T1, T2, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2);
-
- default BoxedUnit apply(T1 t1, T2 t2) {
- applyVoid(t1, t2);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure20.java b/src/library/scala/runtime/java8/JProcedure20.java
deleted file mode 100644
index 8701e9d422..0000000000
--- a/src/library/scala/runtime/java8/JProcedure20.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> extends JFunction20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure21.java b/src/library/scala/runtime/java8/JProcedure21.java
deleted file mode 100644
index f8e38f6c70..0000000000
--- a/src/library/scala/runtime/java8/JProcedure21.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> extends JFunction21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure22.java b/src/library/scala/runtime/java8/JProcedure22.java
deleted file mode 100644
index 8bae4d7e0d..0000000000
--- a/src/library/scala/runtime/java8/JProcedure22.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> extends JFunction22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T11 t11, T12 t12, T13 t13, T14 t14, T15 t15, T16 t16, T17 t17, T18 t18, T19 t19, T20 t20, T21 t21, T22 t22) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure3.java b/src/library/scala/runtime/java8/JProcedure3.java
deleted file mode 100644
index 7c53187f31..0000000000
--- a/src/library/scala/runtime/java8/JProcedure3.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure3<T1, T2, T3> extends JFunction3<T1, T2, T3, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3) {
- applyVoid(t1, t2, t3);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure4.java b/src/library/scala/runtime/java8/JProcedure4.java
deleted file mode 100644
index 33161bc151..0000000000
--- a/src/library/scala/runtime/java8/JProcedure4.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure4<T1, T2, T3, T4> extends JFunction4<T1, T2, T3, T4, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4) {
- applyVoid(t1, t2, t3, t4);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure5.java b/src/library/scala/runtime/java8/JProcedure5.java
deleted file mode 100644
index c834c48bf6..0000000000
--- a/src/library/scala/runtime/java8/JProcedure5.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure5<T1, T2, T3, T4, T5> extends JFunction5<T1, T2, T3, T4, T5, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) {
- applyVoid(t1, t2, t3, t4, t5);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure6.java b/src/library/scala/runtime/java8/JProcedure6.java
deleted file mode 100644
index 995bdd6734..0000000000
--- a/src/library/scala/runtime/java8/JProcedure6.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure6<T1, T2, T3, T4, T5, T6> extends JFunction6<T1, T2, T3, T4, T5, T6, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) {
- applyVoid(t1, t2, t3, t4, t5, t6);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure7.java b/src/library/scala/runtime/java8/JProcedure7.java
deleted file mode 100644
index 1821d8d406..0000000000
--- a/src/library/scala/runtime/java8/JProcedure7.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure7<T1, T2, T3, T4, T5, T6, T7> extends JFunction7<T1, T2, T3, T4, T5, T6, T7, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure8.java b/src/library/scala/runtime/java8/JProcedure8.java
deleted file mode 100644
index 4b9dd0929a..0000000000
--- a/src/library/scala/runtime/java8/JProcedure8.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure8<T1, T2, T3, T4, T5, T6, T7, T8> extends JFunction8<T1, T2, T3, T4, T5, T6, T7, T8, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/runtime/java8/JProcedure9.java b/src/library/scala/runtime/java8/JProcedure9.java
deleted file mode 100644
index c4cbc65b6c..0000000000
--- a/src/library/scala/runtime/java8/JProcedure9.java
+++ /dev/null
@@ -1,21 +0,0 @@
-
-/*
- * Copyright (C) 2012-2015 Typesafe Inc. <http://www.typesafe.com>
- */
-
-package scala.runtime.java8;
-
-import scala.runtime.BoxedUnit;
-
-@FunctionalInterface
-public interface JProcedure9<T1, T2, T3, T4, T5, T6, T7, T8, T9> extends JFunction9<T1, T2, T3, T4, T5, T6, T7, T8, T9, BoxedUnit> {
- default void $init$() {
- }
-
- void applyVoid(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9);
-
- default BoxedUnit apply(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9) {
- applyVoid(t1, t2, t3, t4, t5, t6, t7, t8, t9);
- return BoxedUnit.UNIT;
- }
-}
diff --git a/src/library/scala/util/Either.scala b/src/library/scala/util/Either.scala
index 01da0c1ef2..2f1e5d5c33 100644
--- a/src/library/scala/util/Either.scala
+++ b/src/library/scala/util/Either.scala
@@ -32,12 +32,21 @@ package util
* Left(in)
* }
*
- * println( result match {
- * case Right(x) => "You passed me the Int: " + x + ", which I will increment. " + x + " + 1 = " + (x+1)
- * case Left(x) => "You passed me the String: " + x
+ * println(result match {
+ * case Right(x) => s"You passed me the Int: $x, which I will increment. $x + 1 = ${x+1}"
+ * case Left(x) => s"You passed me the String: $x"
* })
* }}}
*
+ * Either is right-biased, which means that Right is assumed to be the default case to
+ * operate on. If it is Left, operations like map, flatMap, ... return the Left value
+ * unchanged:
+ *
+ * {{{
+ * Right(12).map(_ * 2) // Right(24)
+ * Left(23).map(_ * 2) // Left(23)
+ * }}}
+ *
* A ''projection'' can be used to selectively operate on a value of type Either,
* depending on whether it is of type Left or Right. For example, to transform an
* Either using a function, in the case where it's a Left, one can first apply
@@ -70,11 +79,13 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
/**
* Projects this `Either` as a `Left`.
*/
+ @deprecated("use swap instead", "2.12.0")
def left = Either.LeftProjection(this)
/**
* Projects this `Either` as a `Right`.
*/
+ @deprecated("Either is now right-biased", "2.12.0")
def right = Either.RightProjection(this)
/**
@@ -83,8 +94,8 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* @example {{{
* val result: Either[Exception, Value] = possiblyFailingOperation()
* log(result.fold(
- * ex => "Operation failed with " + ex,
- * v => "Operation produced value: " + v
+ * ex => s"Operation failed with $ex",
+ * v => s"Operation produced value: $v"
* ))
* }}}
*
@@ -92,9 +103,9 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* @param fb the function to apply if this is a `Right`
* @return the results of applying the function
*/
- def fold[X](fa: A => X, fb: B => X) = this match {
- case Left(a) => fa(a)
+ def fold[C](fa: A => C, fb: B => C): C = this match {
case Right(b) => fb(b)
+ case Left(a) => fa(a)
}
/**
@@ -105,8 +116,8 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* val r: Either[Int, String] = l.swap // Result: Right("left")
* }}}
*/
- def swap = this match {
- case Left(a) => Right(a)
+ def swap: Either[B, A] = this match {
+ case Left(a) => Right(a)
case Right(b) => Left(b)
}
@@ -130,8 +141,9 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* This method, and `joinLeft`, are analogous to `Option#flatten`
*/
def joinRight[A1 >: A, B1 >: B, C](implicit ev: B1 <:< Either[A1, C]): Either[A1, C] = this match {
- case Left(a) => Left(a)
case Right(b) => b
+ case Left(a) => this.asInstanceOf[Either[A1, C]]
+
}
/**
@@ -155,7 +167,155 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
*/
def joinLeft[A1 >: A, B1 >: B, C](implicit ev: A1 <:< Either[C, B1]): Either[C, B1] = this match {
case Left(a) => a
- case Right(b) => Right(b)
+ case Right(b) => this.asInstanceOf[Either[C, B1]]
+ }
+
+ /**
+ * Executes the given side-effecting function if this is a `Right`.
+ *
+ * {{{
+ * Right(12).foreach(x => println(x)) // prints "12"
+ * Left(12).foreach(x => println(x)) // doesn't print
+ * }}}
+ * @param f The side-effecting function to execute.
+ */
+ def foreach[U](f: B => U): Unit = this match {
+ case Right(b) => f(b)
+ case Left(_) =>
+ }
+
+ /**
+ * Returns the value from this `Right` or the given argument if this is a `Left`.
+ *
+ * {{{
+ * Right(12).getOrElse(17) // 12
+ * Left(12).getOrElse(17) // 17
+ * }}}
+ */
+ def getOrElse[BB >: B](or: => BB): BB = this match {
+ case Right(b) => b
+ case Left(_) => or
+ }
+
+ /** Returns `true` if this is a `Right` and its value is equal to `elem` (as determined by `==`),
+ * returns `false` otherwise.
+ *
+ * {{{
+ * // Returns true because value of Right is "something" which equals "something".
+ * Right("something") contains "something"
+ *
+ * // Returns false because value of Right is "something" which does not equal "anything".
+ * Right("something") contains "anything"
+ *
+ * // Returns false because there is no value for Right.
+ * Left("something") contains "something"
+ * }}}
+ *
+ * @param elem the element to test.
+ * @return `true` if the option has an element that is equal (as determined by `==`) to `elem`, `false` otherwise.
+ */
+ final def contains[BB >: B](elem: BB): Boolean = this match {
+ case Right(b) => b == elem
+ case Left(_) => false
+ }
+
+ /**
+ * Returns `true` if `Left` or returns the result of the application of
+ * the given function to the `Right` value.
+ *
+ * {{{
+ * Right(12).forall(_ > 10) // true
+ * Right(7).forall(_ > 10) // false
+ * Left(12).forall(_ > 10) // true
+ * }}}
+ */
+ def forall(f: B => Boolean): Boolean = this match {
+ case Right(b) => f(b)
+ case Left(_) => true
+ }
+
+ /**
+ * Returns `false` if `Left` or returns the result of the application of
+ * the given function to the `Right` value.
+ *
+ * {{{
+ * Right(12).exists(_ > 10) // true
+ * Right(7).exists(_ > 10) // false
+ * Left(12).exists(_ > 10) // false
+ * }}}
+ */
+ def exists(p: B => Boolean): Boolean = this match {
+ case Right(b) => p(b)
+ case Left(_) => false
+ }
+
+ /**
+ * Binds the given function across `Right`.
+ *
+ * @param f The function to bind across `Right`.
+ */
+ def flatMap[AA >: A, Y](f: B => Either[AA, Y]): Either[AA, Y] = this match {
+ case Right(b) => f(b)
+ case Left(a) => this.asInstanceOf[Either[AA, Y]]
+ }
+
+ /**
+ * The given function is applied if this is a `Right`.
+ *
+ * {{{
+ * Right(12).map(x => "flower") // Result: Right("flower")
+ * Left(12).map(x => "flower") // Result: Left(12)
+ * }}}
+ */
+ def map[Y](f: B => Y): Either[A, Y] = this match {
+ case Right(b) => Right(f(b))
+ case Left(a) => this.asInstanceOf[Either[A, Y]]
+ }
+
+ /** Returns `Right` with the existing value of `Right` if this is a `Right` and the given predicate `p` holds for the right value,
+ * returns `Left(zero)` if this is a `Right` and the given predicate `p` does not hold for the right value,
+ * returns `Left` with the existing value of `Left` if this is a `Left`.
+ *
+ * {{{
+ * Right(12).filterOrElse(_ > 10, -1) // Right(12)
+ * Right(7).filterOrElse(_ > 10, -1) // Left(-1)
+ * Left(12).filterOrElse(_ > 10, -1) // Left(12)
+ * }}}
+ */
+ def filterOrElse[AA >: A](p: B => Boolean, zero: => AA): Either[AA, B] = this match {
+ case Right(b) => if (p(b)) this else Left(zero)
+ case Left(a) => this
+ }
+
+ /** Returns a `Seq` containing the `Right` value if
+ * it exists or an empty `Seq` if this is a `Left`.
+ *
+ * {{{
+ * Right(12).toSeq // Seq(12)
+ * Left(12).toSeq // Seq()
+ * }}}
+ */
+ def toSeq: collection.immutable.Seq[B] = this match {
+ case Right(b) => collection.immutable.Seq(b)
+ case Left(_) => collection.immutable.Seq.empty
+ }
+
+ /** Returns a `Some` containing the `Right` value
+ * if it exists or a `None` if this is a `Left`.
+ *
+ * {{{
+ * Right(12).toOption // Some(12)
+ * Left(12).toOption // None
+ * }}}
+ */
+ def toOption: Option[B] = this match {
+ case Right(b) => Some(b)
+ case Left(_) => None
+ }
+
+ def toTry(implicit ev: A <:< Throwable): Try[B] = this match {
+ case Right(b) => Success(b)
+ case Left(a) => Failure(a)
}
/**
@@ -185,9 +345,11 @@ sealed abstract class Either[+A, +B] extends Product with Serializable {
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
* @version 1.0, 11/10/2008
*/
-final case class Left[+A, +B](a: A) extends Either[A, B] {
- def isLeft = true
+final case class Left[+A, +B](@deprecatedName('a, "2.12.0") value: A) extends Either[A, B] {
+ def isLeft = true
def isRight = false
+
+ @deprecated("Use .value instead.", "2.12.0") def a: A = value
}
/**
@@ -196,13 +358,29 @@ final case class Left[+A, +B](a: A) extends Either[A, B] {
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
* @version 1.0, 11/10/2008
*/
-final case class Right[+A, +B](b: B) extends Either[A, B] {
- def isLeft = false
+final case class Right[+A, +B](@deprecatedName('b, "2.12.0") value: B) extends Either[A, B] {
+ def isLeft = false
def isRight = true
+
+ @deprecated("Use .value instead.", "2.12.0") def b: B = value
}
object Either {
+ /** If the condition is satisfied, return the given `B` in `Right`,
+ * otherwise, return the given `A` in `Left`.
+ *
+ * {{{
+ * val userInput: String = ...
+ * Either.cond(
+ * userInput.forall(_.isDigit) && userInput.size == 10,
+ * PhoneNumber(userInput),
+ * "The input (%s) does not look like a phone number".format(userInput)
+ * }}}
+ */
+ def cond[X, Y](test: Boolean, right: => Y, left: => X): Either[X, Y] =
+ if (test) Right(right) else Left(left)
+
/**
* Allows use of a `merge` method to extract values from Either instances
* regardless of whether they are Left or Right.
@@ -216,8 +394,8 @@ object Either {
*/
implicit class MergeableEither[A](private val x: Either[A, A]) extends AnyVal {
def merge: A = x match {
- case Left(a) => a
case Right(a) => a
+ case Left(a) => a
}
}
@@ -250,7 +428,7 @@ object Either {
* }}}
*
* {{{
- * // using Either
+ * // using Either
* def interactWithDB(x: Query): Either[Exception, Result] =
* try {
* Right(getResultFromDatabase(x))
@@ -270,6 +448,7 @@ object Either {
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
* @version 1.0, 11/10/2008
*/
+ @deprecated("use swap instead", "2.12.0")
final case class LeftProjection[+A, +B](e: Either[A, B]) {
/**
* Returns the value from this `Left` or throws `java.util.NoSuchElementException`
@@ -282,9 +461,9 @@ object Either {
*
* @throws java.util.NoSuchElementException if the projection is [[scala.util.Right]]
*/
- def get = e match {
- case Left(a) => a
- case Right(_) => throw new NoSuchElementException("Either.left.value on Right")
+ def get: A = e match {
+ case Left(a) => a
+ case Right(_) => throw new NoSuchElementException("Either.left.get on Right")
}
/**
@@ -296,14 +475,13 @@ object Either {
* }}}
* @param f The side-effecting function to execute.
*/
- def foreach[U](f: A => U) = e match {
- case Left(a) => f(a)
- case Right(_) => {}
+ def foreach[U](f: A => U): Unit = e match {
+ case Left(a) => f(a)
+ case Right(_) =>
}
/**
- * Returns the value from this `Left` or the given argument if this is a
- * `Right`.
+ * Returns the value from this `Left` or the given argument if this is a `Right`.
*
* {{{
* Left(12).left.getOrElse(17) // 12
@@ -311,8 +489,8 @@ object Either {
* }}}
*
*/
- def getOrElse[AA >: A](or: => AA) = e match {
- case Left(a) => a
+ def getOrElse[AA >: A](or: => AA): AA = e match {
+ case Left(a) => a
case Right(_) => or
}
@@ -327,8 +505,8 @@ object Either {
* }}}
*
*/
- def forall(@deprecatedName('f) p: A => Boolean) = e match {
- case Left(a) => p(a)
+ def forall(@deprecatedName('f) p: A => Boolean): Boolean = e match {
+ case Left(a) => p(a)
case Right(_) => true
}
@@ -343,8 +521,8 @@ object Either {
* }}}
*
*/
- def exists(@deprecatedName('f) p: A => Boolean) = e match {
- case Left(a) => p(a)
+ def exists(@deprecatedName('f) p: A => Boolean): Boolean = e match {
+ case Left(a) => p(a)
case Right(_) => false
}
@@ -357,9 +535,9 @@ object Either {
* }}}
* @param f The function to bind across `Left`.
*/
- def flatMap[BB >: B, X](f: A => Either[X, BB]) = e match {
- case Left(a) => f(a)
- case Right(b) => Right(b)
+ def flatMap[BB >: B, X](f: A => Either[X, BB]): Either[X, BB] = e match {
+ case Left(a) => f(a)
+ case Right(b) => e.asInstanceOf[Either[X, BB]]
}
/**
@@ -370,9 +548,9 @@ object Either {
* Right[Int, Int](12).left.map(_ + 2) // Right(12)
* }}}
*/
- def map[X](f: A => X) = e match {
- case Left(a) => Left(f(a))
- case Right(b) => Right(b)
+ def map[X](f: A => X): Either[X, B] = e match {
+ case Left(a) => Left(f(a))
+ case Right(b) => e.asInstanceOf[Either[X, B]]
}
/**
@@ -386,7 +564,7 @@ object Either {
* }}}
*/
def filter[Y](p: A => Boolean): Option[Either[A, Y]] = e match {
- case Left(a) => if(p(a)) Some(Left(a)) else None
+ case Left(a) => if(p(a)) Some(Left(a)) else None
case Right(b) => None
}
@@ -399,8 +577,8 @@ object Either {
* Right(12).left.toSeq // Seq()
* }}}
*/
- def toSeq = e match {
- case Left(a) => Seq(a)
+ def toSeq: Seq[A] = e match {
+ case Left(a) => Seq(a)
case Right(_) => Seq.empty
}
@@ -413,8 +591,8 @@ object Either {
* Right(12).left.toOption // None
* }}}
*/
- def toOption = e match {
- case Left(a) => Some(a)
+ def toOption: Option[A] = e match {
+ case Left(a) => Some(a)
case Right(_) => None
}
}
@@ -434,6 +612,7 @@ object Either {
* @author <a href="mailto:research@workingmouse.com">Tony Morris</a>, Workingmouse
* @version 1.0, 11/10/2008
*/
+ @deprecated("Either is now right-biased", "2.12.0")
final case class RightProjection[+A, +B](e: Either[A, B]) {
/**
@@ -447,9 +626,9 @@ object Either {
*
* @throws java.util.NoSuchElementException if the projection is `Left`.
*/
- def get = e match {
- case Left(_) => throw new NoSuchElementException("Either.right.value on Left")
- case Right(a) => a
+ def get: B = e match {
+ case Right(b) => b
+ case Left(_) => throw new NoSuchElementException("Either.right.get on Left")
}
/**
@@ -461,23 +640,22 @@ object Either {
* }}}
* @param f The side-effecting function to execute.
*/
- def foreach[U](f: B => U) = e match {
- case Left(_) => {}
+ def foreach[U](f: B => U): Unit = e match {
case Right(b) => f(b)
+ case Left(_) =>
}
/**
- * Returns the value from this `Right` or the given argument if this is a
- * `Left`.
+ * Returns the value from this `Right` or the given argument if this is a `Left`.
*
* {{{
* Right(12).right.getOrElse(17) // 12
* Left(12).right.getOrElse(17) // 17
* }}}
*/
- def getOrElse[BB >: B](or: => BB) = e match {
- case Left(_) => or
+ def getOrElse[BB >: B](or: => BB): BB = e match {
case Right(b) => b
+ case Left(_) => or
}
/**
@@ -490,9 +668,9 @@ object Either {
* Left(12).right.forall(_ > 10) // true
* }}}
*/
- def forall(f: B => Boolean) = e match {
- case Left(_) => true
+ def forall(f: B => Boolean): Boolean = e match {
case Right(b) => f(b)
+ case Left(_) => true
}
/**
@@ -505,9 +683,9 @@ object Either {
* Left(12).right.exists(_ > 10) // false
* }}}
*/
- def exists(@deprecatedName('f) p: B => Boolean) = e match {
- case Left(_) => false
+ def exists(@deprecatedName('f) p: B => Boolean): Boolean = e match {
case Right(b) => p(b)
+ case Left(_) => false
}
/**
@@ -515,9 +693,9 @@ object Either {
*
* @param f The function to bind across `Right`.
*/
- def flatMap[AA >: A, Y](f: B => Either[AA, Y]) = e match {
- case Left(a) => Left(a)
+ def flatMap[AA >: A, Y](f: B => Either[AA, Y]): Either[AA, Y] = e match {
case Right(b) => f(b)
+ case Left(a) => e.asInstanceOf[Either[AA, Y]]
}
/**
@@ -528,9 +706,9 @@ object Either {
* Left(12).right.map(x => "flower") // Result: Left(12)
* }}}
*/
- def map[Y](f: B => Y) = e match {
- case Left(a) => Left(a)
+ def map[Y](f: B => Y): Either[A, Y] = e match {
case Right(b) => Right(f(b))
+ case Left(a) => e.asInstanceOf[Either[A, Y]]
}
/** Returns `None` if this is a `Left` or if the
@@ -544,8 +722,8 @@ object Either {
* }}}
*/
def filter[X](p: B => Boolean): Option[Either[X, B]] = e match {
- case Left(_) => None
case Right(b) => if(p(b)) Some(Right(b)) else None
+ case Left(_) => None
}
/** Returns a `Seq` containing the `Right` value if
@@ -556,9 +734,9 @@ object Either {
* Left(12).right.toSeq // Seq()
* }}}
*/
- def toSeq = e match {
- case Left(_) => Seq.empty
+ def toSeq: Seq[B] = e match {
case Right(b) => Seq(b)
+ case Left(_) => Seq.empty
}
/** Returns a `Some` containing the `Right` value
@@ -569,23 +747,9 @@ object Either {
* Left(12).right.toOption // None
* }}}
*/
- def toOption = e match {
- case Left(_) => None
+ def toOption: Option[B] = e match {
case Right(b) => Some(b)
+ case Left(_) => None
}
}
-
- /** If the condition is satisfied, return the given `B` in `Right`,
- * otherwise, return the given `A` in `Left`.
- *
- * {{{
- * val userInput: String = ...
- * Either.cond(
- * userInput.forall(_.isDigit) && userInput.size == 10,
- * PhoneNumber(userInput),
- * "The input (%s) does not look like a phone number".format(userInput)
- * }}}
- */
- def cond[A, B](test: Boolean, right: => B, left: => A): Either[A, B] =
- if (test) Right(right) else Left(left)
}
diff --git a/src/library/scala/util/matching/Regex.scala b/src/library/scala/util/matching/Regex.scala
index c4a3f1effa..ea9f02f85b 100644
--- a/src/library/scala/util/matching/Regex.scala
+++ b/src/library/scala/util/matching/Regex.scala
@@ -11,21 +11,14 @@
* with the main goal of pulling out information from those matches, or replacing
* them with something else.
*
- * There are four classes and three objects, with most of them being members of
- * Regex companion object. [[scala.util.matching.Regex]] is the class users instantiate
- * to do regular expression matching.
+ * [[scala.util.matching.Regex]] is the class users instantiate to do regular expression matching.
*
- * The remaining classes and objects in the package are used in the following way:
- *
- * * The companion object to [[scala.util.matching.Regex]] just contains the other members.
+ * The companion object to [[scala.util.matching.Regex]] contains supporting members:
* * [[scala.util.matching.Regex.Match]] makes more information about a match available.
- * * [[scala.util.matching.Regex.MatchIterator]] is used to iterate over multiple matches.
+ * * [[scala.util.matching.Regex.MatchIterator]] is used to iterate over matched strings.
* * [[scala.util.matching.Regex.MatchData]] is just a base trait for the above classes.
* * [[scala.util.matching.Regex.Groups]] extracts group from a [[scala.util.matching.Regex.Match]]
* without recomputing the match.
- * * [[scala.util.matching.Regex.Match]] converts a [[scala.util.matching.Regex.Match]]
- * into a [[java.lang.String]].
- *
*/
package scala.util.matching
@@ -35,6 +28,7 @@ import java.util.regex.{ Pattern, Matcher }
/** A regular expression is used to determine whether a string matches a pattern
* and, if it does, to extract or transform the parts that match.
*
+ * === Usage ===
* This class delegates to the [[java.util.regex]] package of the Java Platform.
* See the documentation for [[java.util.regex.Pattern]] for details about
* the regular expression syntax for pattern strings.
@@ -53,6 +47,7 @@ import java.util.regex.{ Pattern, Matcher }
* Since escapes are not processed in multi-line string literals, using triple quotes
* avoids having to escape the backslash character, so that `"\\d"` can be written `"""\d"""`.
*
+ * === Extraction ===
* To extract the capturing groups when a `Regex` is matched, use it as
* an extractor in a pattern match:
*
@@ -92,48 +87,68 @@ import java.util.regex.{ Pattern, Matcher }
* }
* }}}
*
+ * === Find Matches ===
* To find or replace matches of the pattern, use the various find and replace methods.
- * There is a flavor of each method that produces matched strings and
- * another that produces `Match` objects.
+ * For each method, there is a version for working with matched strings and
+ * another for working with `Match` objects.
*
* For example, pattern matching with an unanchored `Regex`, as in the previous example,
- * is the same as using `findFirstMatchIn`, except that the findFirst methods return an `Option`,
- * or `None` for no match:
+ * can also be accomplished using `findFirstMatchIn`. The `findFirst` methods return an `Option`
+ * which is non-empty if a match is found, or `None` for no match:
*
* {{{
* val dates = "Important dates in history: 2004-01-20, 1958-09-05, 2010-10-06, 2011-07-15"
- * val firstDate = date findFirstIn dates getOrElse "No date found."
- * val firstYear = for (m <- date findFirstMatchIn dates) yield m group 1
+ * val firstDate = date.findFirstIn(dates).getOrElse("No date found.")
+ * val firstYear = for (m <- date.findFirstMatchIn(dates)) yield m.group(1)
* }}}
*
* To find all matches:
*
* {{{
- * val allYears = for (m <- date findAllMatchIn dates) yield m group 1
+ * val allYears = for (m <- date.findAllMatchIn(dates)) yield m.group(1)
* }}}
*
- * But `findAllIn` returns a special iterator of strings that can be queried for the `MatchData`
- * of the last match:
+ * To iterate over the matched strings, use `findAllIn`, which returns a special iterator
+ * that can be queried for the `MatchData` of the last match:
*
* {{{
- * val mi = date findAllIn dates
- * val oldies = mi filter (_ => (mi group 1).toInt < 1960) map (s => s"$s: An oldie but goodie.")
+ * val mi = date.findAllIn(dates)
+ * while (mi.hasNext) {
+ * val d = mi.next
+ * if (mi.group(1).toInt < 1960) println(s"$d: An oldie but goodie.")
* }}}
*
* Note that `findAllIn` finds matches that don't overlap. (See [[findAllIn]] for more examples.)
*
* {{{
* val num = """(\d+)""".r
- * val all = (num findAllIn "123").toList // List("123"), not List("123", "23", "3")
+ * val all = num.findAllIn("123").toList // List("123"), not List("123", "23", "3")
+ * }}}
+ *
+ * Also, the "current match" of a `MatchIterator` may be advanced by either `hasNext` or `next`.
+ * By comparison, the `Iterator[Match]` returned by `findAllMatchIn` or `findAllIn.matchData`
+ * produces `Match` objects that remain valid after the iterator is advanced.
+ *
+ * {{{
+ * val ns = num.findAllIn("1 2 3")
+ * ns.start // 0
+ * ns.hasNext // true
+ * ns.start // 2
+ * val ms = num.findAllMatchIn("1 2 3")
+ * val m = ms.next()
+ * m.start // 0
+ * ms.hasNext // true
+ * m.start // still 0
* }}}
*
+ * === Replace Text ===
* Text replacement can be performed unconditionally or as a function of the current match:
*
* {{{
- * val redacted = date replaceAllIn (dates, "XXXX-XX-XX")
- * val yearsOnly = date replaceAllIn (dates, m => m group 1)
- * val months = (0 to 11) map { i => val c = Calendar.getInstance; c.set(2014, i, 1); f"$c%tb" }
- * val reformatted = date replaceAllIn (dates, _ match { case date(y,m,d) => f"${months(m.toInt - 1)} $d, $y" })
+ * val redacted = date.replaceAllIn(dates, "XXXX-XX-XX")
+ * val yearsOnly = date.replaceAllIn(dates, m => m.group(1))
+ * val months = (0 to 11).map { i => val c = Calendar.getInstance; c.set(2014, i, 1); f"$c%tb" }
+ * val reformatted = date.replaceAllIn(dates, _ match { case date(y,m,d) => f"${months(m.toInt - 1)} $d, $y" })
* }}}
*
* Pattern matching the `Match` against the `Regex` that created it does not reapply the `Regex`.
@@ -142,7 +157,7 @@ import java.util.regex.{ Pattern, Matcher }
*
* {{{
* val docSpree = """2011(?:-\d{2}){2}""".r
- * val docView = date replaceAllIn (dates, _ match {
+ * val docView = date.replaceAllIn(dates, _ match {
* case docSpree() => "Historic doc spree!"
* case _ => "Something else happened"
* })
@@ -338,8 +353,8 @@ class Regex private[matching](val pattern: Pattern, groupNames: String*) extends
* {{{
* val hat = "hat[^a]+".r
* val hathaway = "hathatthattthatttt"
- * val hats = (hat findAllIn hathaway).toList // List(hath, hattth)
- * val pos = (hat findAllMatchIn hathaway map (_.start)).toList // List(0, 7)
+ * val hats = hat.findAllIn(hathaway).toList // List(hath, hattth)
+ * val pos = hat.findAllMatchIn(hathaway).map(_.start).toList // List(0, 7)
* }}}
*
* To return overlapping matches, it is possible to formulate a regular expression
@@ -347,13 +362,13 @@ class Regex private[matching](val pattern: Pattern, groupNames: String*) extends
*
* {{{
* val madhatter = "(h)(?=(at[^a]+))".r
- * val madhats = (madhatter findAllMatchIn hathaway map {
+ * val madhats = madhatter.findAllMatchIn(hathaway).map {
* case madhatter(x,y) => s"$x$y"
- * }).toList // List(hath, hatth, hattth, hatttt)
+ * }.toList // List(hath, hatth, hattth, hatttt)
* }}}
*
- * Attempting to retrieve match information before performing the first match
- * or after exhausting the iterator results in [[java.lang.IllegalStateException]].
+ * Attempting to retrieve match information after exhausting the iterator
+ * results in [[java.lang.IllegalStateException]].
* See [[scala.util.matching.Regex.MatchIterator]] for details.
*
* @param source The text to match against.
@@ -743,11 +758,13 @@ object Regex {
/** A class to step through a sequence of regex matches.
*
- * All methods inherited from [[scala.util.matching.Regex.MatchData]] will throw
- * a [[java.lang.IllegalStateException]] until the matcher is initialized. The
- * matcher can be initialized by calling `hasNext` or `next()` or causing these
- * methods to be called, such as by invoking `toString` or iterating through
- * the iterator's elements.
+ * This is an iterator that returns the matched strings.
+ *
+ * Queries about match data pertain to the current state of the underlying
+ * matcher, which is advanced by calling `hasNext` or `next`.
+ *
+ * When matches are exhausted, queries about match data will throw
+ * [[java.lang.IllegalStateException]].
*
* @see [[java.util.regex.Matcher]]
*/
@@ -755,37 +772,62 @@ object Regex {
extends AbstractIterator[String] with Iterator[String] with MatchData { self =>
protected[Regex] val matcher = regex.pattern.matcher(source)
- private var nextSeen = false
- /** Is there another match? */
+ // 0 = not yet matched, 1 = matched, 2 = advanced to match, 3 = no more matches
+ private[this] var nextSeen = 0
+
+ /** Return true if `next` will find a match.
+ * As a side effect, advance the underlying matcher if necessary;
+ * queries about the current match data pertain to the underlying matcher.
+ */
def hasNext: Boolean = {
- if (!nextSeen) nextSeen = matcher.find()
- nextSeen
+ nextSeen match {
+ case 0 => nextSeen = if (matcher.find()) 1 else 3
+ case 1 => ()
+ case 2 => nextSeen = 0 ; hasNext
+ case 3 => ()
+ }
+ nextSeen == 1 // otherwise, 3
}
- /** The next matched substring of `source`. */
+ /** The next matched substring of `source`.
+ * As a side effect, advance the underlying matcher if necessary.
+ */
def next(): String = {
- if (!hasNext) throw new NoSuchElementException
- nextSeen = false
+ nextSeen match {
+ case 0 => if (!hasNext) throw new NoSuchElementException ; next()
+ case 1 => nextSeen = 2
+ case 2 => nextSeen = 0 ; next()
+ case 3 => throw new NoSuchElementException
+ }
matcher.group
}
+ /** Report emptiness. */
override def toString = super[AbstractIterator].toString
+ // ensure we're at a match
+ private[this] def ensure(): Unit = nextSeen match {
+ case 0 => if (!hasNext) throw new IllegalStateException
+ case 1 => ()
+ case 2 => ()
+ case 3 => throw new IllegalStateException
+ }
+
/** The index of the first matched character. */
- def start: Int = matcher.start
+ def start: Int = { ensure() ; matcher.start }
/** The index of the first matched character in group `i`. */
- def start(i: Int): Int = matcher.start(i)
+ def start(i: Int): Int = { ensure() ; matcher.start(i) }
/** The index of the last matched character. */
- def end: Int = matcher.end
+ def end: Int = { ensure() ; matcher.end }
/** The index following the last matched character in group `i`. */
- def end(i: Int): Int = matcher.end(i)
+ def end(i: Int): Int = { ensure() ; matcher.end(i) }
/** The number of subgroups. */
- def groupCount = matcher.groupCount
+ def groupCount = { ensure() ; matcher.groupCount }
/** Convert to an iterator that yields MatchData elements instead of Strings. */
def matchData: Iterator[Match] = new AbstractIterator[Match] {
diff --git a/src/partest-extras/scala/org/scalacheck/Arbitrary.scala b/src/partest-extras/scala/org/scalacheck/Arbitrary.scala
new file mode 100644
index 0000000000..1cbd668f0c
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Arbitrary.scala
@@ -0,0 +1,433 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import util.{FreqMap, Buildable, Buildable2}
+
+
+sealed abstract class Arbitrary[T] {
+ val arbitrary: Gen[T]
+}
+
+/** Defines implicit [[org.scalacheck.Arbitrary]] instances for common types.
+ * <p>
+ * ScalaCheck
+ * uses implicit [[org.scalacheck.Arbitrary]] instances when creating properties
+ * out of functions with the `Prop.property` method, and when
+ * the `Arbitrary.arbitrary` method is used. For example, the
+ * following code requires that there exists an implicit
+ * `Arbitrary[MyClass]` instance:
+ * </p>
+ *
+ * {{{
+ * val myProp = Prop.forAll { myClass: MyClass =>
+ * ...
+ * }
+ *
+ * val myGen = Arbitrary.arbitrary[MyClass]
+ * }}}
+ *
+ * <p>
+ * The required implicit definition could look like this:
+ * </p>
+ *
+ * {{{
+ * implicit val arbMyClass: Arbitrary[MyClass] = Arbitrary(...)
+ * }}}
+ *
+ * <p>
+ * The factory method `Arbitrary(...)` takes a generator of type
+ * `Gen[T]` and returns an instance of `Arbitrary[T]`.
+ * </p>
+ *
+ * <p>
+ * The `Arbitrary` module defines implicit [[org.scalacheck.Arbitrary]]
+ * instances for common types, for convenient use in your properties and
+ * generators.
+ * </p>
+ */
+object Arbitrary {
+
+ import Gen.{const, choose, sized, frequency, oneOf, containerOf, resize}
+ import collection.{immutable, mutable}
+ import java.util.Date
+
+ /** Creates an Arbitrary instance */
+ def apply[T](g: => Gen[T]): Arbitrary[T] = new Arbitrary[T] {
+ lazy val arbitrary = g
+ }
+
+ /** Returns an arbitrary generator for the type T. */
+ def arbitrary[T](implicit a: Arbitrary[T]): Gen[T] = a.arbitrary
+
+ /**** Arbitrary instances for each AnyVal ****/
+
+ /** Arbitrary AnyVal */
+ implicit lazy val arbAnyVal: Arbitrary[AnyVal] = Arbitrary(oneOf(
+ arbitrary[Unit], arbitrary[Boolean], arbitrary[Char], arbitrary[Byte],
+ arbitrary[Short], arbitrary[Int], arbitrary[Long], arbitrary[Float],
+ arbitrary[Double]
+ ))
+
+ /** Arbitrary instance of Boolean */
+ implicit lazy val arbBool: Arbitrary[Boolean] =
+ Arbitrary(oneOf(true, false))
+
+ /** Arbitrary instance of Int */
+ implicit lazy val arbInt: Arbitrary[Int] = Arbitrary(
+ Gen.chooseNum(Int.MinValue, Int.MaxValue)
+ )
+
+ /** Arbitrary instance of Long */
+ implicit lazy val arbLong: Arbitrary[Long] = Arbitrary(
+ Gen.chooseNum(Long.MinValue, Long.MaxValue)
+ )
+
+ /** Arbitrary instance of Float */
+ implicit lazy val arbFloat: Arbitrary[Float] = Arbitrary(
+ Gen.chooseNum(
+ Float.MinValue, Float.MaxValue
+ // I find that including these by default is a little TOO testy.
+ // Float.Epsilon, Float.NaN, Float.PositiveInfinity, Float.NegativeInfinity
+ )
+ )
+
+ /** Arbitrary instance of Double */
+ implicit lazy val arbDouble: Arbitrary[Double] = Arbitrary(
+ Gen.chooseNum(
+ Double.MinValue / 2, Double.MaxValue / 2
+ // As above. Perhaps behind some option?
+ // Double.Epsilon, Double.NaN, Double.PositiveInfinity, Double.NegativeInfinity
+ )
+ )
+
+ /** Arbitrary instance of Char */
+ implicit lazy val arbChar: Arbitrary[Char] = Arbitrary(
+ Gen.frequency(
+ (0xD800-Char.MinValue, Gen.choose[Char](Char.MinValue,0xD800-1)),
+ (Char.MaxValue-0xDFFF, Gen.choose[Char](0xDFFF+1,Char.MaxValue))
+ )
+ )
+
+ /** Arbitrary instance of Byte */
+ implicit lazy val arbByte: Arbitrary[Byte] = Arbitrary(
+ Gen.chooseNum(Byte.MinValue, Byte.MaxValue)
+ )
+
+ /** Arbitrary instance of Short */
+ implicit lazy val arbShort: Arbitrary[Short] = Arbitrary(
+ Gen.chooseNum(Short.MinValue, Short.MaxValue)
+ )
+
+ /** Absolutely, totally, 100% arbitrarily chosen Unit. */
+ implicit lazy val arbUnit: Arbitrary[Unit] = Arbitrary(const(()))
+
+ /**** Arbitrary instances of other common types ****/
+
+ /** Arbitrary instance of String */
+ implicit lazy val arbString: Arbitrary[String] =
+ Arbitrary(arbitrary[List[Char]] map (_.mkString))
+
+ /** Arbitrary instance of Date */
+ implicit lazy val arbDate: Arbitrary[Date] = Arbitrary(for {
+ l <- arbitrary[Long]
+ d = new Date
+ } yield new Date(d.getTime + l))
+
+ /** Arbitrary instance of Throwable */
+ implicit lazy val arbThrowable: Arbitrary[Throwable] =
+ Arbitrary(oneOf(const(new Exception), const(new Error)))
+
+ /** Arbitrary instance of Exception */
+ implicit lazy val arbException: Arbitrary[Exception] =
+ Arbitrary(const(new Exception))
+
+ /** Arbitrary instance of Error */
+ implicit lazy val arbError: Arbitrary[Error] =
+ Arbitrary(const(new Error))
+
+ /** Arbitrary BigInt */
+ implicit lazy val arbBigInt: Arbitrary[BigInt] = {
+ def chooseBigInt: Gen[BigInt] =
+ sized((s: Int) => choose(-s, s)) map (x => BigInt(x))
+
+ def chooseReallyBigInt: Gen[BigInt] = for {
+ bi <- chooseBigInt
+ n <- choose(32,128)
+ } yield bi << n
+
+ Arbitrary(
+ frequency(
+ (5, chooseBigInt),
+ (10, chooseReallyBigInt),
+ (1, BigInt(0)),
+ (1, BigInt(1)),
+ (1, BigInt(-1)),
+ (1, BigInt(Int.MaxValue) + 1),
+ (1, BigInt(Int.MinValue) - 1),
+ (1, BigInt(Long.MaxValue)),
+ (1, BigInt(Long.MinValue)),
+ (1, BigInt(Long.MaxValue) + 1),
+ (1, BigInt(Long.MinValue) - 1)
+ )
+ )
+ }
+
+ /** Arbitrary BigDecimal */
+ implicit lazy val arbBigDecimal: Arbitrary[BigDecimal] = {
+ import java.math.MathContext._
+ val mcGen = oneOf(UNLIMITED, DECIMAL32, DECIMAL64, DECIMAL128)
+ val bdGen = for {
+ x <- arbBigInt.arbitrary
+ mc <- mcGen
+ limit <- const(if(mc == UNLIMITED) 0 else math.max(x.abs.toString.length - mc.getPrecision, 0))
+ scale <- Gen.chooseNum(Int.MinValue + limit , Int.MaxValue)
+ } yield {
+ try {
+ BigDecimal(x, scale, mc)
+ } catch {
+ case ae: java.lang.ArithmeticException => BigDecimal(x, scale, UNLIMITED) // Handle the case where scale/precision conflict
+ }
+ }
+ Arbitrary(bdGen)
+ }
+
+ /** Arbitrary java.lang.Number */
+ implicit lazy val arbNumber: Arbitrary[Number] = {
+ val gen = Gen.oneOf(
+ arbitrary[Byte], arbitrary[Short], arbitrary[Int], arbitrary[Long],
+ arbitrary[Float], arbitrary[Double]
+ )
+ Arbitrary(gen map (_.asInstanceOf[Number]))
+ // XXX TODO - restore BigInt and BigDecimal
+ // Arbitrary(oneOf(arbBigInt.arbitrary :: (arbs map (_.arbitrary) map toNumber) : _*))
+ }
+
+ /** Generates an arbitrary property */
+ implicit lazy val arbProp: Arbitrary[Prop] = {
+ import Prop._
+ val undecidedOrPassed = forAll { b: Boolean =>
+ b ==> true
+ }
+ Arbitrary(frequency(
+ (4, falsified),
+ (4, passed),
+ (3, proved),
+ (3, undecidedOrPassed),
+ (2, undecided),
+ (1, exception(null))
+ ))
+ }
+
+ /** Arbitrary instance of test parameters */
+ implicit lazy val arbTestParameters: Arbitrary[Test.Parameters] =
+ Arbitrary(for {
+ _minSuccTests <- choose(10,200)
+ _maxDiscardRatio <- choose(0.2f,10f)
+ _minSize <- choose(0,500)
+ sizeDiff <- choose(0,500)
+ _maxSize <- choose(_minSize, _minSize + sizeDiff)
+ _workers <- choose(1,4)
+ } yield new Test.Parameters.Default {
+ override val minSuccessfulTests = _minSuccTests
+ override val maxDiscardRatio = _maxDiscardRatio
+ override val minSize = _minSize
+ override val maxSize = _maxSize
+ override val workers = _workers
+ })
+
+ /** Arbitrary instance of gen params */
+ implicit lazy val arbGenParams: Arbitrary[Gen.Parameters] =
+ Arbitrary(for {
+ sz <- arbitrary[Int] suchThat (_ >= 0)
+ } yield (new Gen.Parameters.Default {
+ override val size = sz
+ }))
+
+
+ // Higher-order types //
+
+ /** Arbitrary instance of [[org.scalacheck.Gen]] */
+ implicit def arbGen[T](implicit a: Arbitrary[T]): Arbitrary[Gen[T]] =
+ Arbitrary(frequency(
+ (5, arbitrary[T] map (const(_))),
+ (1, Gen.fail)
+ ))
+
+ /** Arbitrary instance of the Option type */
+ implicit def arbOption[T](implicit a: Arbitrary[T]): Arbitrary[Option[T]] =
+ Arbitrary(sized(n =>
+ // When n is larger, make it less likely that we generate None,
+ // but still do it some of the time. When n is zero, we always
+ // generate None, since it's the smallest value.
+ frequency(
+ (n, resize(n / 2, arbitrary[T]).map(Some(_))),
+ (1, const(None)))))
+
+ /** Arbitrary instance of the Either type */
+ implicit def arbEither[T, U](implicit at: Arbitrary[T], au: Arbitrary[U]): Arbitrary[Either[T, U]] =
+ Arbitrary(oneOf(arbitrary[T].map(Left(_)), arbitrary[U].map(Right(_))))
+
+ /** Arbitrary instance of any [[org.scalacheck.util.Buildable]] container
+ * (such as lists, arrays, streams, etc). The maximum size of the container
+ * depends on the size generation parameter. */
+ implicit def arbContainer[C[_],T](implicit
+ a: Arbitrary[T], b: Buildable[T,C], t: C[T] => Traversable[T]
+ ): Arbitrary[C[T]] = Arbitrary(containerOf[C,T](arbitrary[T]))
+
+ /** Arbitrary instance of any [[org.scalacheck.util.Buildable2]] container
+ * (such as maps, etc). The maximum size of the container depends on the size
+ * generation parameter. */
+ implicit def arbContainer2[C[_,_],T,U](implicit
+ a: Arbitrary[(T,U)], b: Buildable2[T,U,C], t: C[T,U] => Traversable[(T,U)]
+ ): Arbitrary[C[T,U]] = Arbitrary(containerOf[C,T,U](arbitrary[(T,U)]))
+
+ // Functions //
+
+ /** Arbitrary instance of Function1 */
+ implicit def arbFunction1[T1,R](implicit a: Arbitrary[R]
+ ): Arbitrary[T1 => R] = Arbitrary(
+ for(r <- arbitrary[R]) yield (t1: T1) => r
+ )
+
+ /** Arbitrary instance of Function2 */
+ implicit def arbFunction2[T1,T2,R](implicit a: Arbitrary[R]
+ ): Arbitrary[(T1,T2) => R] = Arbitrary(
+ for(r <- arbitrary[R]) yield (t1: T1, t2: T2) => r
+ )
+
+ /** Arbitrary instance of Function3 */
+ implicit def arbFunction3[T1,T2,T3,R](implicit a: Arbitrary[R]
+ ): Arbitrary[(T1,T2,T3) => R] = Arbitrary(
+ for(r <- arbitrary[R]) yield (t1: T1, t2: T2, t3: T3) => r
+ )
+
+ /** Arbitrary instance of Function4 */
+ implicit def arbFunction4[T1,T2,T3,T4,R](implicit a: Arbitrary[R]
+ ): Arbitrary[(T1,T2,T3,T4) => R] = Arbitrary(
+ for(r <- arbitrary[R]) yield (t1: T1, t2: T2, t3: T3, t4: T4) => r
+ )
+
+ /** Arbitrary instance of Function5 */
+ implicit def arbFunction5[T1,T2,T3,T4,T5,R](implicit a: Arbitrary[R]
+ ): Arbitrary[(T1,T2,T3,T4,T5) => R] = Arbitrary(
+ for(r <- arbitrary[R]) yield (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) => r
+ )
+
+
+ // Tuples //
+
+ /** Arbitrary instance of 2-tuple */
+ implicit def arbTuple2[T1,T2](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2]
+ ): Arbitrary[(T1,T2)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ } yield (t1,t2))
+
+ /** Arbitrary instance of 3-tuple */
+ implicit def arbTuple3[T1,T2,T3](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3]
+ ): Arbitrary[(T1,T2,T3)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ } yield (t1,t2,t3))
+
+ /** Arbitrary instance of 4-tuple */
+ implicit def arbTuple4[T1,T2,T3,T4](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4]
+ ): Arbitrary[(T1,T2,T3,T4)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ t4 <- arbitrary[T4]
+ } yield (t1,t2,t3,t4))
+
+ /** Arbitrary instance of 5-tuple */
+ implicit def arbTuple5[T1,T2,T3,T4,T5](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5]
+ ): Arbitrary[(T1,T2,T3,T4,T5)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ t4 <- arbitrary[T4]
+ t5 <- arbitrary[T5]
+ } yield (t1,t2,t3,t4,t5))
+
+ /** Arbitrary instance of 6-tuple */
+ implicit def arbTuple6[T1,T2,T3,T4,T5,T6](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5], a6: Arbitrary[T6]
+ ): Arbitrary[(T1,T2,T3,T4,T5,T6)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ t4 <- arbitrary[T4]
+ t5 <- arbitrary[T5]
+ t6 <- arbitrary[T6]
+ } yield (t1,t2,t3,t4,t5,t6))
+
+ /** Arbitrary instance of 7-tuple */
+ implicit def arbTuple7[T1,T2,T3,T4,T5,T6,T7](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7]
+ ): Arbitrary[(T1,T2,T3,T4,T5,T6,T7)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ t4 <- arbitrary[T4]
+ t5 <- arbitrary[T5]
+ t6 <- arbitrary[T6]
+ t7 <- arbitrary[T7]
+ } yield (t1,t2,t3,t4,t5,t6,t7))
+
+ /** Arbitrary instance of 8-tuple */
+ implicit def arbTuple8[T1,T2,T3,T4,T5,T6,T7,T8](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8]
+ ): Arbitrary[(T1,T2,T3,T4,T5,T6,T7,T8)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ t4 <- arbitrary[T4]
+ t5 <- arbitrary[T5]
+ t6 <- arbitrary[T6]
+ t7 <- arbitrary[T7]
+ t8 <- arbitrary[T8]
+ } yield (t1,t2,t3,t4,t5,t6,t7,t8))
+
+ /** Arbitrary instance of 9-tuple */
+ implicit def arbTuple9[T1,T2,T3,T4,T5,T6,T7,T8,T9](implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8],
+ a9: Arbitrary[T9]
+ ): Arbitrary[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] =
+ Arbitrary(for {
+ t1 <- arbitrary[T1]
+ t2 <- arbitrary[T2]
+ t3 <- arbitrary[T3]
+ t4 <- arbitrary[T4]
+ t5 <- arbitrary[T5]
+ t6 <- arbitrary[T6]
+ t7 <- arbitrary[T7]
+ t8 <- arbitrary[T8]
+ t9 <- arbitrary[T9]
+ } yield (t1,t2,t3,t4,t5,t6,t7,t8,t9))
+
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Commands.scala b/src/partest-extras/scala/org/scalacheck/Commands.scala
new file mode 100644
index 0000000000..5ff3a397e5
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Commands.scala
@@ -0,0 +1,146 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+/** See User Guide for usage examples */
+@deprecated("Will be replaced with a new implementation in 1.12.0", "1.11.4")
+trait Commands extends Prop {
+
+ /** The abstract state data type. This type must be immutable.
+ * The state type that encodes the abstract state. The abstract state
+ * should model all the features we need from the real state, the system
+ * under test. We should leave out all details that aren't needed for
+ * specifying our pre- and postconditions. The state type must be called
+ * State and be immutable. */
+ type State <: AnyRef
+
+ class Binding(private val key: State) {
+ def get: Any = bindings.find(_._1 eq key) match {
+ case None => sys.error("No value bound")
+ case Some(x) => x._2
+ }
+ }
+
+ /** Abstract commands are defined as subtypes of the traits Command or SetCommand.
+ * Each command must have a run method and a method that returns the new abstract
+ * state, as it should look after the command has been run.
+ * A command can also define a precondition that states how the current
+ * abstract state must look if the command should be allowed to run.
+ * Finally, we can also define a postcondition which verifies that the
+ * system under test is in a correct state after the command exectution. */
+ trait Command {
+
+ /** Used internally. */
+ protected[Commands] def run_(s: State) = run(s)
+
+ def run(s: State): Any
+ def nextState(s: State): State
+
+ /** Returns all preconditions merged into a single function */
+ def preCondition: (State => Boolean) =
+ s => preConditions.toList.forall(_.apply(s))
+
+ /** A precondition is a function that
+ * takes the current abstract state as parameter and returns a boolean
+ * that says if the precondition is fulfilled or not. You can add several
+ * conditions to the precondition list */
+ val preConditions = new collection.mutable.ListBuffer[State => Boolean]
+
+ /** Returns all postconditions merged into a single function */
+ def postCondition: (State,State,Any) => Prop =
+ (s0,s1,r) => Prop.all(postConditions.map(_.apply(s0,s1,r)): _*)
+
+ /** A postcondition is a function that
+ * takes three parameters, s0, s1 and r. s0 is the abstract state before
+ * the command was run, s1 is the abstract state after the command was
+ * run, and r is the result from the command's run
+ * method. The postcondition function should return a Boolean (or
+ * a Prop instance) that says if the condition holds or not. You can add several
+ * conditions to the postConditions list. */
+ val postConditions = new collection.mutable.ListBuffer[(State,State,Any) => Prop]
+ }
+
+ /** A command that binds its result for later use */
+ trait SetCommand extends Command {
+ /** Used internally. */
+ protected[Commands] final override def run_(s: State) = {
+ val r = run(s)
+ bindings += ((s,r))
+ r
+ }
+
+ final def nextState(s: State) = nextState(s, new Binding(s))
+ def nextState(s: State, b: Binding): State
+ }
+
+ private case class Cmds(cs: List[Command], ss: List[State]) {
+ override def toString = cs.map(_.toString).mkString(", ")
+ }
+
+ private val bindings = new scala.collection.mutable.ListBuffer[(State,Any)]
+
+ private def initState() = {
+ bindings.clear()
+ initialState()
+ }
+
+ private def genCmds: Gen[Cmds] = {
+ def sizedCmds(s: State, sz: Int): Gen[Cmds] = {
+ if(sz <= 0) Gen.const(Cmds(Nil, Nil)) else for {
+ c <- genCommand(s) suchThat (_.preCondition(s))
+ Cmds(cs,ss) <- sizedCmds(c.nextState(s), sz-1)
+ } yield Cmds(c::cs, s::ss)
+ }
+
+ Gen.sized(sz => sizedCmds(initialState(), sz))
+ }
+
+ private def validCmds(s: State, cs: List[Command]): Option[Cmds] =
+ cs match {
+ case Nil => Some(Cmds(Nil, s::Nil))
+ case c::_ if !c.preCondition(s) => None
+ case c::cmds => for {
+ Cmds(_, ss) <- validCmds(c.nextState(s), cmds)
+ } yield Cmds(cs, s::ss)
+ }
+
+ private def runCommands(cmds: Cmds): Prop = Prop.all {
+ cmds.cs.indices.map { i =>
+ val (c,s) = (cmds.cs(i), cmds.ss(i))
+ c.postCondition(s,c.nextState(s),c.run_(s))
+ } : _*
+ }
+
+ private def commandsProp: Prop = {
+ def shrinkCmds(cmds: Cmds) =
+ Shrink.shrink(cmds.cs)(Shrink.shrinkContainer).flatMap { cs =>
+ validCmds(initialState(), cs).toList
+ }
+
+ Prop.forAllShrink(genCmds label "COMMANDS", shrinkCmds)(runCommands _)
+ }
+
+ def apply(p: Gen.Parameters) = commandsProp(p)
+
+ /** initialState should reset the system under test to a well defined
+ * initial state, and return the abstract version of that state. */
+ def initialState(): State
+
+ /** The command generator. Given an abstract state, the generator
+ * should return a command that is allowed to run in that state. Note that
+ * it is still neccessary to define preconditions on the commands if there
+ * are any. The generator is just giving a hint of which commands that are
+ * suitable for a given state, the preconditions will still be checked before
+ * a command runs. Sometimes you maybe want to adjust the distribution of
+ * your command generator according to the state, or do other calculations
+ * based on the state. */
+ def genCommand(s: State): Gen[Command]
+
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Commands2.scala b/src/partest-extras/scala/org/scalacheck/Commands2.scala
new file mode 100644
index 0000000000..67393a7a70
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Commands2.scala
@@ -0,0 +1,150 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+private[scalacheck] trait Commands2 {
+
+ /** The abstract state type. Must be immutable.
+ * The [[Commands2.State]] type should model the state of the system under test (SUT).
+ * It should leave out all details that aren't needed for specifying our
+ * pre- and postconditions. */
+ type State
+
+ /** A type representing one instance of the system under test (SUT).
+ * The [[Commands2.System]] type should be a proxy to the actual system under test.
+ * It is used in the postconditions to verify that the real system
+ * behaves according to specification. It should be possible to have
+ * up to [[Commands2.maxSystemInstanceCount]] co-existing instances of the System
+ * type, and each System instance should be a proxy to a distinct
+ * SUT instance. There should be no dependencies between the System
+ * instances, as they might be used in parallel by ScalaCheck.
+ * System instances are created by [[Commands2.newSystemInstance]] and destroyed by
+ * [[Commands2.destroySystemInstance]]. [[Commands2.newSystemInstance]] and
+ * [[Commands2.destroySystemInstance]] might be called at any time by ScalaCheck,
+ * as long as [[Commands2.maxSystemInstanceCount]] isn't violated. */
+ type System
+
+ /** The maximum number of concurrent [[Commands2.System]] instances allowed to exist. */
+ def maxSystemInstanceCount: Int
+
+ /** Should create a new [[Commands2.System]] instance with an internal state that
+ * corresponds to the provided abstract state instance. The provided state
+ * is guaranteed to fulfill [[Commands2.initialPreCondition]], and
+ * [[Commands2.newSystemInstance]] will never be called if there already
+ * is [[Commands2.maxSystemInstanceCount]] instances of [[Commands2.System]] */
+ def newSystemInstance(state: State): System
+
+ /** Should destroy the given SUT, so that a new [[Commands2.System]] instance can be
+ * created with [[Commands2.newSystemInstance]]. */
+ def destroySystemInstance(system: System): Unit
+
+ /** The precondition for the initial state, when no commands yet have
+ * run. This is used by ScalaCheck when command sequences are shrinked
+ * and the first state might differ from what is returned from
+ * [[Commands2.initialState]]. */
+ def initialPreCondition(state: State): Boolean
+
+ /** A generator that should produce an initial [[Commands2.State]] instance that is
+ * usable by [[Commands2.newSystemInstance]] to create a new system under test.
+ * The state returned by this generator is always checked with the
+ * [[Commands2.initialPreCondition]] method before it is used. */
+ def genInitialState: Gen[State]
+
+ /** A generator that, given the current abstract state, should produce
+ * a suitable Command instance. */
+ def genCommand(state: State): Gen[Command]
+
+ /** Abstract commands are defined as subtypes of the trait [[Commands2.Command]].
+ * Each command must have a run method and a method
+ * that returns the new abstract state, as it is supposed to look after
+ * the command has been run. A command can also define a precondition
+ * that defines how the current abstract state must look if the command
+ * should be allowed to run. Finally, you can also define a postcondition
+ * that verifies that the system under test is in a correct state after
+ * the command execution. */
+ trait Command {
+ /** Runs this command in the system under test,
+ * represented by the provided [[Commands2.System]] instance. This method
+ * can return any value as result. The returned value will be
+ * used by the postcondition to decide if the system behaves as
+ * expected. */
+ def run(state: State, system: System): Any
+
+ /** Returns a new abstract [[Commands2.State]] instance that represents the
+ * state of the system after this command has run. */
+ def nextState(state: State): State
+
+ /** The precondition that decides if this command is allowed to run
+ * when the system under test is in the specified (abstract) state. */
+ def preCondition(state: State): Boolean
+
+ /** The postcondition that decides if the system under test behaved
+ * correctly when the command ran.
+ * @param s0 The abstract state as it looked before this command ran.
+ * @param s1 The abstract state as it looked after this command ran.
+ * @param system The proxy for the system under test. The postcondition
+ * can query the system for its current state, but care must be taken
+ * not to mutate the system under test in any way.
+ * @param result The result returned from the [[Command.run]] method.
+ */
+ def postCondition(s0: State, s1: State, system: System, result: Any): Prop
+ }
+
+/* WIP
+ private case class Cmds(cs: List[Command], ss: List[State]) {
+ override def toString = cs.map(_.toString).mkString(", ")
+ }
+
+ private val bindings = new scala.collection.mutable.ListBuffer[(State,Any)]
+
+ private def initState() = {
+ bindings.clear()
+ initialState()
+ }
+
+ private def genCmds: Gen[Cmds] = {
+ def sizedCmds(s: State, sz: Int): Gen[Cmds] = {
+ if(sz <= 0) Gen.const(Cmds(Nil, Nil)) else for {
+ c <- genCommand(s) suchThat (_.preCondition(s))
+ Cmds(cs,ss) <- sizedCmds(c.nextState(s), sz-1)
+ } yield Cmds(c::cs, s::ss)
+ }
+
+ Gen.sized(sz => sizedCmds(initialState(), sz))
+ }
+
+ private def validCmds(s: State, cs: List[Command]): Option[Cmds] =
+ cs match {
+ case Nil => Some(Cmds(Nil, s::Nil))
+ case c::_ if !c.preCondition(s) => None
+ case c::cmds => for {
+ Cmds(_, ss) <- validCmds(c.nextState(s), cmds)
+ } yield Cmds(cs, s::ss)
+ }
+
+ private def runCommands(cmds: Cmds): Prop = Prop.all {
+ cmds.cs.indices.map { i =>
+ val (c,s) = (cmds.cs(i), cmds.ss(i))
+ c.postCondition(s,c.nextState(s),c.run_(s))
+ } : _*
+ }
+
+ private def commandsProp: Prop = {
+ def shrinkCmds(cmds: Cmds) =
+ Shrink.shrink(cmds.cs)(Shrink.shrinkContainer).flatMap { cs =>
+ validCmds(initialState(), cs).toList
+ }
+
+ Prop.forAllShrink(genCmds label "COMMANDS", shrinkCmds)(runCommands _)
+ }
+
+ def apply(p: Prop.Params) = commandsProp(p)
+*/
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Gen.scala b/src/partest-extras/scala/org/scalacheck/Gen.scala
new file mode 100644
index 0000000000..ba82c9ea95
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Gen.scala
@@ -0,0 +1,813 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import util.{Buildable, Buildable2}
+import scala.collection.immutable.TreeMap
+
+sealed trait Gen[+T] {
+
+ //// Private interface ////
+
+ import Gen.{R, r, gen}
+
+ /** Just an alias */
+ private type P = Gen.Parameters
+
+ /** Should be a copy of R.sieve. Used internally in Gen when some generators
+ * with suchThat-claues are created (when R is not available). This method
+ * actually breaks covariance, but since this method will only ever be
+ * called with a value of exactly type T, it is OK. */
+ protected def sieveCopy(x: Any): Boolean = true
+
+ private[scalacheck] def doApply(p: P): R[T]
+
+
+ //// Public interface ////
+
+ /** A class supporting filtered operations. */
+ final class WithFilter(p: T => Boolean) {
+ def map[U](f: T => U): Gen[U] = Gen.this.suchThat(p).map(f)
+ def flatMap[U](f: T => Gen[U]): Gen[U] = Gen.this.suchThat(p).flatMap(f)
+ def withFilter(q: T => Boolean): WithFilter = Gen.this.withFilter(x => p(x) && q(x))
+ }
+
+ /** Evaluate this generator with the given parameters */
+ def apply(p: Gen.Parameters): Option[T] = doApply(p).retrieve
+
+ /** Create a new generator by mapping the result of this generator */
+ def map[U](f: T => U): Gen[U] = gen { p => doApply(p).map(f) }
+
+ /** Create a new generator by flat-mapping the result of this generator */
+ def flatMap[U](f: T => Gen[U]): Gen[U] = gen { p =>
+ doApply(p).flatMap(t => f(t).doApply(p))
+ }
+
+ /** Create a new generator that uses this generator to produce a value
+ * that fulfills the given condition. If the condition is not fulfilled,
+ * the generator fails (returns None). */
+ def filter(p: T => Boolean): Gen[T] = suchThat(p)
+
+ /** Creates a non-strict filtered version of this generator. */
+ def withFilter(p: T => Boolean): WithFilter = new WithFilter(p)
+
+ /** Create a new generator that uses this generator to produce a value
+ * that fulfills the given condition. If the condition is not fulfilled,
+ * the generator fails (returns None). This method is identical to
+ * [Gen.filter]. */
+ def suchThat(f: T => Boolean): Gen[T] = new Gen[T] {
+ def doApply(p: P) = {
+ val res = Gen.this.doApply(p)
+ res.copy(s = { x:T => res.sieve(x) && f(x) })
+ }
+ override def sieveCopy(x: Any) =
+ try Gen.this.sieveCopy(x) && f(x.asInstanceOf[T])
+ catch { case _: java.lang.ClassCastException => false }
+ }
+
+ /** Create a generator that calls this generator repeatedly until
+ * the given condition is fulfilled. The generated value is then
+ * returned. Use this combinator with care, since it may result
+ * in infinite loops. */
+ def retryUntil(p: T => Boolean): Gen[T] = flatMap { t =>
+ if (p(t)) Gen.const(t).suchThat(p) else retryUntil(p)
+ }
+
+ def sample: Option[T] = doApply(Gen.Parameters.default).retrieve
+
+ /** Returns a new property that holds if and only if both this
+ * and the given generator generates the same result, or both
+ * generators generate no result. */
+ def ==[U](g: Gen[U]) = Prop { prms =>
+ (doApply(prms).retrieve, g.doApply(prms).retrieve) match {
+ case (None,None) => Prop.proved(prms)
+ case (Some(r1),Some(r2)) if r1 == r2 => Prop.proved(prms)
+ case _ => Prop.falsified(prms)
+ }
+ }
+
+ def !=[U](g: Gen[U]) = Prop.forAll(this)(r => Prop.forAll(g)(_ != r))
+
+ def !==[U](g: Gen[U]) = Prop { prms =>
+ (doApply(prms).retrieve, g.doApply(prms).retrieve) match {
+ case (None,None) => Prop.falsified(prms)
+ case (Some(r1),Some(r2)) if r1 == r2 => Prop.falsified(prms)
+ case _ => Prop.proved(prms)
+ }
+ }
+
+ /** Put a label on the generator to make test reports clearer */
+ def label(l: String) = new Gen[T] {
+ def doApply(p: P) = {
+ val r = Gen.this.doApply(p)
+ r.copy(l = r.labels + l)
+ }
+ override def sieveCopy(x: Any) = Gen.this.sieveCopy(x)
+ }
+
+ /** Put a label on the generator to make test reports clearer */
+ def :|(l: String) = label(l)
+
+ /** Put a label on the generator to make test reports clearer */
+ def |:(l: String) = label(l)
+
+ /** Put a label on the generator to make test reports clearer */
+ def :|(l: Symbol) = label(l.toString.drop(1))
+
+ /** Put a label on the generator to make test reports clearer */
+ def |:(l: Symbol) = label(l.toString.drop(1))
+
+}
+
+object Gen {
+
+ //// Private interface ////
+
+ import Arbitrary.arbitrary
+
+ /** Just an alias */
+ private type P = Parameters
+
+ private[scalacheck] trait R[+T] {
+ def labels: Set[String] = Set()
+ def sieve[U >: T]: U => Boolean = _ => true
+ protected def result: Option[T]
+
+ def retrieve = result.filter(sieve)
+
+ def copy[U >: T](
+ l: Set[String] = this.labels,
+ s: U => Boolean = this.sieve,
+ r: Option[U] = this.result
+ ): R[U] = new R[U] {
+ override val labels = l
+ override def sieve[V >: U] = { x:Any =>
+ try s(x.asInstanceOf[U])
+ catch { case _: java.lang.ClassCastException => false }
+ }
+ val result = r
+ }
+
+ def map[U](f: T => U): R[U] = r(retrieve.map(f)).copy(l = labels)
+
+ def flatMap[U](f: T => R[U]): R[U] = retrieve match {
+ case None => r(None).copy(l = labels)
+ case Some(t) =>
+ val r = f(t)
+ r.copy(l = labels ++ r.labels)
+ }
+ }
+
+ private[scalacheck] def r[T](r: Option[T]): R[T] = new R[T] {
+ val result = r
+ }
+
+ /** Generator factory method */
+ private[scalacheck] def gen[T](f: P => R[T]): Gen[T] = new Gen[T] {
+ def doApply(p: P) = f(p)
+ }
+
+ //// Public interface ////
+
+ /** Generator parameters, used by [[org.scalacheck.Gen.apply]] */
+ trait Parameters {
+
+ /** The size of the generated value. Generator implementations are allowed
+ * to freely interpret (or ignore) this value. During test execution, the
+ * value of this parameter is controlled by [[Test.Parameters.minSize]] and
+ * [[Test.Parameters.maxSize]]. */
+ val size: Int
+
+ /** Create a copy of this [[Gen.Parameters]] instance with
+ * [[Gen.Parameters.size]] set to the specified value. */
+ def withSize(size: Int): Parameters = cp(size = size)
+
+ /** The random number generator used. */
+ val rng: scala.util.Random
+
+ /** Create a copy of this [[Gen.Parameters]] instance with
+ * [[Gen.Parameters.rng]] set to the specified value. */
+ def withRng(rng: scala.util.Random): Parameters = cp(rng = rng)
+
+ /** Change the size parameter.
+ * @deprecated Use [[Gen.Parameters.withSize]] instead. */
+ @deprecated("Use withSize instead.", "1.11.2")
+ def resize(newSize: Int): Parameters = withSize(newSize)
+
+ // private since we can't guarantee binary compatibility for this one
+ private case class cp(
+ size: Int = size,
+ rng: scala.util.Random = rng
+ ) extends Parameters
+ }
+
+ /** Provides methods for creating [[org.scalacheck.Gen.Parameters]] values */
+ object Parameters {
+ /** Default generator parameters trait. This can be overriden if you
+ * need to tweak the parameters. */
+ trait Default extends Parameters {
+ val size: Int = 100
+ val rng: scala.util.Random = scala.util.Random
+ }
+
+ /** Default generator parameters instance. */
+ val default: Parameters = new Default {}
+ }
+
+ /** A wrapper type for range types */
+ trait Choose[T] {
+ /** Creates a generator that returns a value in the given inclusive range */
+ def choose(min: T, max: T): Gen[T]
+ }
+
+ /** Provides implicit [[org.scalacheck.Gen.Choose]] instances */
+ object Choose {
+
+ private def chLng(l: Long, h: Long)(p: P): R[Long] = {
+ if (h < l) r(None) else {
+ val d = h - l + 1
+ if (d <= 0) {
+ var n = p.rng.nextLong
+ while (n < l || n > h) {
+ n = p.rng.nextLong
+ }
+ r(Some(n))
+ } else {
+ r(Some(l + math.abs(p.rng.nextLong % d)))
+ }
+ }
+ }
+
+ private def chDbl(l: Double, h: Double)(p: P): R[Double] = {
+ val d = h-l
+ if (d < 0 || d > Double.MaxValue) r(None)
+ else if (d == 0) r(Some(l))
+ else r(Some(p.rng.nextDouble * (h-l) + l))
+ }
+
+ implicit val chooseLong: Choose[Long] = new Choose[Long] {
+ def choose(low: Long, high: Long) =
+ gen(chLng(low,high)).suchThat(x => x >= low && x <= high)
+ }
+ implicit val chooseInt: Choose[Int] = new Choose[Int] {
+ def choose(low: Int, high: Int) =
+ gen(chLng(low,high)).map(_.toInt).suchThat(x => x >= low && x <= high)
+ }
+ implicit val chooseByte: Choose[Byte] = new Choose[Byte] {
+ def choose(low: Byte, high: Byte) =
+ gen(chLng(low,high)).map(_.toByte).suchThat(x => x >= low && x <= high)
+ }
+ implicit val chooseShort: Choose[Short] = new Choose[Short] {
+ def choose(low: Short, high: Short) =
+ gen(chLng(low,high)).map(_.toShort).suchThat(x => x >= low && x <= high)
+ }
+ implicit val chooseChar: Choose[Char] = new Choose[Char] {
+ def choose(low: Char, high: Char) =
+ gen(chLng(low,high)).map(_.toChar).suchThat(x => x >= low && x <= high)
+ }
+ implicit val chooseDouble: Choose[Double] = new Choose[Double] {
+ def choose(low: Double, high: Double) =
+ gen(chDbl(low,high)).suchThat(x => x >= low && x <= high)
+ }
+ implicit val chooseFloat: Choose[Float] = new Choose[Float] {
+ def choose(low: Float, high: Float) =
+ gen(chDbl(low,high)).map(_.toFloat).suchThat(x => x >= low && x <= high)
+ }
+
+ /** Transform a Choose[T] to a Choose[U] where T and U are two isomorphic types
+ * whose relationship is described by the provided transformation functions.
+ * (exponential functor map) */
+ def xmap[T, U](from: T => U, to: U => T)(implicit c: Choose[T]): Choose[U] = new Choose[U] {
+ def choose(low: U, high: U) =
+ c.choose(to(low), to(high)).map(from)
+ }
+ }
+
+
+ //// Various Generator Combinators ////
+
+ /** A generator that always generates the given value */
+ @deprecated("Use Gen.const instead", "1.11.0")
+ def value[T](x: T): Gen[T] = const(x)
+
+ /** A generator that always generates the given value */
+ implicit def const[T](x: T): Gen[T] = gen(_ => r(Some(x))).suchThat(_ == x)
+
+ /** A generator that never generates a value */
+ def fail[T]: Gen[T] = gen(_ => r(None)).suchThat(_ => false)
+
+ /** A generator that generates a random value in the given (inclusive)
+ * range. If the range is invalid, the generator will not generate
+ * any value. */
+ def choose[T](min: T, max: T)(implicit c: Choose[T]): Gen[T] =
+ c.choose(min, max)
+
+ /** Sequences generators. If any of the given generators fails, the
+ * resulting generator will also fail. */
+ def sequence[C[_],T](gs: Traversable[Gen[T]])(implicit b: Buildable[T,C]): Gen[C[T]] = {
+ val g = gen { p =>
+ gs.foldLeft(r(Some(collection.immutable.Vector.empty[T]))) {
+ case (rs,g) => g.doApply(p).flatMap(r => rs.map(_ :+ r))
+ }
+ }
+ g.map(b.fromIterable)
+ }
+
+ /** Sequences generators. If any of the given generators fails, the
+ * resulting generator will also fail. */
+ def sequence[C[_,_],T,U](gs: Traversable[Gen[(T,U)]])(implicit b: Buildable2[T,U,C]): Gen[C[T,U]] = {
+ val g = gen { p =>
+ gs.foldLeft(r(Some(collection.immutable.Vector.empty[(T,U)]))) {
+ case (rs,g) => g.doApply(p).flatMap(r => rs.map(_ :+ r))
+ }
+ }
+ g.map(b.fromIterable)
+ }
+
+ /** Wraps a generator lazily. The given parameter is only evaluated once,
+ * and not until the wrapper generator is evaluated. */
+ def lzy[T](g: => Gen[T]): Gen[T] = {
+ lazy val h = g
+ gen { p => h.doApply(p) }
+ }
+
+ /** Wraps a generator for later evaluation. The given parameter is
+ * evaluated each time the wrapper generator is evaluated. */
+ def wrap[T](g: => Gen[T]) = gen { p => g.doApply(p) }
+
+ /** Creates a generator that can access its generation parameters */
+ def parameterized[T](f: Parameters => Gen[T]) = gen { p => f(p).doApply(p) }
+
+ /** Creates a generator that can access its generation size */
+ def sized[T](f: Int => Gen[T]) = gen { p => f(p.size).doApply(p) }
+
+ /** A generator that returns the current generation size */
+ lazy val size: Gen[Int] = sized { sz => sz }
+
+ /** Creates a resized version of a generator */
+ def resize[T](s: Int, g: Gen[T]) = gen(p => g.doApply(p.withSize(s)))
+
+ /** Picks a random value from a list */
+ def oneOf[T](xs: Seq[T]): Gen[T] =
+ choose(0, xs.size-1).map(xs(_)).suchThat(xs.contains)
+
+ /** Picks a random value from a list */
+ def oneOf[T](t0: T, t1: T, tn: T*): Gen[T] = oneOf(t0 +: t1 +: tn)
+
+ /** Picks a random generator from a list */
+ def oneOf[T](g0: Gen[T], g1: Gen[T], gn: Gen[T]*): Gen[T] = {
+ val gs = g0 +: g1 +: gn
+ choose(0,gs.size-1).flatMap(gs(_)).suchThat(x => gs.exists(_.sieveCopy(x)))
+ }
+
+ /** Makes a generator result optional. Either `Some(T)` or `None` will be provided. */
+ def option[T](g: Gen[T]): Gen[Option[T]] =
+ oneOf[Option[T]](g.map(Some.apply), None)
+
+ /** Chooses one of the given generators with a weighted random distribution */
+ def frequency[T](gs: (Int,Gen[T])*): Gen[T] = {
+ gs.filter(_._1 > 0) match {
+ case Nil => fail
+ case filtered =>
+ var tot = 0l
+ val tree: TreeMap[Long, Gen[T]] = {
+ val builder = TreeMap.newBuilder[Long, Gen[T]]
+ filtered.foreach {
+ case (f, v) =>
+ tot += f
+ builder.+=((tot, v))
+ }
+ builder.result()
+ }
+ choose(1L, tot).flatMap(r => tree.from(r).head._2).suchThat { x =>
+ gs.exists(_._2.sieveCopy(x))
+ }
+ }
+ }
+
+ /** Implicit convenience method for using the `frequency` method
+ * like this:
+ * {{{
+ * frequency((1, "foo"), (3, "bar"))
+ * }}}
+ */
+ implicit def freqTuple[T](t: (Int,T)): (Int,Gen[T]) = (t._1, const(t._2))
+
+
+ //// List Generators ////
+
+ /** Generates a container of any Traversable type for which there exists an
+ * implicit [[org.scalacheck.util.Buildable]] instance. The elements in the
+ * container will be generated by the given generator. The size of the
+ * generated container is limited by `n`. Depending on what kind of container
+ * that is generated, the resulting container may contain fewer elements than
+ * `n`, but not more. If the given generator fails generating a value, the
+ * complete container generator will also fail. */
+ def containerOfN[C[_],T](n: Int, g: Gen[T])(implicit
+ evb: Buildable[T,C], evt: C[T] => Traversable[T]
+ ): Gen[C[T]] =
+ sequence[C,T](Traversable.fill(n)(g)) suchThat { c =>
+ // TODO: Can we guarantee c.size == n (See issue #89)?
+ c.forall(g.sieveCopy)
+ }
+
+ /** Generates a container of any Traversable type for which there exists an
+ * implicit [[org.scalacheck.util.Buildable]] instance. The elements in the
+ * container will be generated by the given generator. The size of the
+ * container is bounded by the size parameter used when generating values. */
+ def containerOf[C[_],T](g: Gen[T])(implicit
+ evb: Buildable[T,C], evt: C[T] => Traversable[T]
+ ): Gen[C[T]] =
+ sized(s => choose(0,s).flatMap(containerOfN[C,T](_,g))) suchThat { c =>
+ c.forall(g.sieveCopy)
+ }
+
+ /** Generates a non-empty container of any Traversable type for which there
+ * exists an implicit [[org.scalacheck.util.Buildable]] instance. The
+ * elements in the container will be generated by the given generator. The
+ * size of the container is bounded by the size parameter used when
+ * generating values. */
+ def nonEmptyContainerOf[C[_],T](g: Gen[T])(implicit
+ evb: Buildable[T,C], evt: C[T] => Traversable[T]
+ ): Gen[C[T]] =
+ sized(s => choose(1,s).flatMap(containerOfN[C,T](_,g))) suchThat { c =>
+ c.size > 0 && c.forall(g.sieveCopy)
+ }
+
+ /** Generates a non-empty container of any Traversable type for which there
+ * exists an implicit [[org.scalacheck.util.Buildable]] instance. The
+ * elements in the container will be generated by the given generator. The
+ * size of the container is bounded by the size parameter used when
+ * generating values. */
+ @deprecated("Use Gen.nonEmptyContainerOf instead", "1.11.0")
+ def containerOf1[C[_],T](g: Gen[T])(implicit
+ evb: Buildable[T,C], evt: C[T] => Traversable[T]
+ ): Gen[C[T]] = nonEmptyContainerOf[C,T](g)
+
+ /** Generates a container of any Traversable type for which there exists an
+ * implicit [[org.scalacheck.util.Buildable2]] instance. The elements in
+ * container will be generated by the given generator. The size of the
+ * generated container is limited by `n`. Depending on what kind of container
+ * that is generated, the resulting container may contain fewer elements than
+ * `n`, but not more. If the given generator fails generating a value, the
+ * complete container generator will also fail. */
+ def containerOfN[C[_,_],T,U](n: Int, g: Gen[(T,U)])(implicit
+ evb: Buildable2[T,U,C], evt: C[T,U] => Traversable[(T,U)]
+ ): Gen[C[T,U]] =
+ sequence[C,T,U](Traversable.fill(n)(g)).suchThat { c =>
+ // TODO: Can we guarantee c.size == n (See issue #89)?
+ c.forall(g.sieveCopy)
+ }
+
+ /** Generates a container of any Traversable type for which there exists
+ * an implicit <code>Buildable2</code> instance. The elements in the
+ * container will be generated by the given generator. The size of the
+ * container is bounded by the size parameter used when generating values. */
+ def containerOf[C[_,_],T,U](g: Gen[(T,U)])(implicit
+ evb: Buildable2[T,U,C], evt: C[T,U] => Traversable[(T,U)]
+ ): Gen[C[T,U]] =
+ sized(s => choose(0,s).flatMap(containerOfN[C,T,U](_,g))) suchThat { c =>
+ c.forall(g.sieveCopy)
+ }
+
+ /** Generates a non-empty container of any type for which there exists an
+ * implicit <code>Buildable2</code> instance. The elements in the container
+ * will be generated by the given generator. The size of the container is
+ * bounded by the size parameter used when generating values. */
+ def nonEmptyContainerOf[C[_,_],T,U](g: Gen[(T,U)])(implicit
+ evb: Buildable2[T,U,C], evt: C[T,U] => Traversable[(T,U)]
+ ): Gen[C[T,U]] =
+ sized(s => choose(1,s).flatMap(containerOfN[C,T,U](_,g))) suchThat { c =>
+ c.size > 0 && c.forall(g.sieveCopy)
+ }
+
+ /** Generates a list of random length. The maximum length depends on the
+ * size parameter. This method is equal to calling
+ * `containerOf[List,T](g)`. */
+ def listOf[T](g: => Gen[T]) = containerOf[List,T](g)
+
+ /** Generates a non-empty list of random length. The maximum length depends
+ * on the size parameter. This method is equal to calling
+ * `nonEmptyContainerOf[List,T](g)`. */
+ def nonEmptyListOf[T](g: => Gen[T]) = nonEmptyContainerOf[List,T](g)
+
+ /** Generates a non-empty list of random length. The maximum length depends
+ * on the size parameter. This method is equal to calling
+ * `nonEmptyContainerOf[List,T](g)`. */
+ @deprecated("Use Gen.nonEmptyListOf instead", "1.11.0")
+ def listOf1[T](g: => Gen[T]) = nonEmptyListOf[T](g)
+
+ /** Generates a list of the given length. This method is equal to calling
+ * `containerOfN[List,T](n,g)`. */
+ def listOfN[T](n: Int, g: Gen[T]) = containerOfN[List,T](n,g)
+
+ /** Generates a map of random length. The maximum length depends on the
+ * size parameter. This method is equal to calling
+ * <code>containerOf[Map,T,U](g)</code>. */
+ def mapOf[T,U](g: => Gen[(T,U)]) = containerOf[Map,T,U](g)
+
+ /** Generates a non-empty map of random length. The maximum length depends
+ * on the size parameter. This method is equal to calling
+ * <code>nonEmptyContainerOf[Map,T,U](g)</code>. */
+ def nonEmptyMap[T,U](g: => Gen[(T,U)]) = nonEmptyContainerOf[Map,T,U](g)
+
+ /** Generates a map of with at least the given number of elements. This method
+ * is equal to calling <code>containerOfN[Map,T,U](n,g)</code>. */
+ def mapOfN[T,U](n: Int, g: Gen[(T,U)]) = containerOfN[Map,T,U](n,g)
+
+ /** A generator that picks a random number of elements from a list */
+ def someOf[T](l: Iterable[T]) = choose(0,l.size).flatMap(pick(_,l))
+
+ /** A generator that picks a random number of elements from a list */
+ def someOf[T](g1: Gen[T], g2: Gen[T], gs: Gen[T]*) =
+ choose(0, gs.length+2).flatMap(pick(_, g1, g2, gs: _*))
+
+ /** A generator that picks a given number of elements from a list, randomly */
+ def pick[T](n: Int, l: Iterable[T]): Gen[Seq[T]] =
+ if(n > l.size || n < 0) fail
+ else (gen { p =>
+ val b = new collection.mutable.ListBuffer[T]
+ b ++= l
+ while(b.length > n) b.remove(choose(0, b.length-1).doApply(p).retrieve.get)
+ r(Some(b))
+ }).suchThat(_.forall(x => l.exists(x == _)))
+
+ /** A generator that picks a given number of elements from a list, randomly */
+ def pick[T](n: Int, g1: Gen[T], g2: Gen[T], gn: Gen[T]*): Gen[Seq[T]] = {
+ val gs = g1 +: g2 +: gn
+ pick(n, 0 until gs.size).flatMap(idxs =>
+ sequence[List,T](idxs.toList.map(gs(_)))
+ ).suchThat(_.forall(x => gs.exists(_.sieveCopy(x))))
+ }
+
+
+ //// Character Generators ////
+
+ /** Generates a numerical character */
+ def numChar: Gen[Char] = choose(48.toChar, 57.toChar)
+
+ /** Generates an upper-case alpha character */
+ def alphaUpperChar: Gen[Char] = choose(65.toChar, 90.toChar)
+
+ /** Generates a lower-case alpha character */
+ def alphaLowerChar: Gen[Char] = choose(97.toChar, 122.toChar)
+
+ /** Generates an alpha character */
+ def alphaChar = frequency((1,alphaUpperChar), (9,alphaLowerChar))
+
+ /** Generates an alphanumerical character */
+ def alphaNumChar = frequency((1,numChar), (9,alphaChar))
+
+
+ //// String Generators ////
+
+ /** Generates a string that starts with a lower-case alpha character,
+ * and only contains alphanumerical characters */
+ def identifier: Gen[String] = (for {
+ c <- alphaLowerChar
+ cs <- listOf(alphaNumChar)
+ } yield (c::cs).mkString).suchThat(_.forall(c => c.isLetter || c.isDigit))
+
+ /** Generates a string of alpha characters */
+ def alphaStr: Gen[String] =
+ listOf(alphaChar).map(_.mkString).suchThat(_.forall(_.isLetter))
+
+ /** Generates a string of digits */
+ def numStr: Gen[String] =
+ listOf(numChar).map(_.mkString).suchThat(_.forall(_.isDigit))
+
+
+ //// Number Generators ////
+
+ /** Generates positive numbers of uniform distribution, with an
+ * upper bound of the generation size parameter. */
+ def posNum[T](implicit num: Numeric[T], c: Choose[T]): Gen[T] = {
+ import num._
+ sized(max => c.choose(one, fromInt(max)))
+ }
+
+ /** Generates negative numbers of uniform distribution, with an
+ * lower bound of the negated generation size parameter. */
+ def negNum[T](implicit num: Numeric[T], c: Choose[T]): Gen[T] = {
+ import num._
+ sized(max => c.choose(-fromInt(max), -one))
+ }
+
+ /** Generates numbers within the given inclusive range, with
+ * extra weight on zero, +/- unity, both extremities, and any special
+ * numbers provided. The special numbers must lie within the given range,
+ * otherwise they won't be included. */
+ def chooseNum[T](minT: T, maxT: T, specials: T*)(
+ implicit num: Numeric[T], c: Choose[T]
+ ): Gen[T] = {
+ import num._
+ val basics = List(minT, maxT, zero, one, -one)
+ val basicsAndSpecials = for {
+ t <- specials ++ basics if t >= minT && t <= maxT
+ } yield (1, const(t))
+ val allGens = basicsAndSpecials ++ List(
+ (basicsAndSpecials.length, c.choose(minT, maxT))
+ )
+ frequency(allGens: _*)
+ }
+
+ /** Generates a version 4 (random) UUID. */
+ lazy val uuid: Gen[java.util.UUID] = for {
+ l1 <- Gen.choose(Long.MinValue, Long.MaxValue)
+ l2 <- Gen.choose(Long.MinValue, Long.MaxValue)
+ y <- Gen.oneOf('8', '9', 'a', 'b')
+ } yield java.util.UUID.fromString(
+ new java.util.UUID(l1,l2).toString.updated(14, '4').updated(19, y)
+ )
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2](g1: Gen[T1], g2: Gen[T2]): Gen[(T1,T2)] = {
+ val g = for {
+ t1 <- g1; t2 <- g2
+ } yield (t1,t2)
+ g.suchThat { case (t1,t2) => g1.sieveCopy(t1) && g2.sieveCopy(t2) }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3]): Gen[(T1,T2,T3)] = {
+ val g0 = zip(g1,g2)
+ val g = for {
+ (t1,t2) <- g0; t3 <- g3
+ } yield (t1,t2,t3)
+ g.suchThat { case (t1,t2,t3) => g0.sieveCopy(t1,t2) && g3.sieveCopy(t3) }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3,T4](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4]
+ ): Gen[(T1,T2,T3,T4)] = {
+ val g0 = zip(g1,g2,g3)
+ val g = for {
+ (t1,t2,t3) <- g0; t4 <- g4
+ } yield (t1,t2,t3,t4)
+ g.suchThat { case (t1,t2,t3,t4) => g0.sieveCopy(t1,t2,t3) && g4.sieveCopy(t4) }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3,T4,T5](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4],
+ g5: Gen[T5]
+ ): Gen[(T1,T2,T3,T4,T5)] = {
+ val g0 = zip(g1,g2,g3,g4)
+ val g = for {
+ (t1,t2,t3,t4) <- g0; t5 <- g5
+ } yield (t1,t2,t3,t4,t5)
+ g.suchThat { case (t1,t2,t3,t4,t5) =>
+ g0.sieveCopy(t1,t2,t3,t4) && g5.sieveCopy(t5)
+ }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3,T4,T5,T6](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4],
+ g5: Gen[T5], g6: Gen[T6]
+ ): Gen[(T1,T2,T3,T4,T5,T6)] = {
+ val g0 = zip(g1,g2,g3,g4,g5)
+ val g = for {
+ (t1,t2,t3,t4,t5) <- g0; t6 <- g6
+ } yield (t1,t2,t3,t4,t5,t6)
+ g.suchThat { case (t1,t2,t3,t4,t5,t6) =>
+ g0.sieveCopy(t1,t2,t3,t4,t5) && g6.sieveCopy(t6)
+ }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3,T4,T5,T6,T7](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3],
+ g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7]
+ ): Gen[(T1,T2,T3,T4,T5,T6,T7)] = {
+ val g0 = zip(g1,g2,g3,g4,g5,g6)
+ val g = for {
+ (t1,t2,t3,t4,t5,t6) <- g0; t7 <- g7
+ } yield (t1,t2,t3,t4,t5,t6,t7)
+ g.suchThat { case (t1,t2,t3,t4,t5,t6,t7) =>
+ g0.sieveCopy(t1,t2,t3,t4,t5,t6) && g7.sieveCopy(t7)
+ }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3,T4,T5,T6,T7,T8](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3],
+ g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8]
+ ): Gen[(T1,T2,T3,T4,T5,T6,T7,T8)] = {
+ val g0 = zip(g1,g2,g3,g4,g5,g6,g7)
+ val g = for {
+ (t1,t2,t3,t4,t5,t6,t7) <- g0; t8 <- g8
+ } yield (t1,t2,t3,t4,t5,t6,t7,t8)
+ g.suchThat { case (t1,t2,t3,t4,t5,t6,t7,t8) =>
+ g0.sieveCopy(t1,t2,t3,t4,t5,t6,t7) && g8.sieveCopy(t8)
+ }
+ }
+
+ /** Combines the given generators into one generator that produces a
+ * tuple of their generated values. */
+ def zip[T1,T2,T3,T4,T5,T6,T7,T8,T9](g1: Gen[T1], g2: Gen[T2], g3: Gen[T3],
+ g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8], g9: Gen[T9]
+ ): Gen[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] = {
+ val g0 = zip(g1,g2,g3,g4,g5,g6,g7,g8)
+ val g = for {
+ (t1,t2,t3,t4,t5,t6,t7,t8) <- g0; t9 <- g9
+ } yield (t1,t2,t3,t4,t5,t6,t7,t8,t9)
+ g.suchThat { case (t1,t2,t3,t4,t5,t6,t7,t8,t9) =>
+ g0.sieveCopy(t1,t2,t3,t4,t5,t6,t7,t8) && g9.sieveCopy(t9)
+ }
+ }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T,R](f: T => R)(implicit a: Arbitrary[T]): Gen[R] =
+ arbitrary[T] map f
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,R](f: (T1,T2) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2]
+ ): Gen[R] = arbitrary[T1] flatMap { t => resultOf(f(t, _:T2)) }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,R](f: (T1,T2,T3) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3]
+ ): Gen[R] = arbitrary[T1] flatMap { t => resultOf(f(t, _:T2, _:T3)) }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,T4,R](f: (T1,T2,T3,T4) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4]
+ ): Gen[R] = arbitrary[T1] flatMap {
+ t => resultOf(f(t, _:T2, _:T3, _:T4))
+ }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,T4,T5,R](f: (T1,T2,T3,T4,T5) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5]
+ ): Gen[R] = arbitrary[T1] flatMap {
+ t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5))
+ }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,T4,T5,T6,R](
+ f: (T1,T2,T3,T4,T5,T6) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3],
+ a4: Arbitrary[T4], a5: Arbitrary[T5], a6: Arbitrary[T6]
+ ): Gen[R] = arbitrary[T1] flatMap {
+ t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6))
+ }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,T4,T5,T6,T7,R](
+ f: (T1,T2,T3,T4,T5,T6,T7) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3],
+ a4: Arbitrary[T4], a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7]
+ ): Gen[R] = arbitrary[T1] flatMap {
+ t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7))
+ }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,T4,T5,T6,T7,T8,R](
+ f: (T1,T2,T3,T4,T5,T6,T7,T8) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8]
+ ): Gen[R] = arbitrary[T1] flatMap {
+ t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8))
+ }
+
+ /** Takes a function and returns a generator that generates arbitrary
+ * results of that function by feeding it with arbitrarily generated input
+ * parameters. */
+ def resultOf[T1,T2,T3,T4,T5,T6,T7,T8,T9,R](
+ f: (T1,T2,T3,T4,T5,T6,T7,T8,T9) => R)(implicit
+ a1: Arbitrary[T1], a2: Arbitrary[T2], a3: Arbitrary[T3], a4: Arbitrary[T4],
+ a5: Arbitrary[T5], a6: Arbitrary[T6], a7: Arbitrary[T7], a8: Arbitrary[T8],
+ a9: Arbitrary[T9]
+ ): Gen[R] = arbitrary[T1] flatMap {
+ t => resultOf(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8, _:T9))
+ }
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Prop.scala b/src/partest-extras/scala/org/scalacheck/Prop.scala
new file mode 100644
index 0000000000..6b607002fd
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Prop.scala
@@ -0,0 +1,953 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import util.{Pretty, FreqMap, Buildable, ConsoleReporter}
+import scala.annotation.tailrec
+
+trait Prop {
+
+ import Prop.{Result, Proof, True, False, Exception, Undecided,
+ provedToTrue, secure, mergeRes}
+ import Gen.Parameters
+
+ def apply(prms: Parameters): Result
+
+ def map(f: Result => Result): Prop = Prop(prms => f(this(prms)))
+
+ def flatMap(f: Result => Prop): Prop = Prop(prms => f(this(prms))(prms))
+
+ // TODO In 1.12.0, make p call-by-name, and remove the calls to secure()
+ // in the methods that use combine()
+ def combine(p: Prop)(f: (Result, Result) => Result) =
+ for(r1 <- this; r2 <- p) yield f(r1,r2)
+
+ /** Convenience method that checks this property with the given parameters
+ * and reports the result on the console. */
+ def check(prms: Test.Parameters): Unit = Test.check(
+ if(prms.testCallback.isInstanceOf[ConsoleReporter]) prms
+ else prms.withTestCallback(prms.testCallback.chain(ConsoleReporter(1))),
+ this
+ )
+
+ /** Convenience method that checks this property and reports the
+ * result on the console. The default test parameters
+ * ([[Test.Parameters.default]]) are used for the check. */
+ def check: Unit = check(Test.Parameters.default)
+
+ /** Convenience method that checks this property and reports the result
+ * on the console. The provided argument should be a function that takes
+ * the default test parameters ([[Test.Parameters.default]])
+ * as input and outputs a modified [[Test.Parameters]] instance that
+ * Example use:
+ *
+ * {{{
+ * p.check(_.withMinSuccessfulTests(500))
+
+ * p.check { _.
+ * withMinSuccessfulTests(80000).
+ * withWorkers(4)
+ * }
+ * }}}
+ */
+ def check(paramFun: Test.Parameters => Test.Parameters): Unit = check(
+ paramFun(Test.Parameters.default)
+ )
+
+ /** Convenience method that checks this property with specified minimal
+ * number of successful test and the given testing parameters, and
+ * reports the result on the console. If you need to get the results
+ * from the test use the `check` methods in [[org.scalacheck.Test]]
+ * instead. */
+ @deprecated("Use check(prms.withMinSuccessfulTests(n)) instead", "1.11.2")
+ def check(minSuccessfulTests: Int, prms: Test.Parameters): Unit = check(
+ prms.withMinSuccessfulTests(minSuccessfulTests)
+ )
+
+ /** Convenience method that checks this property with specified minimal
+ * number of successful test and reports the result on the console.
+ * If you need to get the results from the test use
+ * the `check` methods in [[org.scalacheck.Test]] instead. */
+ @deprecated("Use check(_.withMinSuccessfulTests(n)) instead", "1.11.2")
+ def check(minSuccessfulTests: Int): Unit = check(
+ _.withMinSuccessfulTests(minSuccessfulTests)
+ )
+
+ /** The logic for main, separated out to make it easier to
+ * avoid System.exit calls. Returns exit code.
+ */
+ def mainRunner(args: Array[String]): Int = {
+ Test.parseParams(args) match {
+ case Some(params) =>
+ if (Test.check(params, this).passed) 0
+ else 1
+ case None =>
+ println("Incorrect options")
+ -1
+ }
+ }
+
+ /** Whether main should call System.exit with an exit code.
+ * Defaults to true; override to change. */
+ def mainCallsExit = true
+
+ /** Convenience method that makes it possible to use this property
+ * as an application that checks itself on execution */
+ def main(args: Array[String]): Unit = {
+ val code = mainRunner(args)
+ if (mainCallsExit && code != 0)
+ System exit code
+ }
+
+ /** Returns a new property that holds if and only if both this
+ * and the given property hold. If one of the properties doesn't
+ * generate a result, the new property will generate false. */
+ def &&(p: => Prop) = combine(secure(p))(_ && _)
+
+ /** Returns a new property that holds if either this
+ * or the given property (or both) hold. */
+ def ||(p: => Prop) = combine(secure(p))(_ || _)
+
+ /** Returns a new property that holds if and only if both this
+ * and the given property hold. If one of the properties doesn't
+ * generate a result, the new property will generate the same result
+ * as the other property. */
+ def ++(p: => Prop): Prop = combine(secure(p))(_ ++ _)
+
+ /** Combines two properties through implication */
+ def ==>(p: => Prop): Prop = flatMap { r1 =>
+ if(r1.proved) p map { r2 => mergeRes(r1,r2,r2.status) }
+ else if(!r1.success) Prop(r1.copy(status = Undecided))
+ else p map { r2 => provedToTrue(mergeRes(r1,r2,r2.status)) }
+ }
+
+ /** Returns a new property that holds if and only if both this
+ * and the given property generates a result with the exact
+ * same status. Note that this means that if one of the properties is
+ * proved, and the other one passed, then the resulting property
+ * will fail. */
+ def ==(p: => Prop) = this.flatMap { r1 =>
+ p.map { r2 =>
+ mergeRes(r1, r2, if(r1.status == r2.status) True else False)
+ }
+ }
+
+ override def toString = "Prop"
+
+ /** Put a label on the property to make test reports clearer */
+ def label(l: String) = map(_.label(l))
+
+ /** Put a label on the property to make test reports clearer */
+ def :|(l: String) = label(l)
+
+ /** Put a label on the property to make test reports clearer */
+ def |:(l: String) = label(l)
+
+ /** Put a label on the property to make test reports clearer */
+ def :|(l: Symbol) = label(l.toString.drop(1))
+
+ /** Put a label on the property to make test reports clearer */
+ def |:(l: Symbol) = label(l.toString.drop(1))
+
+}
+
+object Prop {
+
+ import Gen.{value, fail, frequency, oneOf, Parameters}
+ import Arbitrary.{arbitrary}
+ import Shrink.{shrink}
+
+ // Types
+
+ /** A property argument */
+ case class Arg[+T](
+ label: String,
+ arg: T,
+ shrinks: Int,
+ origArg: T,
+ prettyArg: Pretty,
+ prettyOrigArg: Pretty
+ )
+
+ object Result {
+ @deprecated("Will be removed in 1.12.0", "1.11.2")
+ def apply(st: Status): Result = Result(status = st)
+ @deprecated("Will be removed in 1.12.0", "1.11.2")
+ def merge(x: Result, y: Result, status: Status) = mergeRes(x,y,status)
+ }
+
+ private[scalacheck] def mergeRes(x: Result, y: Result, st: Status) = Result(
+ status = st,
+ args = x.args ++ y.args,
+ collected = x.collected ++ y.collected,
+ labels = x.labels ++ y.labels
+ )
+
+ /** The result of evaluating a property */
+ case class Result(
+ status: Status,
+ args: List[Arg[Any]] = Nil,
+ collected: Set[Any] = Set.empty,
+ labels: Set[String] = Set.empty
+ ) {
+ def success = status match {
+ case True => true
+ case Proof => true
+ case _ => false
+ }
+
+ def failure = status match {
+ case False => true
+ case Exception(_) => true
+ case _ => false
+ }
+
+ def proved = status == Proof
+
+ def addArg(a: Arg[Any]) = copy(args = a::args)
+
+ def collect(x: Any) = copy(collected = collected+x)
+
+ def label(l: String) = copy(labels = labels+l)
+
+ def &&(r: Result) = (this.status, r.status) match {
+ case (Exception(_),_) => this
+ case (_,Exception(_)) => r
+
+ case (False,_) => this
+ case (_,False) => r
+
+ case (Undecided,_) => this
+ case (_,Undecided) => r
+
+ case (_,Proof) => mergeRes(this, r, this.status)
+ case (Proof,_) => mergeRes(this, r, r.status)
+
+ case (True,True) => mergeRes(this, r, True)
+ }
+
+ def ||(r: Result) = (this.status, r.status) match {
+ case (Exception(_),_) => this
+ case (_,Exception(_)) => r
+
+ case (False,False) => mergeRes(this, r, False)
+ case (False,_) => r
+ case (_,False) => this
+
+ case (Proof,_) => this
+ case (_,Proof) => r
+
+ case (True,_) => this
+ case (_,True) => r
+
+ case (Undecided,Undecided) => mergeRes(this, r, Undecided)
+ }
+
+ def ++(r: Result) = (this.status, r.status) match {
+ case (Exception(_),_) => this
+ case (_,Exception(_)) => r
+
+ case (_, Undecided) => this
+ case (Undecided, _) => r
+
+ case (_, Proof) => this
+ case (Proof, _) => r
+
+ case (_, True) => this
+ case (True, _) => r
+
+ case (False, _) => this
+ case (_, False) => r
+ }
+
+ def ==>(r: Result) = (this.status, r.status) match {
+ case (Exception(_),_) => this
+ case (_,Exception(_)) => r
+
+ case (False,_) => mergeRes(this, r, Undecided)
+
+ case (Undecided,_) => this
+
+ case (Proof,_) => mergeRes(this, r, r.status)
+ case (True,_) => mergeRes(this, r, r.status)
+ }
+ }
+
+ sealed trait Status
+
+ /** The property was proved */
+ case object Proof extends Status
+
+ /** The property was true */
+ case object True extends Status
+
+ /** The property was false */
+ case object False extends Status
+
+ /** The property could not be falsified or proved */
+ case object Undecided extends Status
+
+ /** Evaluating the property raised an exception */
+ sealed case class Exception(e: Throwable) extends Status {
+ override def equals(o: Any) = o match {
+ case Exception(_) => true
+ case _ => false
+ }
+ }
+
+ /** Create a new property from the given function. */
+ def apply(f: Parameters => Result): Prop = new Prop {
+ def apply(prms: Parameters) = try f(prms) catch {
+ case e: Throwable => Result(status = Exception(e))
+ }
+ }
+
+ /** Create a property that returns the given result */
+ def apply(r: Result): Prop = Prop.apply(prms => r)
+
+ /** Create a property from a boolean value */
+ def apply(b: Boolean): Prop = if(b) proved else falsified
+
+
+ // Implicits
+
+ /** A collection of property operators on `Any` values.
+ * Import [[Prop.AnyOperators]] to make the operators available. */
+ class ExtendedAny[T <% Pretty](x: => T) {
+ /** See [[Prop.imply]] */
+ def imply(f: PartialFunction[T,Prop]) = Prop.imply(x,f)
+ /** See [[Prop.iff]] */
+ def iff(f: PartialFunction[T,Prop]) = Prop.iff(x,f)
+ /** See [[Prop.?=]] */
+ def ?=(y: T) = Prop.?=(x, y)
+ /** See [[Prop.=?]] */
+ def =?(y: T) = Prop.=?(x, y)
+ }
+
+ /** A collection of property operators on `Boolean` values.
+ * Import [[Prop.BooleanOperators]] to make the operators available. */
+ class ExtendedBoolean(b: => Boolean) {
+ /** See the documentation for [[org.scalacheck.Prop]] */
+ def ==>(p: => Prop) = Prop(b) ==> p
+ /** See the documentation for [[org.scalacheck.Prop]] */
+ def :|(l: String) = Prop(b) :| l
+ /** See the documentation for [[org.scalacheck.Prop]] */
+ def |:(l: String) = l |: Prop(b)
+ /** See the documentation for [[org.scalacheck.Prop]] */
+ def :|(l: Symbol) = Prop(b) :| l
+ /** See the documentation for [[org.scalacheck.Prop]] */
+ def |:(l: Symbol) = l |: Prop(b)
+ }
+
+ /** Implicit method that makes a number of property operators on values of
+ * type `Any` available in the current scope.
+ * See [[Prop.ExtendedAny]] for documentation on the operators. */
+ implicit def AnyOperators[T <% Pretty](x: => T) = new ExtendedAny[T](x)
+
+ /** Implicit method that makes a number of property operators on boolean
+ * values available in the current scope. See [[Prop.ExtendedBoolean]] for
+ * documentation on the operators. */
+ implicit def BooleanOperators(b: => Boolean) = new ExtendedBoolean(b)
+
+ /** Implicit conversion of Boolean values to Prop values. */
+ implicit def propBoolean(b: Boolean): Prop = Prop(b)
+
+
+ // Private support functions
+
+ private def provedToTrue(r: Result) = r.status match {
+ case Proof => r.copy(status = True)
+ case _ => r
+ }
+
+
+ // Property combinators
+
+ /** A property that never is proved or falsified */
+ lazy val undecided = Prop(Result(status = Undecided))
+
+ /** A property that always is false */
+ lazy val falsified = Prop(Result(status = False))
+
+ /** A property that always is proved */
+ lazy val proved = Prop(Result(status = Proof))
+
+ /** A property that always is passed */
+ lazy val passed = Prop(Result(status = True))
+
+ /** A property that denotes an exception */
+ def exception(e: Throwable): Prop = Prop(Result(status = Exception(e)))
+
+ /** A property that denotes an exception */
+ lazy val exception: Prop = exception(null)
+
+ /** Create a property that compares to values. If the values aren't equal,
+ * the property will fail and report that first value doesn't match the
+ * expected (second) value. */
+ def ?=[T](x: T, y: T)(implicit pp: T => Pretty): Prop =
+ if(x == y) proved else falsified :| {
+ val exp = Pretty.pretty[T](y, Pretty.Params(0))
+ val act = Pretty.pretty[T](x, Pretty.Params(0))
+ "Expected "+exp+" but got "+act
+ }
+
+ /** Create a property that compares to values. If the values aren't equal,
+ * the property will fail and report that second value doesn't match the
+ * expected (first) value. */
+ def =?[T](x: T, y: T)(implicit pp: T => Pretty): Prop = ?=(y, x)
+
+ /** A property that depends on the generator size */
+ def sizedProp(f: Int => Prop): Prop = Prop { prms =>
+ // provedToTrue since if the property is proved for
+ // one size, it shouldn't be regarded as proved for
+ // all sizes.
+ provedToTrue(f(prms.size)(prms))
+ }
+
+ /** Implication with several conditions */
+ def imply[T](x: T, f: PartialFunction[T,Prop]): Prop = secure {
+ if(f.isDefinedAt(x)) f(x) else undecided
+ }
+
+ /** Property holds only if the given partial function is defined at
+ * `x`, and returns a property that holds */
+ def iff[T](x: T, f: PartialFunction[T,Prop]): Prop = secure {
+ if(f.isDefinedAt(x)) f(x) else falsified
+ }
+
+ /** Combines properties into one, which is true if and only if all the
+ * properties are true */
+ def all(ps: Prop*) = if(ps.isEmpty) proved else Prop(prms =>
+ ps.map(p => p(prms)).reduceLeft(_ && _)
+ )
+
+ /** Combines properties into one, which is true if at least one of the
+ * properties is true */
+ def atLeastOne(ps: Prop*) = if(ps.isEmpty) falsified else Prop(prms =>
+ ps.map(p => p(prms)).reduceLeft(_ || _)
+ )
+
+ /** A property that holds if at least one of the given generators
+ * fails generating a value */
+ def someFailing[T](gs: Seq[Gen[T]]) = atLeastOne(gs.map(_ == fail):_*)
+
+ /** A property that holds iff none of the given generators
+ * fails generating a value */
+ def noneFailing[T](gs: Seq[Gen[T]]) = all(gs.map(_ !== fail):_*)
+
+ /** Returns true if the given statement throws an exception
+ * of the specified type */
+ def throws[T <: Throwable](c: Class[T])(x: => Any): Boolean =
+ try { x; false } catch { case e if c.isInstance(e) => true }
+
+ /** Collect data for presentation in test report */
+ def collect[T, P <% Prop](f: T => P): T => Prop = t => Prop { prms =>
+ val prop = f(t)
+ prop(prms).collect(t)
+ }
+
+ /** Collect data for presentation in test report */
+ def collect[T](t: T)(prop: Prop) = Prop { prms =>
+ prop(prms).collect(t)
+ }
+
+ /** Collect data for presentation in test report */
+ def classify(c: => Boolean, ifTrue: Any)(prop: Prop): Prop =
+ if(c) collect(ifTrue)(prop) else collect(())(prop)
+
+ /** Collect data for presentation in test report */
+ def classify(c: => Boolean, ifTrue: Any, ifFalse: Any)(prop: Prop): Prop =
+ if(c) collect(ifTrue)(prop) else collect(ifFalse)(prop)
+
+ /** Wraps and protects a property */
+ def secure[P <% Prop](p: => P): Prop =
+ try (p: Prop) catch { case e: Throwable => exception(e) }
+
+ /** Existential quantifier for an explicit generator. */
+ def exists[A,P](f: A => P)(implicit
+ pv: P => Prop,
+ pp: A => Pretty,
+ aa: Arbitrary[A]
+ ): Prop = exists(aa.arbitrary)(f)
+
+ /** Existential quantifier for an explicit generator. */
+ def exists[A,P](g: Gen[A])(f: A => P)(implicit
+ pv: P => Prop,
+ pp: A => Pretty
+ ): Prop = Prop { prms =>
+ val gr = g.doApply(prms)
+ gr.retrieve match {
+ case None => undecided(prms)
+ case Some(x) =>
+ val p = secure(f(x))
+ val labels = gr.labels.mkString(",")
+ val r = p(prms).addArg(Arg(labels,x,0,x,pp(x),pp(x)))
+ r.status match {
+ case True => r.copy(status = Proof)
+ case False => r.copy(status = Undecided)
+ case _ => r
+ }
+ }
+ }
+
+ /** Universal quantifier for an explicit generator. Does not shrink failed
+ * test cases. */
+ def forAllNoShrink[T1,P](
+ g1: Gen[T1])(
+ f: T1 => P)(implicit
+ pv: P => Prop,
+ pp1: T1 => Pretty
+ ): Prop = Prop { prms =>
+ val gr = g1.doApply(prms)
+ gr.retrieve match {
+ case None => undecided(prms)
+ case Some(x) =>
+ val p = secure(f(x))
+ val labels = gr.labels.mkString(",")
+ provedToTrue(p(prms)).addArg(Arg(labels,x,0,x,pp1(x),pp1(x)))
+ }
+ }
+
+ /** Universal quantifier for two explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,P](
+ g1: Gen[T1], g2: Gen[T2])(
+ f: (T1,T2) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2)(f(t, _:T2)))
+
+ /** Universal quantifier for three explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,T3,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3])(
+ f: (T1,T2,T3) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty,
+ pp3: T3 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3)(f(t, _:T2, _:T3)))
+
+ /** Universal quantifier for four explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,T3,T4,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4])(
+ f: (T1,T2,T3,T4) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty,
+ pp3: T3 => Pretty,
+ pp4: T4 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4)(f(t, _:T2, _:T3, _:T4)))
+
+ /** Universal quantifier for five explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,T3,T4,T5,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5])(
+ f: (T1,T2,T3,T4,T5) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty,
+ pp3: T3 => Pretty,
+ pp4: T4 => Pretty,
+ pp5: T5 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5)(f(t, _:T2, _:T3, _:T4, _:T5)))
+
+ /** Universal quantifier for six explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,T3,T4,T5,T6,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6])(
+ f: (T1,T2,T3,T4,T5,T6) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty,
+ pp3: T3 => Pretty,
+ pp4: T4 => Pretty,
+ pp5: T5 => Pretty,
+ pp6: T6 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5,g6)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6)))
+
+ /** Universal quantifier for seven explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,T3,T4,T5,T6,T7,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7])(
+ f: (T1,T2,T3,T4,T5,T6,T7) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty,
+ pp3: T3 => Pretty,
+ pp4: T4 => Pretty,
+ pp5: T5 => Pretty,
+ pp6: T6 => Pretty,
+ pp7: T7 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5,g6,g7)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7)))
+
+ /** Universal quantifier for eight explicit generators.
+ * Does not shrink failed test cases. */
+ def forAllNoShrink[T1,T2,T3,T4,T5,T6,T7,T8,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8])(
+ f: (T1,T2,T3,T4,T5,T6,T7,T8) => P)(implicit
+ p: P => Prop,
+ pp1: T1 => Pretty,
+ pp2: T2 => Pretty,
+ pp3: T3 => Pretty,
+ pp4: T4 => Pretty,
+ pp5: T5 => Pretty,
+ pp6: T6 => Pretty,
+ pp7: T7 => Pretty,
+ pp8: T8 => Pretty
+ ): Prop = forAllNoShrink(g1)(t => forAllNoShrink(g2,g3,g4,g5,g6,g7,g8)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8)))
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,P](
+ f: A1 => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty
+ ): Prop = forAllNoShrink(arbitrary[A1])(f)
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,P](
+ f: (A1,A2) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty
+ ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2])(f)
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,A3,P](
+ f: (A1,A2,A3) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], pp3: A3 => Pretty
+ ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3])(f)
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,A3,A4,P](
+ f: (A1,A2,A3,A4) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], pp4: A4 => Pretty
+ ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4])(f)
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,A3,A4,A5,P](
+ f: (A1,A2,A3,A4,A5) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], pp5: A5 => Pretty
+ ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5])(f)
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,A3,A4,A5,A6,P](
+ f: (A1,A2,A3,A4,A5,A6) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], pp5: A5 => Pretty,
+ a6: Arbitrary[A6], pp6: A6 => Pretty
+ ): Prop = forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5], arbitrary[A6])(f)
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,A3,A4,A5,A6,A7,P](
+ f: (A1,A2,A3,A4,A5,A6,A7) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], pp5: A5 => Pretty,
+ a6: Arbitrary[A6], pp6: A6 => Pretty,
+ a7: Arbitrary[A7], pp7: A7 => Pretty
+ ): Prop = {
+ forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5], arbitrary[A6],
+ arbitrary[A7])(f)
+ }
+
+ /** Converts a function into a universally quantified property */
+ def forAllNoShrink[A1,A2,A3,A4,A5,A6,A7,A8,P](
+ f: (A1,A2,A3,A4,A5,A6,A7,A8) => P)(implicit
+ pv: P => Prop,
+ a1: Arbitrary[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], pp5: A5 => Pretty,
+ a6: Arbitrary[A6], pp6: A6 => Pretty,
+ a7: Arbitrary[A7], pp7: A7 => Pretty,
+ a8: Arbitrary[A8], pp8: A8 => Pretty
+ ): Prop = {
+ forAllNoShrink(arbitrary[A1], arbitrary[A2], arbitrary[A3], arbitrary[A4], arbitrary[A5], arbitrary[A6],
+ arbitrary[A7], arbitrary[A8])(f)
+ }
+
+ /** Universal quantifier for an explicit generator. Shrinks failed arguments
+ * with the given shrink function */
+ def forAllShrink[T, P](g: Gen[T],
+ shrink: T => Stream[T])(f: T => P
+ )(implicit pv: P => Prop, pp: T => Pretty
+ ): Prop = Prop { prms =>
+
+ val gr = g.doApply(prms)
+ val labels = gr.labels.mkString(",")
+
+ def result(x: T) = {
+ val p = secure(pv(f(x)))
+ provedToTrue(p(prms))
+ }
+
+ /** Returns the first failed result in Left or success in Right */
+ def getFirstFailure(xs: Stream[T]): Either[(T,Result),(T,Result)] = {
+ assert(!xs.isEmpty, "Stream cannot be empty")
+ val results = xs.map(x => (x, result(x)))
+ results.dropWhile(!_._2.failure).headOption match {
+ case None => Right(results.head)
+ case Some(xr) => Left(xr)
+ }
+ }
+
+ def shrinker(x: T, r: Result, shrinks: Int, orig: T): Result = {
+ val xs = shrink(x).filter(gr.sieve)
+ val res = r.addArg(Arg(labels,x,shrinks,orig,pp(x),pp(orig)))
+ if(xs.isEmpty) res else getFirstFailure(xs) match {
+ case Right((x2,r2)) => res
+ case Left((x2,r2)) => shrinker(x2, replOrig(r,r2), shrinks+1, orig)
+ }
+ }
+
+ def replOrig(r0: Result, r1: Result) = (r0.args,r1.args) match {
+ case (a0::_,a1::as) =>
+ r1.copy(
+ args = a1.copy(
+ origArg = a0.origArg,
+ prettyOrigArg = a0.prettyOrigArg
+ ) :: as
+ )
+ case _ => r1
+ }
+
+ gr.retrieve match {
+ case None => undecided(prms)
+ case Some(x) =>
+ val r = result(x)
+ if (!r.failure) r.addArg(Arg(labels,x,0,x,pp(x),pp(x)))
+ else shrinker(x,r,0,x)
+ }
+
+ }
+
+ /** Universal quantifier for an explicit generator. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,P](
+ g1: Gen[T1])(
+ f: T1 => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1],
+ pp1: T1 => Pretty
+ ): Prop = forAllShrink[T1,P](g1, shrink[T1])(f)
+
+ /** Universal quantifier for two explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,P](
+ g1: Gen[T1], g2: Gen[T2])(
+ f: (T1,T2) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2)(f(t, _:T2)))
+
+ /** Universal quantifier for three explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,T3,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3])(
+ f: (T1,T2,T3) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty,
+ s3: Shrink[T3], pp3: T3 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2,g3)(f(t, _:T2, _:T3)))
+
+ /** Universal quantifier for four explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,T3,T4,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4])(
+ f: (T1,T2,T3,T4) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty,
+ s3: Shrink[T3], pp3: T3 => Pretty,
+ s4: Shrink[T4], pp4: T4 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2,g3,g4)(f(t, _:T2, _:T3, _:T4)))
+
+ /** Universal quantifier for five explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,T3,T4,T5,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5])(
+ f: (T1,T2,T3,T4,T5) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty,
+ s3: Shrink[T3], pp3: T3 => Pretty,
+ s4: Shrink[T4], pp4: T4 => Pretty,
+ s5: Shrink[T5], pp5: T5 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5)(f(t, _:T2, _:T3, _:T4, _:T5)))
+
+ /** Universal quantifier for six explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,T3,T4,T5,T6,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6])(
+ f: (T1,T2,T3,T4,T5,T6) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty,
+ s3: Shrink[T3], pp3: T3 => Pretty,
+ s4: Shrink[T4], pp4: T4 => Pretty,
+ s5: Shrink[T5], pp5: T5 => Pretty,
+ s6: Shrink[T6], pp6: T6 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5,g6)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6)))
+
+ /** Universal quantifier for seven explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,T3,T4,T5,T6,T7,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7])(
+ f: (T1,T2,T3,T4,T5,T6,T7) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty,
+ s3: Shrink[T3], pp3: T3 => Pretty,
+ s4: Shrink[T4], pp4: T4 => Pretty,
+ s5: Shrink[T5], pp5: T5 => Pretty,
+ s6: Shrink[T6], pp6: T6 => Pretty,
+ s7: Shrink[T7], pp7: T7 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5,g6,g7)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7)))
+
+ /** Universal quantifier for eight explicit generators. Shrinks failed arguments
+ * with the default shrink function for the type */
+ def forAll[T1,T2,T3,T4,T5,T6,T7,T8,P](
+ g1: Gen[T1], g2: Gen[T2], g3: Gen[T3], g4: Gen[T4], g5: Gen[T5], g6: Gen[T6], g7: Gen[T7], g8: Gen[T8])(
+ f: (T1,T2,T3,T4,T5,T6,T7,T8) => P)(implicit
+ p: P => Prop,
+ s1: Shrink[T1], pp1: T1 => Pretty,
+ s2: Shrink[T2], pp2: T2 => Pretty,
+ s3: Shrink[T3], pp3: T3 => Pretty,
+ s4: Shrink[T4], pp4: T4 => Pretty,
+ s5: Shrink[T5], pp5: T5 => Pretty,
+ s6: Shrink[T6], pp6: T6 => Pretty,
+ s7: Shrink[T7], pp7: T7 => Pretty,
+ s8: Shrink[T8], pp8: T8 => Pretty
+ ): Prop = forAll(g1)(t => forAll(g2,g3,g4,g5,g6,g7,g8)(f(t, _:T2, _:T3, _:T4, _:T5, _:T6, _:T7, _:T8)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,P] (
+ f: A1 => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty
+ ): Prop = forAllShrink(arbitrary[A1],shrink[A1])(f andThen p)
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,P] (
+ f: (A1,A2) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,A3,P] (
+ f: (A1,A2,A3) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,A3,A4,P] (
+ f: (A1,A2,A3,A4) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,A3,A4,A5,P] (
+ f: (A1,A2,A3,A4,A5) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,A3,A4,A5,A6,P] (
+ f: (A1,A2,A3,A4,A5,A6) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty,
+ a6: Arbitrary[A6], s6: Shrink[A6], pp6: A6 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5, _:A6)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,A3,A4,A5,A6,A7,P] (
+ f: (A1,A2,A3,A4,A5,A6,A7) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty,
+ a6: Arbitrary[A6], s6: Shrink[A6], pp6: A6 => Pretty,
+ a7: Arbitrary[A7], s7: Shrink[A7], pp7: A7 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5, _:A6, _:A7)))
+
+ /** Converts a function into a universally quantified property */
+ def forAll[A1,A2,A3,A4,A5,A6,A7,A8,P] (
+ f: (A1,A2,A3,A4,A5,A6,A7,A8) => P)(implicit
+ p: P => Prop,
+ a1: Arbitrary[A1], s1: Shrink[A1], pp1: A1 => Pretty,
+ a2: Arbitrary[A2], s2: Shrink[A2], pp2: A2 => Pretty,
+ a3: Arbitrary[A3], s3: Shrink[A3], pp3: A3 => Pretty,
+ a4: Arbitrary[A4], s4: Shrink[A4], pp4: A4 => Pretty,
+ a5: Arbitrary[A5], s5: Shrink[A5], pp5: A5 => Pretty,
+ a6: Arbitrary[A6], s6: Shrink[A6], pp6: A6 => Pretty,
+ a7: Arbitrary[A7], s7: Shrink[A7], pp7: A7 => Pretty,
+ a8: Arbitrary[A8], s8: Shrink[A8], pp8: A8 => Pretty
+ ): Prop = forAll((a: A1) => forAll(f(a, _:A2, _:A3, _:A4, _:A5, _:A6, _:A7, _:A8)))
+
+ /** Ensures that the property expression passed in completes within the given
+ * space of time. */
+ def within(maximumMs: Long)(wrappedProp: => Prop): Prop = new Prop {
+ @tailrec private def attempt(prms: Parameters, endTime: Long): Result = {
+ val result = wrappedProp.apply(prms)
+ if (System.currentTimeMillis > endTime) {
+ (if(result.failure) result else Result(status = False)).label("Timeout")
+ } else {
+ if (result.success) result
+ else attempt(prms, endTime)
+ }
+ }
+ def apply(prms: Parameters) = attempt(prms, System.currentTimeMillis + maximumMs)
+ }
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Properties.scala b/src/partest-extras/scala/org/scalacheck/Properties.scala
new file mode 100644
index 0000000000..abaac61c7f
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Properties.scala
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import util.ConsoleReporter
+
+/** Represents a collection of properties, with convenient methods
+ * for checking all properties at once. This class is itself a property, which
+ * holds if and only if all of the contained properties hold.
+ * <p>Properties are added in the following way:</p>
+ *
+ * {{{
+ * object MyProps extends Properties("MyProps") {
+ * property("myProp1") = forAll { (n:Int, m:Int) =>
+ * n+m == m+n
+ * }
+ * }
+ * }}}
+ */
+class Properties(val name: String) extends Prop {
+
+ private val props = new scala.collection.mutable.ListBuffer[(String,Prop)]
+
+ /** Returns one property which holds if and only if all of the
+ * properties in this property collection hold */
+ private def oneProperty: Prop = Prop.all((properties map (_._2)):_*)
+
+ /** Returns all properties of this collection in a list of name/property
+ * pairs. */
+ def properties: Seq[(String,Prop)] = props
+
+ def apply(p: Gen.Parameters) = oneProperty(p)
+
+ /** Convenience method that checks the properties with the given parameters
+ * and reports the result on the console. If you need to get the results
+ * from the test use the `check` methods in [[org.scalacheck.Test]]
+ * instead. */
+ override def check(prms: Test.Parameters): Unit = Test.checkProperties(
+ prms.withTestCallback(ConsoleReporter(1) chain prms.testCallback), this
+ )
+
+ /** Convenience method that checks the properties and reports the
+ * result on the console. If you need to get the results from the test use
+ * the `check` methods in [[org.scalacheck.Test]] instead. */
+ override def check: Unit = check(Test.Parameters.default)
+
+ /** The logic for main, separated out to make it easier to
+ * avoid System.exit calls. Returns exit code.
+ */
+ override def mainRunner(args: Array[String]): Int = {
+ Test.parseParams(args) match {
+ case Some(params) =>
+ val res = Test.checkProperties(params, this)
+ val failed = res.filter(!_._2.passed).size
+ failed
+ case None =>
+ println("Incorrect options")
+ -1
+ }
+ }
+
+ /** Adds all properties from another property collection to this one. */
+ def include(ps: Properties) = for((n,p) <- ps.properties) property(n) = p
+
+ /** Used for specifying properties. Usage:
+ * {{{
+ * property("myProp") = ...
+ * }}}
+ */
+ class PropertySpecifier() {
+ def update(propName: String, p: Prop) = props += ((name+"."+propName, p))
+ }
+
+ lazy val property = new PropertySpecifier()
+}
diff --git a/src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala b/src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala
new file mode 100644
index 0000000000..754b67764d
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/ScalaCheckFramework.scala
@@ -0,0 +1,93 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import util.Pretty
+
+import org.scalatools.testing._
+
+class ScalaCheckFramework extends Framework {
+
+ private def mkFP(mod: Boolean, cname: String) =
+ new SubclassFingerprint {
+ val superClassName = cname
+ val isModule = mod
+ }
+
+ val name = "ScalaCheck"
+
+ val tests = Array[Fingerprint](
+ mkFP(true, "org.scalacheck.Properties"),
+ mkFP(false, "org.scalacheck.Prop"),
+ mkFP(false, "org.scalacheck.Properties"),
+ mkFP(true, "org.scalacheck.Prop")
+ )
+
+ def testRunner(loader: ClassLoader, loggers: Array[Logger]) = new Runner2 {
+
+ private def asEvent(nr: (String, Test.Result)) = nr match {
+ case (n: String, r: Test.Result) => new Event {
+ val testName = n
+ val description = n
+ val result = r.status match {
+ case Test.Passed => Result.Success
+ case _:Test.Proved => Result.Success
+ case _:Test.Failed => Result.Failure
+ case Test.Exhausted => Result.Skipped
+ case _:Test.PropException | _:Test.GenException => Result.Error
+ }
+ val error = r.status match {
+ case Test.PropException(_, e, _) => e
+ case _:Test.Failed => new Exception(Pretty.pretty(r,Pretty.Params(0)))
+ case _ => null
+ }
+ }
+ }
+
+ def run(testClassName: String, fingerprint: Fingerprint, handler: EventHandler, args: Array[String]) {
+
+ val testCallback = new Test.TestCallback {
+ override def onPropEval(n: String, w: Int, s: Int, d: Int) = {}
+
+ override def onTestResult(n: String, r: Test.Result) = {
+ for (l <- loggers) {
+ import Pretty._
+ val verbosityOpts = Set("-verbosity", "-v")
+ val verbosity = args.grouped(2).filter(twos => verbosityOpts(twos.head)).toSeq.headOption.map(_.last).map(_.toInt).getOrElse(0)
+ l.info(
+ (if (r.passed) "+ " else "! ") + n + ": " + pretty(r, Params(verbosity))
+ )
+ }
+ handler.handle(asEvent((n,r)))
+ }
+ }
+
+ val prms = Test.parseParams(args) match {
+ case Some(params) =>
+ params.withTestCallback(testCallback).withCustomClassLoader(Some(loader))
+ // TODO: Maybe handle this a bit better than throwing exception?
+ case None => throw new Exception()
+ }
+
+ fingerprint match {
+ case fp: SubclassFingerprint =>
+ val obj =
+ if(fp.isModule) Class.forName(testClassName + "$", true, loader).getField("MODULE$").get(null)
+ else Class.forName(testClassName, true, loader).newInstance
+ if(obj.isInstanceOf[Properties])
+ Test.checkProperties(prms, obj.asInstanceOf[Properties])
+ else
+ handler.handle(asEvent((testClassName, Test.check(prms, obj.asInstanceOf[Prop]))))
+ }
+ }
+
+ }
+
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Shrink.scala b/src/partest-extras/scala/org/scalacheck/Shrink.scala
new file mode 100644
index 0000000000..8ec28f4c4b
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Shrink.scala
@@ -0,0 +1,215 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import util.{Buildable,Buildable2}
+import scala.collection.{ JavaConversions => jcl }
+
+sealed abstract class Shrink[T] {
+ def shrink(x: T): Stream[T]
+}
+
+object Shrink {
+
+ import Stream.{cons, empty}
+ import scala.collection._
+ import java.util.ArrayList
+
+ /** Interleaves two streams */
+ private def interleave[T](xs: Stream[T], ys: Stream[T]): Stream[T] =
+ if(xs.isEmpty) ys
+ else if(ys.isEmpty) xs
+ else cons(xs.head, cons(ys.head, interleave(xs.tail, ys.tail)))
+
+ /** Shrink instance factory */
+ def apply[T](s: T => Stream[T]): Shrink[T] = new Shrink[T] {
+ override def shrink(x: T) = s(x)
+ }
+
+ /** Shrink a value */
+ def shrink[T](x: T)(implicit s: Shrink[T]): Stream[T] = s.shrink(x)
+
+ /** Default shrink instance */
+ implicit def shrinkAny[T]: Shrink[T] = Shrink(x => empty)
+
+ /** Shrink instance of container */
+ implicit def shrinkContainer[C[_],T](implicit v: C[T] => Traversable[T], s: Shrink[T],
+ b: Buildable[T,C]
+ ): Shrink[C[T]] = Shrink { xs: C[T] =>
+ val ys = v(xs)
+ val zs = ys.toStream
+ removeChunks(ys.size,zs).append(shrinkOne(zs)).map(b.fromIterable)
+ }
+
+ /** Shrink instance of container2 */
+ implicit def shrinkContainer2[C[_,_],T,U](implicit v: C[T,U] => Traversable[(T,U)], s: Shrink[(T,U)],
+ b: Buildable2[T,U,C]
+ ): Shrink[C[T,U]] = Shrink { xs: C[T,U] =>
+ val ys = v(xs)
+ val zs = ys.toStream
+ removeChunks(ys.size,zs).append(shrinkOne(zs)).map(b.fromIterable)
+ }
+
+ private def removeChunks[T](n: Int, xs: Stream[T]): Stream[Stream[T]] =
+ if (xs.isEmpty) empty
+ else if (xs.tail.isEmpty) cons(empty, empty)
+ else {
+ val n1 = n / 2
+ val n2 = n - n1
+ lazy val xs1 = xs.take(n1)
+ lazy val xs2 = xs.drop(n1)
+ lazy val xs3 =
+ for (ys1 <- removeChunks(n1, xs1) if !ys1.isEmpty) yield ys1 append xs2
+ lazy val xs4 =
+ for (ys2 <- removeChunks(n2, xs2) if !ys2.isEmpty) yield xs1 append ys2
+
+ cons(xs1, cons(xs2, interleave(xs3, xs4)))
+ }
+
+ private def shrinkOne[T : Shrink](zs: Stream[T]): Stream[Stream[T]] =
+ if (zs.isEmpty) empty
+ else {
+ val x = zs.head
+ val xs = zs.tail
+ shrink(x).map(cons(_,xs)).append(shrinkOne(xs).map(cons(x,_)))
+ }
+
+ /** Shrink instance of integer */
+ implicit lazy val shrinkInt: Shrink[Int] = Shrink { n =>
+
+ def halfs(n: Int): Stream[Int] =
+ if(n == 0) empty else cons(n, halfs(n/2))
+
+ if(n == 0) empty else {
+ val ns = halfs(n/2).map(n - _)
+ cons(0, interleave(ns, ns.map(-1 * _)))
+ }
+ }
+
+ /** Shrink instance of String */
+ implicit lazy val shrinkString: Shrink[String] = Shrink { s =>
+ shrinkContainer[List,Char].shrink(s.toList).map(_.mkString)
+ }
+
+ /** Shrink instance of Option */
+ implicit def shrinkOption[T : Shrink]: Shrink[Option[T]] = Shrink {
+ case None => empty
+ case Some(x) => cons(None, for(y <- shrink(x)) yield Some(y))
+ }
+
+ /** Shrink instance of 2-tuple */
+ implicit def shrinkTuple2[
+ T1:Shrink, T2:Shrink
+ ]: Shrink[(T1,T2)] =
+ Shrink { case (t1,t2) =>
+ shrink(t1).map((_,t2)) append
+ shrink(t2).map((t1,_))
+ }
+
+ /** Shrink instance of 3-tuple */
+ implicit def shrinkTuple3[
+ T1:Shrink, T2:Shrink, T3:Shrink
+ ]: Shrink[(T1,T2,T3)] =
+ Shrink { case (t1,t2,t3) =>
+ shrink(t1).map((_, t2, t3)) append
+ shrink(t2).map((t1, _, t3)) append
+ shrink(t3).map((t1, t2, _))
+ }
+
+ /** Shrink instance of 4-tuple */
+ implicit def shrinkTuple4[
+ T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink
+ ]: Shrink[(T1,T2,T3,T4)] =
+ Shrink { case (t1,t2,t3,t4) =>
+ shrink(t1).map((_, t2, t3, t4)) append
+ shrink(t2).map((t1, _, t3, t4)) append
+ shrink(t3).map((t1, t2, _, t4)) append
+ shrink(t4).map((t1, t2, t3, _))
+ }
+
+ /** Shrink instance of 5-tuple */
+ implicit def shrinkTuple5[
+ T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink
+ ]: Shrink[(T1,T2,T3,T4,T5)] =
+ Shrink { case (t1,t2,t3,t4,t5) =>
+ shrink(t1).map((_, t2, t3, t4, t5)) append
+ shrink(t2).map((t1, _, t3, t4, t5)) append
+ shrink(t3).map((t1, t2, _, t4, t5)) append
+ shrink(t4).map((t1, t2, t3, _, t5)) append
+ shrink(t5).map((t1, t2, t3, t4, _))
+ }
+
+ /** Shrink instance of 6-tuple */
+ implicit def shrinkTuple6[
+ T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink
+ ]: Shrink[(T1,T2,T3,T4,T5,T6)] =
+ Shrink { case (t1,t2,t3,t4,t5,t6) =>
+ shrink(t1).map((_, t2, t3, t4, t5, t6)) append
+ shrink(t2).map((t1, _, t3, t4, t5, t6)) append
+ shrink(t3).map((t1, t2, _, t4, t5, t6)) append
+ shrink(t4).map((t1, t2, t3, _, t5, t6)) append
+ shrink(t5).map((t1, t2, t3, t4, _, t6)) append
+ shrink(t6).map((t1, t2, t3, t4, t5, _))
+ }
+
+ /** Shrink instance of 7-tuple */
+ implicit def shrinkTuple7[
+ T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink, T7:Shrink
+ ]: Shrink[(T1,T2,T3,T4,T5,T6,T7)] =
+ Shrink { case (t1,t2,t3,t4,t5,t6,t7) =>
+ shrink(t1).map((_, t2, t3, t4, t5, t6, t7)) append
+ shrink(t2).map((t1, _, t3, t4, t5, t6, t7)) append
+ shrink(t3).map((t1, t2, _, t4, t5, t6, t7)) append
+ shrink(t4).map((t1, t2, t3, _, t5, t6, t7)) append
+ shrink(t5).map((t1, t2, t3, t4, _, t6, t7)) append
+ shrink(t6).map((t1, t2, t3, t4, t5, _, t7)) append
+ shrink(t7).map((t1, t2, t3, t4, t5, t6, _))
+ }
+
+ /** Shrink instance of 8-tuple */
+ implicit def shrinkTuple8[
+ T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink,
+ T7:Shrink, T8:Shrink
+ ]: Shrink[(T1,T2,T3,T4,T5,T6,T7,T8)] =
+ Shrink { case (t1,t2,t3,t4,t5,t6,t7,t8) =>
+ shrink(t1).map((_, t2, t3, t4, t5, t6, t7, t8)) append
+ shrink(t2).map((t1, _, t3, t4, t5, t6, t7, t8)) append
+ shrink(t3).map((t1, t2, _, t4, t5, t6, t7, t8)) append
+ shrink(t4).map((t1, t2, t3, _, t5, t6, t7, t8)) append
+ shrink(t5).map((t1, t2, t3, t4, _, t6, t7, t8)) append
+ shrink(t6).map((t1, t2, t3, t4, t5, _, t7, t8)) append
+ shrink(t7).map((t1, t2, t3, t4, t5, t6, _, t8)) append
+ shrink(t8).map((t1, t2, t3, t4, t5, t6, t7, _))
+ }
+
+ /** Shrink instance of 9-tuple */
+ implicit def shrinkTuple9[
+ T1:Shrink, T2:Shrink, T3:Shrink, T4:Shrink, T5:Shrink, T6:Shrink,
+ T7:Shrink, T8:Shrink, T9:Shrink
+ ]: Shrink[(T1,T2,T3,T4,T5,T6,T7,T8,T9)] =
+ Shrink { case (t1,t2,t3,t4,t5,t6,t7,t8,t9) =>
+ shrink(t1).map((_, t2, t3, t4, t5, t6, t7, t8, t9)) append
+ shrink(t2).map((t1, _, t3, t4, t5, t6, t7, t8, t9)) append
+ shrink(t3).map((t1, t2, _, t4, t5, t6, t7, t8, t9)) append
+ shrink(t4).map((t1, t2, t3, _, t5, t6, t7, t8, t9)) append
+ shrink(t5).map((t1, t2, t3, t4, _, t6, t7, t8, t9)) append
+ shrink(t6).map((t1, t2, t3, t4, t5, _, t7, t8, t9)) append
+ shrink(t7).map((t1, t2, t3, t4, t5, t6, _, t8, t9)) append
+ shrink(t8).map((t1, t2, t3, t4, t5, t6, t7, _, t9)) append
+ shrink(t9).map((t1, t2, t3, t4, t5, t6, t7, t8, _))
+ }
+
+ /** Transform a Shrink[T] to a Shrink[U] where T and U are two isomorphic types
+ * whose relationship is described by the provided transformation functions.
+ * (exponential functor map) */
+ def xmap[T, U](from: T => U, to: U => T)(implicit st: Shrink[T]): Shrink[U] = Shrink[U] { u: U ⇒
+ st.shrink(to(u)).map(from)
+ }
+}
diff --git a/src/partest-extras/scala/org/scalacheck/Test.scala b/src/partest-extras/scala/org/scalacheck/Test.scala
new file mode 100644
index 0000000000..9a9c62b93f
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/Test.scala
@@ -0,0 +1,372 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck
+
+import Prop.Arg
+
+object Test {
+
+ import util.{FreqMap, ConsoleReporter}
+
+ /** Test parameters used by the check methods. Default
+ * parameters are defined by [[Test.Parameters.Default]]. */
+ trait Parameters {
+ /** The minimum number of tests that must succeed for ScalaCheck to
+ * consider a property passed. */
+ val minSuccessfulTests: Int
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.minSuccessfulTests]] set to the specified value. */
+ def withMinSuccessfulTests(minSuccessfulTests: Int): Parameters = cp(
+ minSuccessfulTests = minSuccessfulTests
+ )
+
+ /** The starting size given as parameter to the generators. */
+ val minSize: Int
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.minSize]] set to the specified value. */
+ def withMinSize(minSize: Int): Parameters = cp(
+ minSize = minSize
+ )
+
+ /** The maximum size given as parameter to the generators. */
+ val maxSize: Int
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.maxSize]] set to the specified value. */
+ def withMaxSize(maxSize: Int): Parameters = cp(
+ maxSize = maxSize
+ )
+
+ /** The random number generator used. */
+ val rng: scala.util.Random
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.rng]] set to the specified value. */
+ def withRng(rng: scala.util.Random): Parameters = cp(
+ rng = rng
+ )
+
+ /** The number of tests to run in parallel. */
+ val workers: Int
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.workers]] set to the specified value. */
+ def withWorkers(workers: Int): Parameters = cp(
+ workers = workers
+ )
+
+ /** A callback that ScalaCheck calls each time a test is executed. */
+ val testCallback: TestCallback
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.testCallback]] set to the specified value. */
+ def withTestCallback(testCallback: TestCallback): Parameters = cp(
+ testCallback = testCallback
+ )
+
+ /** The maximum ratio between discarded and passed tests allowed before
+ * ScalaCheck gives up and discards the property. At least
+ * `minSuccesfulTests` will always be run, though. */
+ val maxDiscardRatio: Float
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.maxDiscardRatio]] set to the specified value. */
+ def withMaxDiscardRatio(maxDiscardRatio: Float): Parameters = cp(
+ maxDiscardRatio = maxDiscardRatio
+ )
+
+ /** A custom class loader that should be used during test execution. */
+ val customClassLoader: Option[ClassLoader]
+
+ /** Create a copy of this [[Test.Parameters]] instance with
+ * [[Test.Parameters.customClassLoader]] set to the specified value. */
+ def withCustomClassLoader(customClassLoader: Option[ClassLoader]
+ ): Parameters = cp(
+ customClassLoader = customClassLoader
+ )
+
+ // private since we can't guarantee binary compatibility for this one
+ private case class cp(
+ minSuccessfulTests: Int = minSuccessfulTests,
+ minSize: Int = minSize,
+ maxSize: Int = maxSize,
+ rng: scala.util.Random = rng,
+ workers: Int = workers,
+ testCallback: TestCallback = testCallback,
+ maxDiscardRatio: Float = maxDiscardRatio,
+ customClassLoader: Option[ClassLoader] = customClassLoader
+ ) extends Parameters
+ }
+
+ /** Test parameters used by the check methods. Default
+ * parameters are defined by [[Test.Parameters.Default]]. */
+ object Parameters {
+ /** Default test parameters trait. This can be overriden if you need to
+ * tweak the parameters:
+ *
+ * {{{
+ * val myParams = new Parameters.Default {
+ * override val minSuccesfulTests = 600
+ * override val maxDiscardRatio = 8
+ * }
+ * }}}
+ *
+ * You can also use the withXXX-methods in
+ * [[org.scalacheck.Test.Parameters]] to achieve
+ * the same thing:
+ *
+ * {{{
+ * val myParams = Parameters.default
+ * .withMinSuccessfulTests(600)
+ * .withMaxDiscardRatio(8)
+ * }}} */
+ trait Default extends Parameters {
+ val minSuccessfulTests: Int = 100
+ val minSize: Int = 0
+ val maxSize: Int = Gen.Parameters.default.size
+ val rng: scala.util.Random = Gen.Parameters.default.rng
+ val workers: Int = 1
+ val testCallback: TestCallback = new TestCallback {}
+ val maxDiscardRatio: Float = 5
+ val customClassLoader: Option[ClassLoader] = None
+ }
+
+ /** Default test parameters instance. */
+ val default: Parameters = new Default {}
+
+ /** Verbose console reporter test parameters instance. */
+ val defaultVerbose: Parameters = new Default {
+ override val testCallback = ConsoleReporter(2)
+ }
+ }
+
+ /** Test statistics */
+ case class Result(
+ status: Status,
+ succeeded: Int,
+ discarded: Int,
+ freqMap: FreqMap[Set[Any]],
+ time: Long = 0
+ ) {
+ def passed = status match {
+ case Passed => true
+ case Proved(_) => true
+ case _ => false
+ }
+ }
+
+ /** Test status */
+ sealed trait Status
+
+ /** ScalaCheck found enough cases for which the property holds, so the
+ * property is considered correct. (It is not proved correct, though). */
+ case object Passed extends Status
+
+ /** ScalaCheck managed to prove the property correct */
+ sealed case class Proved(args: List[Arg[Any]]) extends Status
+
+ /** The property was proved wrong with the given concrete arguments. */
+ sealed case class Failed(args: List[Arg[Any]], labels: Set[String]) extends Status
+
+ /** The property test was exhausted, it wasn't possible to generate enough
+ * concrete arguments satisfying the preconditions to get enough passing
+ * property evaluations. */
+ case object Exhausted extends Status
+
+ /** An exception was raised when trying to evaluate the property with the
+ * given concrete arguments. If an exception was raised before or during
+ * argument generation, the argument list will be empty. */
+ sealed case class PropException(args: List[Arg[Any]], e: Throwable,
+ labels: Set[String]) extends Status
+
+ /** An exception was raised when trying to generate concrete arguments
+ * for evaluating the property.
+ * @deprecated Not used. The type PropException is used for all exceptions.
+ */
+ @deprecated("Not used. The type PropException is used for all exceptions.", "1.11.2")
+ sealed case class GenException(e: Throwable) extends Status
+
+ trait TestCallback { self =>
+ /** Called each time a property is evaluated */
+ def onPropEval(name: String, threadIdx: Int, succeeded: Int,
+ discarded: Int): Unit = ()
+
+ /** Called whenever a property has finished testing */
+ def onTestResult(name: String, result: Result): Unit = ()
+
+ def chain(testCallback: TestCallback) = new TestCallback {
+ override def onPropEval(name: String, threadIdx: Int,
+ succeeded: Int, discarded: Int
+ ): Unit = {
+ self.onPropEval(name,threadIdx,succeeded,discarded)
+ testCallback.onPropEval(name,threadIdx,succeeded,discarded)
+ }
+
+ override def onTestResult(name: String, result: Result): Unit = {
+ self.onTestResult(name,result)
+ testCallback.onTestResult(name,result)
+ }
+ }
+ }
+
+ private def assertParams(prms: Parameters) = {
+ import prms._
+ if(
+ minSuccessfulTests <= 0 ||
+ maxDiscardRatio <= 0 ||
+ minSize < 0 ||
+ maxSize < minSize ||
+ workers <= 0
+ ) throw new IllegalArgumentException("Invalid test parameters")
+ }
+
+ private def secure[T](x: => T): Either[T,Throwable] =
+ try { Left(x) } catch { case e: Throwable => Right(e) }
+
+ def parseParams(args: Array[String]): Option[Parameters] = {
+ var params = Parameters.default
+ args.grouped(2).filter(_.size > 1).map(a => (a(0), a(1))).foreach {
+ case ("-workers" | "-w", n) => params = params.withWorkers(n.toInt)
+ case ("-minSize" | "-n", n) => params = params.withMinSize(n.toInt)
+ case ("-maxSize" | "-x", n) => params = params.withMaxSize(n.toInt)
+ case ("-verbosity" | "-v", n) => params = params.withTestCallback(ConsoleReporter(n.toInt))
+ case ("-maxDiscardRatio" | "-r", n) => params = params.withMaxDiscardRatio(n.toFloat)
+ case ("-minSuccessfulTests" | "-s", n) => params = params.withMinSuccessfulTests(n.toInt)
+ case _ =>
+ }
+ Some(params)
+ }
+
+ /** Tests a property with parameters that are calculated by applying
+ * the provided function to [[Test.Parameters.default]].
+ * Example use:
+ *
+ * {{{
+ * Test.check(p) { _.
+ * withMinSuccessfulTests(80000).
+ * withWorkers(4)
+ * }
+ * }}}
+ */
+ def check(p: Prop)(f: Parameters => Parameters): Result =
+ check(f(Parameters.default), p)
+
+ /** Tests a property with the given testing parameters, and returns
+ * the test results. */
+ def check(params: Parameters, p: Prop): Result = {
+ import params._
+ import concurrent._
+
+ assertParams(params)
+ if(workers > 1) {
+ assert(!p.isInstanceOf[Commands], "Commands cannot be checked multi-threaded")
+ }
+
+ val iterations = math.ceil(minSuccessfulTests / (workers: Double))
+ val sizeStep = (maxSize-minSize) / (iterations*workers)
+ var stop = false
+ val genPrms = new Gen.Parameters.Default { override val rng = params.rng }
+ val tp = java.util.concurrent.Executors.newFixedThreadPool(workers)
+ implicit val ec = ExecutionContext.fromExecutor(tp)
+
+ def workerFun(workerIdx: Int): Result = {
+ var n = 0 // passed tests
+ var d = 0 // discarded tests
+ var res: Result = null
+ var fm = FreqMap.empty[Set[Any]]
+ while(!stop && res == null && n < iterations) {
+ val size = (minSize: Double) + (sizeStep * (workerIdx + (workers*(n+d))))
+ val propRes = p(genPrms.withSize(size.round.toInt))
+ fm = if(propRes.collected.isEmpty) fm else fm + propRes.collected
+ propRes.status match {
+ case Prop.Undecided =>
+ d += 1
+ testCallback.onPropEval("", workerIdx, n, d)
+ // The below condition is kind of hacky. We have to have
+ // some margin, otherwise workers might stop testing too
+ // early because they have been exhausted, but the overall
+ // test has not.
+ if (n+d > minSuccessfulTests && 1+workers*maxDiscardRatio*n < d)
+ res = Result(Exhausted, n, d, fm)
+ case Prop.True =>
+ n += 1
+ testCallback.onPropEval("", workerIdx, n, d)
+ case Prop.Proof =>
+ n += 1
+ res = Result(Proved(propRes.args), n, d, fm)
+ stop = true
+ case Prop.False =>
+ res = Result(Failed(propRes.args,propRes.labels), n, d, fm)
+ stop = true
+ case Prop.Exception(e) =>
+ res = Result(PropException(propRes.args,e,propRes.labels), n, d, fm)
+ stop = true
+ }
+ }
+ if (res == null) {
+ if (maxDiscardRatio*n > d) Result(Passed, n, d, fm)
+ else Result(Exhausted, n, d, fm)
+ } else res
+ }
+
+ def mergeResults(r1: Result, r2: Result): Result = {
+ val Result(st1, s1, d1, fm1, _) = r1
+ val Result(st2, s2, d2, fm2, _) = r2
+ if (st1 != Passed && st1 != Exhausted)
+ Result(st1, s1+s2, d1+d2, fm1++fm2, 0)
+ else if (st2 != Passed && st2 != Exhausted)
+ Result(st2, s1+s2, d1+d2, fm1++fm2, 0)
+ else {
+ if (s1+s2 >= minSuccessfulTests && maxDiscardRatio*(s1+s2) >= (d1+d2))
+ Result(Passed, s1+s2, d1+d2, fm1++fm2, 0)
+ else
+ Result(Exhausted, s1+s2, d1+d2, fm1++fm2, 0)
+ }
+ }
+
+ try {
+ val start = System.currentTimeMillis
+ val r =
+ if(workers < 2) workerFun(0)
+ else {
+ val fs = List.range(0,workers) map (idx => Future {
+ params.customClassLoader.map(
+ Thread.currentThread.setContextClassLoader(_)
+ )
+ blocking { workerFun(idx) }
+ })
+ val zeroRes = Result(Passed,0,0,FreqMap.empty[Set[Any]],0)
+ val res = Future.fold(fs)(zeroRes)(mergeResults)
+ Await.result(res, concurrent.duration.Duration.Inf)
+ }
+ val timedRes = r.copy(time = System.currentTimeMillis-start)
+ params.testCallback.onTestResult("", timedRes)
+ timedRes
+ } finally {
+ stop = true
+ tp.shutdown()
+ }
+ }
+
+ /** Check a set of properties. */
+ def checkProperties(prms: Parameters, ps: Properties): Seq[(String,Result)] =
+ ps.properties.map { case (name,p) =>
+ val testCallback = new TestCallback {
+ override def onPropEval(n: String, t: Int, s: Int, d: Int) =
+ prms.testCallback.onPropEval(name,t,s,d)
+ override def onTestResult(n: String, r: Result) =
+ prms.testCallback.onTestResult(name,r)
+ }
+ val res = check(prms.withTestCallback(testCallback), p)
+ (name,res)
+ }
+}
diff --git a/src/partest-extras/scala/org/scalacheck/util/Buildable.scala b/src/partest-extras/scala/org/scalacheck/util/Buildable.scala
new file mode 100644
index 0000000000..6a275b05c2
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/util/Buildable.scala
@@ -0,0 +1,77 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck.util
+
+import collection._
+
+trait Buildable[T,C[_]] {
+ def builder: mutable.Builder[T,C[T]]
+ def fromIterable(it: Traversable[T]): C[T] = {
+ val b = builder
+ b ++= it
+ b.result()
+ }
+}
+
+trait Buildable2[T,U,C[_,_]] {
+ def builder: mutable.Builder[(T,U),C[T,U]]
+ def fromIterable(it: Traversable[(T,U)]): C[T,U] = {
+ val b = builder
+ b ++= it
+ b.result()
+ }
+}
+
+object Buildable {
+ import generic.CanBuildFrom
+
+ implicit def buildableCanBuildFrom[T, C[_]](implicit c: CanBuildFrom[C[_], T, C[T]]) =
+ new Buildable[T, C] {
+ def builder = c.apply
+ }
+
+ import java.util.ArrayList
+ implicit def buildableArrayList[T] = new Buildable[T,ArrayList] {
+ def builder = new mutable.Builder[T,ArrayList[T]] {
+ val al = new ArrayList[T]
+ def +=(x: T) = {
+ al.add(x)
+ this
+ }
+ def clear() = al.clear()
+ def result() = al
+ }
+ }
+
+}
+
+object Buildable2 {
+
+ implicit def buildableMutableMap[T,U] = new Buildable2[T,U,mutable.Map] {
+ def builder = mutable.Map.newBuilder
+ }
+
+ implicit def buildableImmutableMap[T,U] = new Buildable2[T,U,immutable.Map] {
+ def builder = immutable.Map.newBuilder
+ }
+
+ implicit def buildableMap[T,U] = new Buildable2[T,U,Map] {
+ def builder = Map.newBuilder
+ }
+
+ implicit def buildableImmutableSortedMap[T: Ordering, U] = new Buildable2[T,U,immutable.SortedMap] {
+ def builder = immutable.SortedMap.newBuilder
+ }
+
+ implicit def buildableSortedMap[T: Ordering, U] = new Buildable2[T,U,SortedMap] {
+ def builder = SortedMap.newBuilder
+ }
+
+}
diff --git a/src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala b/src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala
new file mode 100644
index 0000000000..45b6ac6948
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/util/CmdLineParser.scala
@@ -0,0 +1,41 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck.util
+
+import scala.collection.Set
+import org.scalacheck.Test
+
+private[scalacheck] trait CmdLineParser {
+
+ type Elem = String
+
+ trait Opt[+T] {
+ val default: T
+ val names: Set[String]
+ val help: String
+ }
+ trait Flag extends Opt[Unit]
+ trait IntOpt extends Opt[Int]
+ trait FloatOpt extends Opt[Float]
+ trait StrOpt extends Opt[String]
+
+ class OptMap {
+ private val opts = new collection.mutable.HashMap[Opt[_], Any]
+ def apply(flag: Flag): Boolean = opts.contains(flag)
+ def apply[T](opt: Opt[T]): T = opts.get(opt) match {
+ case None => opt.default
+ case Some(v) => v.asInstanceOf[T]
+ }
+ def update[T](opt: Opt[T], optVal: T) = opts.update(opt, optVal)
+ }
+
+ val opts: Set[Opt[_]]
+
+}
diff --git a/src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala b/src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala
new file mode 100644
index 0000000000..89858dfb64
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/util/ConsoleReporter.scala
@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck.util
+
+import Pretty.{Params, pretty, format}
+import org.scalacheck.{Prop, Properties, Test}
+
+/** A [[org.scalacheck.Test.TestCallback]] implementation that prints
+ * test results directly to the console. This is the callback used
+ * by ScalaCheck's command line test runner, and when you run [[org.scalacheck.Prop!.check:Unit*]]
+ */
+class ConsoleReporter(val verbosity: Int) extends Test.TestCallback {
+
+ private val prettyPrms = Params(verbosity)
+
+ override def onTestResult(name: String, res: Test.Result) = {
+ if(verbosity > 0) {
+ if(name == "") {
+ val s = (if(res.passed) "+ " else "! ") + pretty(res, prettyPrms)
+ printf("\r%s\n", format(s, "", "", 75))
+ } else {
+ val s = (if(res.passed) "+ " else "! ") + name + ": " +
+ pretty(res, prettyPrms)
+ printf("\r%s\n", format(s, "", "", 75))
+ }
+ }
+ }
+
+}
+
+object ConsoleReporter {
+
+ /** Factory method, creates a ConsoleReporter with the
+ * the given verbosity */
+ def apply(verbosity: Int = 0) = new ConsoleReporter(verbosity)
+
+}
diff --git a/src/partest-extras/scala/org/scalacheck/util/FreqMap.scala b/src/partest-extras/scala/org/scalacheck/util/FreqMap.scala
new file mode 100644
index 0000000000..2a9f36f1e5
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/util/FreqMap.scala
@@ -0,0 +1,65 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck.util
+
+trait FreqMap[T] {
+ protected val underlying: scala.collection.immutable.Map[T,Int]
+ val total: Int
+
+ def +(t: T) = new FreqMap[T] {
+ private val n = FreqMap.this.underlying.get(t) match {
+ case None => 1
+ case Some(n) => n+1
+ }
+ val underlying = FreqMap.this.underlying + (t -> n)
+ val total = FreqMap.this.total + 1
+ }
+
+ def -(t: T) = new FreqMap[T] {
+ val underlying = FreqMap.this.underlying.get(t) match {
+ case None => FreqMap.this.underlying
+ case Some(n) => FreqMap.this.underlying + (t -> (n-1))
+ }
+ val total = FreqMap.this.total + 1
+ }
+
+ def ++(fm: FreqMap[T]) = new FreqMap[T] {
+ private val keys = FreqMap.this.underlying.keySet ++ fm.underlying.keySet
+ private val mappings = keys.toStream.map { x =>
+ (x, fm.getCount(x).getOrElse(0) + FreqMap.this.getCount(x).getOrElse(0))
+ }
+ val underlying = scala.collection.immutable.Map(mappings: _*)
+ val total = FreqMap.this.total + fm.total
+ }
+
+ def --(fm: FreqMap[T]) = new FreqMap[T] {
+ val underlying = FreqMap.this.underlying transform {
+ case (x,n) => n - fm.getCount(x).getOrElse(0)
+ }
+ lazy val total = (0 /: underlying.valuesIterator) (_ + _)
+ }
+
+ def getCount(t: T) = underlying.get(t)
+
+ def getCounts: List[(T,Int)] = underlying.toList.sortBy(-_._2)
+
+ def getRatio(t: T) = for(c <- getCount(t)) yield (c: Float)/total
+
+ def getRatios = for((t,c) <- getCounts) yield (t, (c: Float)/total)
+
+ override def toString = underlying.toString
+}
+
+object FreqMap {
+ def empty[T] = new FreqMap[T] {
+ val underlying = scala.collection.immutable.Map.empty[T,Int]
+ val total = 0
+ }
+}
diff --git a/src/partest-extras/scala/org/scalacheck/util/Pretty.scala b/src/partest-extras/scala/org/scalacheck/util/Pretty.scala
new file mode 100644
index 0000000000..13a1b44b51
--- /dev/null
+++ b/src/partest-extras/scala/org/scalacheck/util/Pretty.scala
@@ -0,0 +1,129 @@
+/*-------------------------------------------------------------------------*\
+** ScalaCheck **
+** Copyright (c) 2007-2014 Rickard Nilsson. All rights reserved. **
+** http://www.scalacheck.org **
+** **
+** This software is released under the terms of the Revised BSD License. **
+** There is NO WARRANTY. See the file LICENSE for the full text. **
+\*------------------------------------------------------------------------ */
+
+package org.scalacheck.util
+
+import org.scalacheck.Prop.Arg
+import org.scalacheck.Test
+
+import math.round
+
+
+sealed trait Pretty {
+ def apply(prms: Pretty.Params): String
+
+ def map(f: String => String) = Pretty(prms => f(Pretty.this(prms)))
+
+ def flatMap(f: String => Pretty) = Pretty(prms => f(Pretty.this(prms))(prms))
+}
+
+object Pretty {
+
+ case class Params(verbosity: Int)
+
+ val defaultParams = Params(0)
+
+ def apply(f: Params => String) = new Pretty { def apply(p: Params) = f(p) }
+
+ def pretty[T <% Pretty](t: T, prms: Params): String = t(prms)
+
+ def pretty[T <% Pretty](t: T): String = t(defaultParams)
+
+ implicit def strBreak(s1: String) = new {
+ def /(s2: String) = if(s2 == "") s1 else s1+"\n"+s2
+ }
+
+ def pad(s: String, c: Char, length: Int) =
+ if(s.length >= length) s
+ else s + List.fill(length-s.length)(c).mkString
+
+ def break(s: String, lead: String, length: Int): String =
+ if(s.length <= length) s
+ else s.substring(0, length) / break(lead+s.substring(length), lead, length)
+
+ def format(s: String, lead: String, trail: String, width: Int) =
+ s.lines.map(l => break(lead+l+trail, " ", width)).mkString("\n")
+
+ implicit def prettyAny(t: Any) = Pretty { p => t.toString }
+
+ implicit def prettyString(t: String) = Pretty { p => "\""++t++"\"" }
+
+ implicit def prettyList(l: List[Any]) = Pretty { p =>
+ l.map("\""+_+"\"").mkString("List(", ", ", ")")
+ }
+
+ implicit def prettyThrowable(e: Throwable) = Pretty { prms =>
+ val strs = e.getStackTrace.map { st =>
+ import st._
+ getClassName+"."+getMethodName + "("+getFileName+":"+getLineNumber+")"
+ }
+
+ val strs2 =
+ if(prms.verbosity <= 0) Array[String]()
+ else if(prms.verbosity <= 1) strs.take(5)
+ else strs
+
+ e.getClass.getName + ": " + e.getMessage / strs2.mkString("\n")
+ }
+
+ def prettyArgs(args: Seq[Arg[Any]]): Pretty = Pretty { prms =>
+ if(args.isEmpty) "" else {
+ for((a,i) <- args.zipWithIndex) yield {
+ val l = "> "+(if(a.label == "") "ARG_"+i else a.label)
+ val s =
+ if(a.shrinks == 0) ""
+ else "\n"+l+"_ORIGINAL: "+a.prettyOrigArg(prms)
+ l+": "+a.prettyArg(prms)+""+s
+ }
+ }.mkString("\n")
+ }
+
+ implicit def prettyFreqMap(fm: FreqMap[Set[Any]]) = Pretty { prms =>
+ if(fm.total == 0) ""
+ else {
+ "> Collected test data: " / {
+ for {
+ (xs,r) <- fm.getRatios
+ ys = xs - (())
+ if !ys.isEmpty
+ } yield round(r*100)+"% " + ys.mkString(", ")
+ }.mkString("\n")
+ }
+ }
+
+ implicit def prettyTestRes(res: Test.Result) = Pretty { prms =>
+ def labels(ls: collection.immutable.Set[String]) =
+ if(ls.isEmpty) ""
+ else "> Labels of failing property: " / ls.mkString("\n")
+ val s = res.status match {
+ case Test.Proved(args) => "OK, proved property."/prettyArgs(args)(prms)
+ case Test.Passed => "OK, passed "+res.succeeded+" tests."
+ case Test.Failed(args, l) =>
+ "Falsified after "+res.succeeded+" passed tests."/labels(l)/prettyArgs(args)(prms)
+ case Test.Exhausted =>
+ "Gave up after only "+res.succeeded+" passed tests. " +
+ res.discarded+" tests were discarded."
+ case Test.PropException(args,e,l) =>
+ "Exception raised on property evaluation."/labels(l)/prettyArgs(args)(prms)/
+ "> Exception: "+pretty(e,prms)
+ case Test.GenException(e) =>
+ "Exception raised on argument generation."/
+ "> Exception: "+pretty(e,prms)
+ }
+ val t = if(prms.verbosity <= 1) "" else "Elapsed time: "+prettyTime(res.time)
+ s/t/pretty(res.freqMap,prms)
+ }
+
+ def prettyTime(millis: Long): String = {
+ val min = millis/(60*1000)
+ val sec = (millis-(60*1000*min)) / 1000d
+ if(min <= 0) "%.3f sec ".format(sec)
+ else "%d min %.3f sec ".format(min, sec)
+ }
+}
diff --git a/src/partest-extras/scala/tools/partest/ASMConverters.scala b/src/partest-extras/scala/tools/partest/ASMConverters.scala
index a3d849a9c1..445d3c89c2 100644
--- a/src/partest-extras/scala/tools/partest/ASMConverters.scala
+++ b/src/partest-extras/scala/tools/partest/ASMConverters.scala
@@ -94,7 +94,7 @@ object ASMConverters {
case class FrameEntry (`type`: Int, local: List[Any], stack: List[Any]) extends Instruction { def opcode: Int = -1 }
case class LineNumber (line: Int, start: Label) extends Instruction { def opcode: Int = -1 }
- case class MethodHandle(tag: Int, owner: String, name: String, desc: String)
+ case class MethodHandle(tag: Int, owner: String, name: String, desc: String, itf: Boolean)
case class ExceptionHandler(start: Label, end: Label, handler: Label, desc: Option[String])
case class LocalVariable(name: String, desc: String, signature: Option[String], start: Label, end: Label, index: Int)
@@ -147,7 +147,7 @@ object ASMConverters {
case _ => a // can be: Class, method Type, primitive constant
})(collection.breakOut)
- private def convertMethodHandle(h: asm.Handle): MethodHandle = MethodHandle(h.getTag, h.getOwner, h.getName, h.getDesc)
+ private def convertMethodHandle(h: asm.Handle): MethodHandle = MethodHandle(h.getTag, h.getOwner, h.getName, h.getDesc, h.isInterface)
private def convertHandlers(method: t.MethodNode): List[ExceptionHandler] = {
method.tryCatchBlocks.asScala.map(h => ExceptionHandler(applyLabel(h.start), applyLabel(h.end), applyLabel(h.handler), Option(h.`type`)))(collection.breakOut)
@@ -227,7 +227,7 @@ object ASMConverters {
case x => x.asInstanceOf[Object]
}
- def unconvertMethodHandle(h: MethodHandle): asm.Handle = new asm.Handle(h.tag, h.owner, h.name, h.desc)
+ def unconvertMethodHandle(h: MethodHandle): asm.Handle = new asm.Handle(h.tag, h.owner, h.name, h.desc, h.itf)
def unconvertBsmArgs(a: List[Object]): Array[Object] = a.map({
case h: MethodHandle => unconvertMethodHandle(h)
case o => o
diff --git a/src/reflect/scala/reflect/internal/Constants.scala b/src/reflect/scala/reflect/internal/Constants.scala
index 85d0efdcba..7b47798ff7 100644
--- a/src/reflect/scala/reflect/internal/Constants.scala
+++ b/src/reflect/scala/reflect/internal/Constants.scala
@@ -7,7 +7,6 @@ package scala
package reflect
package internal
-import java.lang.Integer.toOctalString
import scala.annotation.switch
trait Constants extends api.Constants {
@@ -212,7 +211,7 @@ trait Constants extends api.Constants {
case '"' => "\\\""
case '\'' => "\\\'"
case '\\' => "\\\\"
- case _ => if (ch.isControl) "\\0" + toOctalString(ch.toInt) else String.valueOf(ch)
+ case _ => if (ch.isControl) "\\u%04X".format(ch.toInt) else String.valueOf(ch)
}
def escapedStringValue: String = {
diff --git a/src/reflect/scala/reflect/internal/Definitions.scala b/src/reflect/scala/reflect/internal/Definitions.scala
index fe6d88e7c7..0342daf113 100644
--- a/src/reflect/scala/reflect/internal/Definitions.scala
+++ b/src/reflect/scala/reflect/internal/Definitions.scala
@@ -837,9 +837,9 @@ trait Definitions extends api.StandardDefinitions {
* The class defining the method is a supertype of `tp` that
* has a public no-arg primary constructor.
*/
- def samOf(tp: Type): Symbol = if (!doSam) NoSymbol else {
+ def samOf(tp: Type): Symbol = if (!doSam) NoSymbol else if (!isNonRefinementClassType(unwrapToClass(tp))) NoSymbol else {
// look at erased type because we (only) care about what ends up in bytecode
- // (e.g., an alias type or intersection type is fine as long as the intersection dominator compiles to an interface)
+ // (e.g., an alias type is fine as long as is compiles to a single-abstract-method)
val tpSym: Symbol = erasure.javaErasure(tp).typeSymbol
if (tpSym.exists && tpSym.isClass
diff --git a/src/reflect/scala/reflect/internal/Printers.scala b/src/reflect/scala/reflect/internal/Printers.scala
index 37b99c4345..9602a2859b 100644
--- a/src/reflect/scala/reflect/internal/Printers.scala
+++ b/src/reflect/scala/reflect/internal/Printers.scala
@@ -1045,23 +1045,23 @@ trait Printers extends api.Printers { self: SymbolTable =>
print("")
}
- case l @ Literal(x) =>
- import Chars.LF
- x match {
- case Constant(v: String) if {
- val strValue = x.stringValue
- strValue.contains(LF) && strValue.contains("\"\"\"") && strValue.size > 1
- } =>
- val splitValue = x.stringValue.split(s"$LF").toList
- val multilineStringValue = if (x.stringValue.endsWith(s"$LF")) splitValue :+ "" else splitValue
- val trQuotes = "\"\"\""
- print(trQuotes); printSeq(multilineStringValue) { print(_) } { print(LF) }; print(trQuotes)
- case _ =>
- // processing Float constants
- val printValue = x.escapedStringValue + (if (x.value.isInstanceOf[Float]) "F" else "")
- print(printValue)
+ case Literal(k @ Constant(s: String)) if s.contains(Chars.LF) =>
+ val tq = "\"" * 3
+ val lines = s.lines.toList
+ if (lines.lengthCompare(1) <= 0) print(k.escapedStringValue)
+ else {
+ val tqp = """["]{3}""".r
+ val tqq = """""\\"""" // ""\" is triple-quote quoted
+ print(tq)
+ printSeq(lines.map(x => tqp.replaceAllIn(x, tqq)))(print(_))(print(Chars.LF))
+ print(tq)
}
+ case Literal(x) =>
+ // processing Float constants
+ val suffix = x.value match { case _: Float => "F" case _ => "" }
+ print(s"${x.escapedStringValue}${suffix}")
+
case an @ Annotated(ap, tree) =>
val printParentheses = needsParentheses(tree)()
parenthesize(printParentheses) { print(tree) }; print(if (tree.isType) " " else ": ")
diff --git a/src/reflect/scala/reflect/internal/StdNames.scala b/src/reflect/scala/reflect/internal/StdNames.scala
index 4f5a545c95..11b5db9793 100644
--- a/src/reflect/scala/reflect/internal/StdNames.scala
+++ b/src/reflect/scala/reflect/internal/StdNames.scala
@@ -1171,6 +1171,7 @@ trait StdNames {
final val Invoke: TermName = newTermName("invoke")
final val InvokeExact: TermName = newTermName("invokeExact")
+ final val Metafactory: TermName = newTermName("metafactory")
final val AltMetafactory: TermName = newTermName("altMetafactory")
final val Bootstrap: TermName = newTermName("bootstrap")
diff --git a/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala b/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala
index 8ea8c4deff..2152ce234a 100644
--- a/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/ScaladocAnalyzer.scala
@@ -101,52 +101,6 @@ trait ScaladocAnalyzer extends Analyzer {
abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends SyntaxAnalyzer {
import global._
- class ScaladocJavaUnitParser(unit: CompilationUnit) extends {
- override val in = new ScaladocJavaUnitScanner(unit)
- } with JavaUnitParser(unit) { }
-
- class ScaladocJavaUnitScanner(unit: CompilationUnit) extends JavaUnitScanner(unit) {
- /** buffer for the documentation comment
- */
- var docBuffer: StringBuilder = null
-
- /** add the given character to the documentation buffer
- */
- protected def putDocChar(c: Char) {
- if (docBuffer ne null) docBuffer.append(c)
- }
-
- override protected def skipComment(): Boolean = {
- if (in.ch == '/') {
- do {
- in.next
- } while ((in.ch != CR) && (in.ch != LF) && (in.ch != SU))
- true
- } else if (in.ch == '*') {
- docBuffer = null
- in.next
- val scaladoc = ("/**", "*/")
- if (in.ch == '*')
- docBuffer = new StringBuilder(scaladoc._1)
- do {
- do {
- if (in.ch != '*' && in.ch != SU) {
- in.next; putDocChar(in.ch)
- }
- } while (in.ch != '*' && in.ch != SU)
- while (in.ch == '*') {
- in.next; putDocChar(in.ch)
- }
- } while (in.ch != '/' && in.ch != SU)
- if (in.ch == '/') in.next
- else incompleteInputError("unclosed comment")
- true
- } else {
- false
- }
- }
- }
-
class ScaladocUnitScanner(unit0: CompilationUnit, patches0: List[BracePatch]) extends UnitScanner(unit0, patches0) {
private var docBuffer: StringBuilder = null // buffer for comments (non-null while scanning)
@@ -259,4 +213,77 @@ abstract class ScaladocSyntaxAnalyzer[G <: Global](val global: G) extends Syntax
else trees
}
}
+
+ class ScaladocJavaUnitScanner(unit: CompilationUnit) extends JavaUnitScanner(unit) {
+
+ private val docBuffer: StringBuilder = new StringBuilder
+ private var inDocComment = false
+ private var docStart: Int = 0
+ private var lastDoc: DocComment = null
+
+ // get last doc comment
+ def flushDoc(): DocComment = try lastDoc finally lastDoc = null
+
+ override protected def putCommentChar(): Unit = {
+ if (inDocComment) docBuffer append in.ch
+ in.next
+ }
+
+ override protected def skipBlockComment(isDoc: Boolean): Unit = {
+ // condition is true when comment is entered the first time,
+ // i.e. immediately after "/*" and when current character is "*"
+ if (!inDocComment && isDoc) {
+ docBuffer append "/*"
+ docStart = currentPos.start
+ inDocComment = true
+ }
+ super.skipBlockComment(isDoc)
+ }
+
+ override protected def skipComment(): Boolean = {
+ val skipped = super.skipComment()
+ if (skipped && inDocComment) {
+ val raw = docBuffer.toString
+ val position = Position.range(unit.source, docStart, docStart, in.cpos)
+ lastDoc = DocComment(raw, position)
+ signalParsedDocComment(raw, position)
+ docBuffer.setLength(0) // clear buffer
+ inDocComment = false
+ true
+ } else {
+ skipped
+ }
+ }
+
+ }
+
+ class ScaladocJavaUnitParser(unit: CompilationUnit) extends {
+ override val in = new ScaladocJavaUnitScanner(unit)
+ } with JavaUnitParser(unit) {
+
+ override def joinComment(trees: => List[Tree]): List[Tree] = {
+ val doc = in.flushDoc()
+
+ if ((doc ne null) && doc.raw.length > 0) {
+ log(s"joinComment(doc=$doc)")
+ val joined = trees map { t =>
+ DocDef(doc, t) setPos {
+ if (t.pos.isDefined) {
+ val pos = doc.pos.withEnd(t.pos.end)
+ pos.makeTransparent
+ } else {
+ t.pos
+ }
+ }
+ }
+ joined.find(_.pos.isOpaqueRange) foreach { main =>
+ val mains = List(main)
+ joined foreach { t => if (t ne main) ensureNonOverlapping(t, mains) }
+ }
+ joined
+ } else {
+ trees
+ }
+ }
+ }
}
diff --git a/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala b/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala
index 10bfe6f94b..625d074df5 100644
--- a/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/ScaladocGlobal.scala
@@ -13,6 +13,7 @@ trait ScaladocGlobalTrait extends Global {
override val useOffsetPositions = false
override def newUnitParser(unit: CompilationUnit) = new syntaxAnalyzer.ScaladocUnitParser(unit, Nil)
+ override def newJavaUnitParser(unit: CompilationUnit) = new syntaxAnalyzer.ScaladocJavaUnitParser(unit)
override lazy val syntaxAnalyzer = new ScaladocSyntaxAnalyzer[outer.type](outer) {
val runsAfter = List[String]()
@@ -40,6 +41,8 @@ class ScaladocGlobal(settings: doc.Settings, reporter: Reporter) extends Global(
phasesSet += analyzer.typerFactory
}
override def forScaladoc = true
+ override def createJavadoc = true
+
override lazy val analyzer = new {
val global: ScaladocGlobal.this.type = ScaladocGlobal.this
} with ScaladocAnalyzer
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/IndexScript.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/IndexScript.scala
index 6b24c0f568..8f58a7b845 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/page/IndexScript.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/IndexScript.scala
@@ -10,7 +10,6 @@ package page
import scala.tools.nsc.doc
import scala.tools.nsc.doc.model.{Package, DocTemplateEntity}
import scala.tools.nsc.doc.html.{Page, HtmlFactory}
-import scala.util.parsing.json.{JSONObject, JSONArray, JSONType}
class IndexScript(universe: doc.Universe) extends Page {
import model._
@@ -21,7 +20,7 @@ class IndexScript(universe: doc.Universe) extends Page {
override def writeFor(site: HtmlFactory) {
writeFile(site) {
- _.write("Index.PACKAGES = " + packages.toString() + ";")
+ _.write(s"Index.PACKAGES = $packages;")
}
}
@@ -30,7 +29,7 @@ class IndexScript(universe: doc.Universe) extends Page {
case (pack, templates) => {
val merged = mergeByQualifiedName(templates)
- val ary = merged.keys.toList.sortBy(_.toLowerCase).map { key =>
+ val ary = merged.keys.toVector.sortBy(_.toLowerCase).map { key =>
/** One pair is generated for the class/trait and one for the
* companion object, both will have the same {"name": key}
*
@@ -44,7 +43,7 @@ class IndexScript(universe: doc.Universe) extends Page {
Seq(
kind -> relativeLinkTo(t),
"kind" -> kind,
- s"members_$kind" -> membersToJSON(t.members.filter(!_.isShadowedOrAmbiguousImplicit), t),
+ s"members_$kind" -> membersToJSON(t.members.toVector.filter(!_.isShadowedOrAmbiguousImplicit), t),
"shortDescription" -> shortDesc(t))
}
@@ -58,18 +57,18 @@ class IndexScript(universe: doc.Universe) extends Page {
JSONObject(Map(pairs : _*))
}
- def mergeByQualifiedName(source: List[DocTemplateEntity]) = {
- var result = Map[String, List[DocTemplateEntity]]()
+ private def mergeByQualifiedName(source: List[DocTemplateEntity]): collection.mutable.Map[String, List[DocTemplateEntity]] = {
+ val result = collection.mutable.Map[String, List[DocTemplateEntity]]()
for (t <- source) {
val k = t.qualifiedName
- result += k -> (result.getOrElse(k, List()) :+ t)
+ result += k -> (result.getOrElse(k, Nil) :+ t)
}
result
}
- def allPackages = {
+ def allPackages: List[Package] = {
def f(parent: Package): List[Package] = {
parent.packages.flatMap(
p => f(p) :+ p
@@ -78,7 +77,7 @@ class IndexScript(universe: doc.Universe) extends Page {
f(universe.rootPackage).sortBy(_.toString)
}
- def allPackagesWithTemplates = {
+ def allPackagesWithTemplates: Map[Package, List[DocTemplateEntity]] = {
Map(allPackages.map((key) => {
key -> key.templates.collect {
case t: DocTemplateEntity if !t.isPackage && !universe.settings.hardcoded.isExcluded(t.qualifiedName) => t
@@ -92,8 +91,8 @@ class IndexScript(universe: doc.Universe) extends Page {
}
/** Returns the json representation of the supplied members */
- def membersToJSON(entities: List[MemberEntity], parent: DocTemplateEntity): JSONType =
- JSONArray(entities map (memberToJSON(_, parent)))
+ def membersToJSON(entities: Vector[MemberEntity], parent: DocTemplateEntity): JSONArray =
+ JSONArray(entities.map(memberToJSON(_, parent)))
private def memberToJSON(mbr: MemberEntity, parent: DocTemplateEntity): JSONObject = {
/** This function takes a member and gets eventual parameters and the
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/JSON.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/JSON.scala
new file mode 100644
index 0000000000..5f6cb7e799
--- /dev/null
+++ b/src/scaladoc/scala/tools/nsc/doc/html/page/JSON.scala
@@ -0,0 +1,56 @@
+package scala.tools.nsc.doc.html.page
+
+import JSONFormat.format
+
+private[page] object JSONFormat {
+
+ def format(x: Any): String = x match {
+ case s: String => s"""\"${quoteString(s)}\""""
+ case jo: JSONObject => jo.toString
+ case ja: JSONArray => ja.toString
+ case other => throw new UnsupportedOperationException(s"Value $other of class ${other.getClass} cannot be formatted.")
+ }
+
+ /** This function can be used to properly quote Strings for JSON output. */
+ def quoteString(s: String): String = {
+ val len: Int = s.length
+ val buf = new StringBuilder(len + len/4)
+ var i: Int = 0
+ while (i < len) {
+ s.apply(i) match {
+ case '"' => buf ++= "\\\""
+ case '\\' => buf ++= "\\\\"
+ case '/' => buf ++= "\\/"
+ case '\b' => buf ++= "\\b"
+ case '\f' => buf ++= "\\f"
+ case '\n' => buf ++= "\\n"
+ case '\r' => buf ++= "\\r"
+ case '\t' => buf ++= "\\t"
+ /* We'll unicode escape any control characters. These include:
+ * 0x00 -> 0x1f : ASCII Control (C0 Control Codes)
+ * 0x7f : ASCII DELETE
+ * 0x80 -> 0x9f : C1 Control Codes
+ *
+ * Per RFC4627, section 2.5, we're not technically required to
+ * encode the C1 codes, but we do to be safe.
+ */
+ case c if ((c >= '\u0000' && c <= '\u001f') || (c >= '\u007f' && c <= '\u009f')) =>
+ val cint = c.toInt
+ buf ++= f"\\u$cint%04x"
+ case c => buf += c
+ }
+ i += 1
+ }
+ buf.toString()
+ }
+}
+
+/** Represents a JSON Object (map). */
+private[page] case class JSONObject(obj: Map[String,Any]) {
+ override def toString = obj.map({ case (k,v) => format(k) + " : " + format(v) }).mkString("{", ", ", "}")
+}
+
+/** Represents a JSON Array (vector). */
+private[page] case class JSONArray(vector: Vector[Any]) {
+ override def toString = vector.map(format).mkString("[", ", ", "]")
+}
diff --git a/src/scaladoc/scala/tools/partest/ScaladocModelTest.scala b/src/scaladoc/scala/tools/partest/ScaladocModelTest.scala
index 1ad3b3ff2b..44c1146a14 100644
--- a/src/scaladoc/scala/tools/partest/ScaladocModelTest.scala
+++ b/src/scaladoc/scala/tools/partest/ScaladocModelTest.scala
@@ -81,7 +81,7 @@ abstract class ScaladocModelTest extends DirectTest {
private[this] var settings: doc.Settings = null
// create a new scaladoc compiler
- private[this] def newDocFactory: DocFactory = {
+ def newDocFactory: DocFactory = {
settings = new doc.Settings(_ => ())
settings.scaladocQuietRun = true // yaay, no more "model contains X documentable templates"!
val args = extraSettings + " " + scaladocSettings
diff --git a/test/benchmarks/build.sbt b/test/benchmarks/build.sbt
index 31cee701ad..fb05fb2c99 100644
--- a/test/benchmarks/build.sbt
+++ b/test/benchmarks/build.sbt
@@ -1,6 +1,6 @@
scalaHome := Some(file("../../build/pack"))
scalaVersion := "2.12.0-dev"
-scalacOptions ++= Seq("-feature", "-Yopt:l:classpath")
+scalacOptions ++= Seq("-feature", "-opt:l:classpath")
lazy val root = (project in file(".")).
enablePlugins(JmhPlugin).
diff --git a/test/files/instrumented/InstrumentationTest.check b/test/files/instrumented/InstrumentationTest.check
index 74f9c9d268..d317fc4207 100644
--- a/test/files/instrumented/InstrumentationTest.check
+++ b/test/files/instrumented/InstrumentationTest.check
@@ -6,5 +6,5 @@ Method call statistics:
1 instrumented/Foo2.someMethod()I
1 scala/DeprecatedConsole.<init>()V
1 scala/Predef$.println(Ljava/lang/Object;)V
- 1 scala/io/AnsiColor.$init$()V
+ 1 scala/io/AnsiColor.$init$(Lscala/io/AnsiColor;)V
1 scala/runtime/BoxesRunTime.boxToBoolean(Z)Ljava/lang/Boolean;
diff --git a/test/files/jvm/annotations.check b/test/files/jvm/annotations.check
index a8dc5ecdd1..43f85ca199 100644
--- a/test/files/jvm/annotations.check
+++ b/test/files/jvm/annotations.check
@@ -1,3 +1,6 @@
+annotations.scala:7: warning: class remote in package scala is deprecated (since 2.12.0): extend java.rmi.Remote instead and add @throws[java.rmi.RemoteException] to public methods
+ def foo: Unit = ()
+ ^
class java.rmi.RemoteException
class java.io.IOException
@java.lang.Deprecated()
diff --git a/test/files/jvm/annotations.flags b/test/files/jvm/annotations.flags
new file mode 100644
index 0000000000..c36e713ab8
--- /dev/null
+++ b/test/files/jvm/annotations.flags
@@ -0,0 +1 @@
+-deprecation \ No newline at end of file
diff --git a/test/files/neg/sammy_restrictions.check b/test/files/neg/sammy_restrictions.check
index 09579cbe21..0225c61ac1 100644
--- a/test/files/neg/sammy_restrictions.check
+++ b/test/files/neg/sammy_restrictions.check
@@ -1,51 +1,62 @@
-sammy_restrictions.scala:35: error: type mismatch;
+sammy_restrictions.scala:38: error: type mismatch;
found : () => Int
required: NoAbstract
(() => 0) : NoAbstract
^
-sammy_restrictions.scala:36: error: type mismatch;
+sammy_restrictions.scala:39: error: type mismatch;
found : Int => Int
required: TwoAbstract
((x: Int) => 0): TwoAbstract
^
-sammy_restrictions.scala:37: error: type mismatch;
+sammy_restrictions.scala:40: error: type mismatch;
found : Int => Int
required: NoEmptyConstructor
((x: Int) => 0): NoEmptyConstructor
^
-sammy_restrictions.scala:38: error: type mismatch;
+sammy_restrictions.scala:41: error: type mismatch;
found : Int => Int
required: MultipleConstructorLists
((x: Int) => 0): MultipleConstructorLists
^
-sammy_restrictions.scala:39: error: type mismatch;
+sammy_restrictions.scala:42: error: type mismatch;
found : Int => Int
required: OneEmptySecondaryConstructor
((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call.
^
-sammy_restrictions.scala:40: error: type mismatch;
+sammy_restrictions.scala:43: error: type mismatch;
found : Int => Int
required: MultipleMethodLists
((x: Int) => 0): MultipleMethodLists
^
-sammy_restrictions.scala:41: error: type mismatch;
+sammy_restrictions.scala:44: error: type mismatch;
found : Int => Int
required: ImplicitConstructorParam
((x: Int) => 0): ImplicitConstructorParam
^
-sammy_restrictions.scala:42: error: type mismatch;
+sammy_restrictions.scala:45: error: type mismatch;
found : Int => Int
required: ImplicitMethodParam
((x: Int) => 0): ImplicitMethodParam
^
-sammy_restrictions.scala:43: error: type mismatch;
+sammy_restrictions.scala:46: error: type mismatch;
found : Int => Int
required: PolyMethod
((x: Int) => 0): PolyMethod
^
-sammy_restrictions.scala:44: error: type mismatch;
+sammy_restrictions.scala:47: error: type mismatch;
found : Int => Int
required: SelfTp
((x: Int) => 0): SelfTp
^
-10 errors found
+sammy_restrictions.scala:48: error: type mismatch;
+ found : Int => Int
+ required: T1 with U1
+ ((x: Int) => 0): T1 with U1
+ ^
+sammy_restrictions.scala:49: error: type mismatch;
+ found : Int => Int
+ required: Test.NonClassTypeRefinement
+ (which expands to) DerivedOneAbstract with OneAbstract
+ ((x: Int) => 0): NonClassTypeRefinement
+ ^
+12 errors found
diff --git a/test/files/neg/sammy_restrictions.scala b/test/files/neg/sammy_restrictions.scala
index ff2c16b679..dee4f1f247 100644
--- a/test/files/neg/sammy_restrictions.scala
+++ b/test/files/neg/sammy_restrictions.scala
@@ -27,9 +27,12 @@ abstract class DerivedOneAbstract extends OneAbstract
abstract class SelfTp { self: NoAbstract => def ap(a: Int): Any }
abstract class SelfVar { self => def ap(a: Int): Any }
+trait T1 { def t(a: Int): Int }; trait U1
+
object Test {
implicit val s: String = ""
- type NonClassType = DerivedOneAbstract with OneAbstract
+ type NonClassTypeRefinement = DerivedOneAbstract with OneAbstract
+ type NonClassType = DerivedOneAbstract
// errors:
(() => 0) : NoAbstract
@@ -42,6 +45,8 @@ object Test {
((x: Int) => 0): ImplicitMethodParam
((x: Int) => 0): PolyMethod
((x: Int) => 0): SelfTp
+ ((x: Int) => 0): T1 with U1
+ ((x: Int) => 0): NonClassTypeRefinement
// allowed:
((x: Int) => 0): OneEmptyConstructor
diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check
index ac0854f810..721923e0ba 100644
--- a/test/files/neg/t4851.check
+++ b/test/files/neg/t4851.check
@@ -17,13 +17,13 @@ S.scala:4: warning: Adapting argument list by creating a 5-tuple: this may not b
val x3 = new J(1, 2, 3, 4, 5)
^
S.scala:6: warning: Adapting argument list by creating a 3-tuple: this may not be what you want.
- signature: Some.apply[A](x: A): Some[A]
+ signature: Some.apply[A](value: A): Some[A]
given arguments: 1, 2, 3
after adaptation: Some((1, 2, 3): (Int, Int, Int))
val y1 = Some(1, 2, 3)
^
S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not be what you want.
- signature: Some(x: A): Some[A]
+ signature: Some(value: A): Some[A]
given arguments: 1, 2, 3
after adaptation: new Some((1, 2, 3): (Int, Int, Int))
val y2 = new Some(1, 2, 3)
diff --git a/test/files/neg/t7294.check b/test/files/neg/t7294.check
index f15289c1c0..a308f2457d 100644
--- a/test/files/neg/t7294.check
+++ b/test/files/neg/t7294.check
@@ -1,6 +1,10 @@
t7294.scala:4: warning: fruitless type test: a value of type (Int, Int) cannot also be a Seq[A]
(1, 2) match { case Seq() => 0; case _ => 1 }
^
-error: No warnings can be incurred under -Xfatal-warnings.
+t7294.scala:4: error: pattern type is incompatible with expected type;
+ found : Seq[A]
+ required: (Int, Int)
+ (1, 2) match { case Seq() => 0; case _ => 1 }
+ ^
one warning found
one error found
diff --git a/test/files/neg/t7294.flags b/test/files/neg/t7294.flags
deleted file mode 100644
index 3f3381a45b..0000000000
--- a/test/files/neg/t7294.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xfuture -Xfatal-warnings
diff --git a/test/files/neg/t7294b.check b/test/files/neg/t7294b.check
index 707266f0cc..3390cb7278 100644
--- a/test/files/neg/t7294b.check
+++ b/test/files/neg/t7294b.check
@@ -1,6 +1,4 @@
-t7294b.scala:1: warning: inheritance from class Tuple2 in package scala is deprecated (since 2.11.0): Tuples will be made final in a future version.
+t7294b.scala:1: error: illegal inheritance from final class Tuple2
class C extends Tuple2[Int, Int](0, 0)
^
-error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
one error found
diff --git a/test/files/neg/t7294b.flags b/test/files/neg/t7294b.flags
deleted file mode 100644
index d1b831ea87..0000000000
--- a/test/files/neg/t7294b.flags
+++ /dev/null
@@ -1 +0,0 @@
--deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t9849.check b/test/files/neg/t9849.check
new file mode 100644
index 0000000000..7b47150846
--- /dev/null
+++ b/test/files/neg/t9849.check
@@ -0,0 +1,7 @@
+t9849.scala:14: error: method h in object O cannot be accessed in object p.O
+ O.h()
+ ^
+t9849.scala:15: error: method h$default$1 in object O cannot be accessed in object p.O
+ O.h$default$1
+ ^
+two errors found
diff --git a/test/files/neg/t9849.scala b/test/files/neg/t9849.scala
new file mode 100644
index 0000000000..bcd18b6916
--- /dev/null
+++ b/test/files/neg/t9849.scala
@@ -0,0 +1,16 @@
+package p
+
+object O {
+ protected[p] def f(x: Int = 1) = x
+ private[p] def g(x: Int = 1) = x
+ private def h(x: Int = 1) = x
+}
+
+object Test {
+ O.f()
+ O.f$default$1
+ O.g()
+ O.g$default$1
+ O.h()
+ O.h$default$1
+}
diff --git a/test/files/neg/trait-defaults-super.check b/test/files/neg/trait-defaults-super.check
new file mode 100644
index 0000000000..2b19402828
--- /dev/null
+++ b/test/files/neg/trait-defaults-super.check
@@ -0,0 +1,4 @@
+trait-defaults-super.scala:14: error: Unable to implement a super accessor required by trait T unless Iterable[String] is directly extended by class C.
+class C extends T
+ ^
+one error found
diff --git a/test/files/neg/trait-defaults-super.scala b/test/files/neg/trait-defaults-super.scala
new file mode 100644
index 0000000000..def271e8e7
--- /dev/null
+++ b/test/files/neg/trait-defaults-super.scala
@@ -0,0 +1,21 @@
+trait T extends java.lang.Iterable[String] {
+
+ override def spliterator(): java.util.Spliterator[String] = {
+ super[Iterable].spliterator
+ super.spliterator
+ null
+ }
+ def foo = {
+ super[Iterable].spliterator
+ super.spliterator
+ }
+ def iterator(): java.util.Iterator[String] = java.util.Collections.emptyList().iterator()
+}
+class C extends T
+object Test {
+ def main(args: Array[String]): Unit = {
+ val t: T = new C
+ t.spliterator
+ t.foo
+ }
+}
diff --git a/test/files/pos/t482.scala b/test/files/pos/t482.scala
new file mode 100644
index 0000000000..b121c93337
--- /dev/null
+++ b/test/files/pos/t482.scala
@@ -0,0 +1,7 @@
+object Test {
+ class Foo { val z = "foo"; val y : z.type = z }
+
+ val x : ({ val y : z.type } forSome { val z : String }) = new Foo
+
+ val x2 : ({ val y : T } forSome { type T <: String with Singleton }) = new Foo
+}
diff --git a/test/files/pos/t4914.scala b/test/files/pos/t4914.scala
new file mode 100644
index 0000000000..a6c8ef5a4e
--- /dev/null
+++ b/test/files/pos/t4914.scala
@@ -0,0 +1,20 @@
+trait Type {
+ type S
+}
+
+class ConcreteType extends Type {
+ type S = Double
+}
+
+trait Base {
+ type T <: Type
+ val m: Map[t#S, t#S] forSome { type t <: T with Singleton }
+ val n: Map[x.type#S, x.type#S] forSome { val x: T }
+}
+
+abstract class Derived extends Base {
+ override type T = ConcreteType
+ override val m = Map[Double, Double]()
+ /** This does not work. §3.2.10 indicates that types n is shorthand for type of m. */
+ override val n = Map[Double, Double]()
+}
diff --git a/test/files/pos/t7294.scala b/test/files/pos/t7294.scala
deleted file mode 100644
index ccac2b1400..0000000000
--- a/test/files/pos/t7294.scala
+++ /dev/null
@@ -1,6 +0,0 @@
-object Test {
- // no fruitless warning as Tuple2 isn't (yet) final.
- // The corresponding `neg` test will treat it as final
- // for the purposes of these tests under -Xfuture.
- (1, 2) match { case Seq() => 0; case _ => 1 }
-}
diff --git a/test/files/pos/t9855.scala b/test/files/pos/t9855.scala
new file mode 100644
index 0000000000..b6ac3e2432
--- /dev/null
+++ b/test/files/pos/t9855.scala
@@ -0,0 +1,10 @@
+class C {
+ def xx(verb: String, a: Array[Int]) {
+ val reYYYY = """(\d\d\d\d)""".r
+ verb match {
+ case "time" if a.isEmpty =>
+ case "time" =>
+ case reYYYY(y) =>
+ }
+ }
+}
diff --git a/test/files/pos/t9855b.scala b/test/files/pos/t9855b.scala
new file mode 100644
index 0000000000..30c58be3dc
--- /dev/null
+++ b/test/files/pos/t9855b.scala
@@ -0,0 +1,16 @@
+object Test {
+ var FALSE = false
+ def main(args: Array[String]): Unit = {
+ val SomeB = new B
+ new B() match {
+ case SomeB if FALSE =>
+ case SomeB =>
+ case Ext(_) =>
+ }
+ }
+}
+object Ext {
+ def unapply(s: A) = Some(())
+}
+class A
+class B extends A
diff --git a/test/files/pos/tcpoly_bounds1.scala b/test/files/pos/tcpoly_bounds1.scala
index 63263cb152..4f52f55cb6 100644
--- a/test/files/pos/tcpoly_bounds1.scala
+++ b/test/files/pos/tcpoly_bounds1.scala
@@ -1,7 +1,9 @@
-class Foo[t[x]<: Tuple2[Int, x]]
+case class T2[+T1, +T2](_1: T1, _2: T2) extends Product2[T1, T2]
+
+class Foo[t[x]<: T2[Int, x]]
//
-class MyPair[z](a: Int, b: z) extends Tuple2[Int, z](a,b)
+class MyPair[z](a: Int, b: z) extends T2[Int, z](a,b)
object foo extends Foo[MyPair]
diff --git a/test/files/pos/trait-defaults-super.scala b/test/files/pos/trait-defaults-super.scala
new file mode 100644
index 0000000000..8f867ab563
--- /dev/null
+++ b/test/files/pos/trait-defaults-super.scala
@@ -0,0 +1,21 @@
+trait T extends java.lang.Iterable[String] {
+
+ override def spliterator(): java.util.Spliterator[String] = {
+ super[Iterable].spliterator
+ super.spliterator
+ null
+ }
+ def foo = {
+ super[Iterable].spliterator
+ super.spliterator
+ }
+ def iterator(): java.util.Iterator[String] = java.util.Collections.emptyList().iterator()
+}
+class C extends T with java.lang.Iterable[String] // super accessor is okay with Iterable as a direct parent
+object Test {
+ def main(args: Array[String]): Unit = {
+ val t: T = new C
+ t.spliterator
+ t.foo
+ }
+}
diff --git a/test/files/presentation/callcc-interpreter/Runner.scala b/test/files/presentation/callcc-interpreter/Runner.scala
index 1ef3cf9025..a5698be5c2 100644
--- a/test/files/presentation/callcc-interpreter/Runner.scala
+++ b/test/files/presentation/callcc-interpreter/Runner.scala
@@ -1,3 +1,6 @@
import scala.tools.nsc.interactive.tests._
-object Test extends InteractiveTest \ No newline at end of file
+object Test extends InteractiveTest {
+ // Normalize ordering of LUB
+ override def normalize(s: String) = s.replace("Serializable with Product", "Product with Serializable")
+}
diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala
index ce431910ee..8c60af557b 100644
--- a/test/files/presentation/doc/doc.scala
+++ b/test/files/presentation/doc/doc.scala
@@ -62,7 +62,7 @@ object Test extends InteractiveTest {
def getComment(sym: Symbol, source: SourceFile, fragments: List[(Symbol,SourceFile)]): Option[Comment] = {
val docResponse = new Response[(String, String, Position)]
askDocComment(sym, source, sym.owner, fragments, docResponse)
- docResponse.get.left.toOption flatMap {
+ docResponse.get.swap.toOption flatMap {
case (expanded, raw, pos) =>
if (expanded.isEmpty)
None
@@ -85,13 +85,13 @@ object Test extends InteractiveTest {
val batch = new BatchSourceFile(source.file, newText.toCharArray)
val reloadResponse = new Response[Unit]
compiler.askReload(List(batch), reloadResponse)
- reloadResponse.get.left.toOption match {
+ reloadResponse.get.swap.toOption match {
case None =>
println("Couldn't reload")
case Some(_) =>
val parseResponse = new Response[Tree]
askParsedEntered(batch, true, parseResponse)
- parseResponse.get.left.toOption match {
+ parseResponse.get.swap.toOption match {
case None =>
println("Couldn't parse")
case Some(_) =>
diff --git a/test/files/presentation/t7678/Runner.scala b/test/files/presentation/t7678/Runner.scala
index 14d6dc2a70..c6736a65b0 100644
--- a/test/files/presentation/t7678/Runner.scala
+++ b/test/files/presentation/t7678/Runner.scala
@@ -7,7 +7,7 @@ object Test extends InteractiveTest {
override def runDefaultTests() {
def resolveTypeTagHyperlink() {
- val sym = compiler.askForResponse(() => compiler.currentRun.runDefinitions.TypeTagClass).get.left.get
+ val sym = compiler.askForResponse(() => compiler.currentRun.runDefinitions.TypeTagClass).get.swap.getOrElse(???)
val r = new Response[Position]
compiler.askLinkPos(sym, new BatchSourceFile("", source), r)
r.get
diff --git a/test/files/run/classfile-format-51.scala b/test/files/run/classfile-format-51.scala
index 3a6c4861f1..40eebee198 100644
--- a/test/files/run/classfile-format-51.scala
+++ b/test/files/run/classfile-format-51.scala
@@ -80,7 +80,7 @@ object Test extends DirectTest {
val test = cw.visitMethod(ACC_PUBLIC + ACC_FINAL, "test", s"()Ljava/lang/String;", null, null)
test.visitCode()
- val bootstrapHandle = new Handle(H_INVOKESTATIC, invokerClassName, bootstrapMethodName, bootStrapMethodType)
+ val bootstrapHandle = new Handle(H_INVOKESTATIC, invokerClassName, bootstrapMethodName, bootStrapMethodType, /* itf = */ false)
test.visitInvokeDynamicInsn("invoke", targetMethodType, bootstrapHandle)
test.visitInsn(ARETURN)
test.visitMaxs(1, 1)
diff --git a/test/files/run/lambda-serialization.scala b/test/files/run/lambda-serialization.scala
index 0eee1193d7..08e235b1cb 100644
--- a/test/files/run/lambda-serialization.scala
+++ b/test/files/run/lambda-serialization.scala
@@ -1,6 +1,6 @@
import java.io.{ByteArrayInputStream, ObjectInputStream, ObjectOutputStream, ByteArrayOutputStream}
-trait IntToString { def apply(i: Int): String }
+trait IntToString extends java.io.Serializable { def apply(i: Int): String }
object Test {
def main(args: Array[String]): Unit = {
diff --git a/test/files/run/noInlineUnknownIndy/Test.scala b/test/files/run/noInlineUnknownIndy/Test.scala
index c6d227b6f2..a666146f15 100644
--- a/test/files/run/noInlineUnknownIndy/Test.scala
+++ b/test/files/run/noInlineUnknownIndy/Test.scala
@@ -15,7 +15,12 @@ object Test extends DirectTest {
}
def show(): Unit = {
- val unknownBootstrapMethod = new Handle(Opcodes.H_INVOKESTATIC, "not/java/lang/SomeLambdaMetafactory", "notAMetaFactoryMethod", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;")
+ val unknownBootstrapMethod = new Handle(
+ Opcodes.H_INVOKESTATIC,
+ "not/java/lang/SomeLambdaMetafactory",
+ "notAMetaFactoryMethod",
+ "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;",
+ /* itf = */ false)
modifyClassFile(new File(testOutput.toFile, "A_1.class"))((cn: ClassNode) => {
val testMethod = cn.methods.iterator.asScala.find(_.name == "test").head
val indy = testMethod.instructions.iterator.asScala.collect({ case i: InvokeDynamicInsnNode => i }).next()
diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check
index 67317d2072..4c20727ea8 100644
--- a/test/files/run/reflection-java-annotations.check
+++ b/test/files/run/reflection-java-annotations.check
@@ -1,4 +1,3 @@
-warning: there was one deprecation warning (since 2.11.0); re-run with -deprecation for details
-List(JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee_1], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
+List(JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee_1], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\u0017', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\u0003', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
=======
-new JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = Array(101, 101), v102 = Array(102, 102), v103 = Array('g', 'g'), v104 = Array(104, 104), v105 = Array(105L, 105L), v106 = Array(106.0, 106.0), v107 = Array(107.0, 107.0), v108 = Array(false, true), v11 = classOf[JavaAnnottee_1], v110 = Array("hello", "world"), v111 = Array(classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]), v112 = Array(FOO, BAR), v113 = Array(new JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)), v12 = FOO, v13 = new JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)
+new JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = Array(101, 101), v102 = Array(102, 102), v103 = Array('g', 'g'), v104 = Array(104, 104), v105 = Array(105L, 105L), v106 = Array(106.0, 106.0), v107 = Array(107.0, 107.0), v108 = Array(false, true), v11 = classOf[JavaAnnottee_1], v110 = Array("hello", "world"), v111 = Array(classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]), v112 = Array(FOO, BAR), v113 = Array(new JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\u0017', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)), v12 = FOO, v13 = new JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\u0003', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)
diff --git a/test/files/run/reflection-java-annotations/Test_2.scala b/test/files/run/reflection-java-annotations/Test_2.scala
index dec5b45ca7..6d457ebe64 100644
--- a/test/files/run/reflection-java-annotations/Test_2.scala
+++ b/test/files/run/reflection-java-annotations/Test_2.scala
@@ -2,8 +2,8 @@ object Test extends App {
import scala.reflect.runtime.universe._
val sym = typeOf[JavaAnnottee_1].typeSymbol
sym.info
- sym.annotations foreach (_.javaArgs)
+ sym.annotations foreach (_.tree.children.tail)
println(sym.annotations)
println("=======")
sym.annotations.map(_.tree).map(println)
-} \ No newline at end of file
+}
diff --git a/test/files/run/sammy_seriazable.scala b/test/files/run/sammy_seriazable.scala
new file mode 100644
index 0000000000..458b99238a
--- /dev/null
+++ b/test/files/run/sammy_seriazable.scala
@@ -0,0 +1,47 @@
+import java.io._
+
+trait NotSerializableInterface { def apply(a: Any): Any }
+abstract class NotSerializableClass { def apply(a: Any): Any }
+// SAM type that supports lambdas-as-invoke-dynamic
+trait IsSerializableInterface extends java.io.Serializable { def apply(a: Any): Any }
+// SAM type that still requires lambdas-as-anonhmous-classes
+abstract class IsSerializableClass extends java.io.Serializable { def apply(a: Any): Any }
+
+object Test {
+ def main(args: Array[String]) {
+ val nsi: NotSerializableInterface = x => x
+ val nsc: NotSerializableClass = x => x
+
+ import SerDes._
+ assertNotSerializable(nsi)
+ assertNotSerializable(nsc)
+ assert(serializeDeserialize[IsSerializableInterface](x => x).apply("foo") == "foo")
+ assert(serializeDeserialize[IsSerializableClass](x => x).apply("foo") == "foo")
+ assert(ObjectStreamClass.lookup(((x => x): IsSerializableClass).getClass).getSerialVersionUID == 0)
+ }
+}
+
+object SerDes {
+ def assertNotSerializable(a: AnyRef): Unit = {
+ try {
+ serialize(a)
+ assert(false)
+ } catch {
+ case _: NotSerializableException => // okay
+ }
+ }
+
+ def serialize(obj: AnyRef): Array[Byte] = {
+ val buffer = new ByteArrayOutputStream
+ val out = new ObjectOutputStream(buffer)
+ out.writeObject(obj)
+ buffer.toByteArray
+ }
+
+ def deserialize(a: Array[Byte]): AnyRef = {
+ val in = new ObjectInputStream(new ByteArrayInputStream(a))
+ in.readObject
+ }
+
+ def serializeDeserialize[T <: AnyRef](obj: T) = deserialize(serialize(obj)).asInstanceOf[T]
+}
diff --git a/test/files/run/sd167.check b/test/files/run/sd167.check
new file mode 100644
index 0000000000..587be6b4c3
--- /dev/null
+++ b/test/files/run/sd167.check
@@ -0,0 +1 @@
+x
diff --git a/test/files/run/sd167.scala b/test/files/run/sd167.scala
new file mode 100644
index 0000000000..5095e772ad
--- /dev/null
+++ b/test/files/run/sd167.scala
@@ -0,0 +1,8 @@
+object Test {
+ implicit class ToExtractor(val s: StringContext) {
+ def x = {println("x"); Some }
+ }
+ def main(args: Array[String]) {
+ Some(1) match { case x"${a}" => } // used to convert to `case Some(a) =>` and omit side effects
+ }
+}
diff --git a/test/files/run/t3326.scala b/test/files/run/t3326.scala
index 4ac7ef9138..b6b4eac784 100644
--- a/test/files/run/t3326.scala
+++ b/test/files/run/t3326.scala
@@ -19,7 +19,7 @@ import scala.math.Ordering
* This is why `collection.SortedMap` used to resort to the generic
* `TraversableLike.++` which knows nothing about the ordering.
*
- * To avoid `collection.SortedMap`s resort to the more generic `TraverableLike.++`,
+ * To avoid `collection.SortedMap`s resort to the more generic `TraversableLike.++`,
* we override the `MapLike.++` overload in `collection.SortedMap` to return
* the proper type `SortedMap`.
*/
diff --git a/test/files/run/t3888.check b/test/files/run/t3888.check
index 6fda32d713..e69de29bb2 100644
--- a/test/files/run/t3888.check
+++ b/test/files/run/t3888.check
@@ -1 +0,0 @@
-warning: there was one deprecation warning (since 2.11.0); re-run with -deprecation for details
diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala
index 8701b42ff0..b1932ffb20 100644
--- a/test/files/run/t3888.scala
+++ b/test/files/run/t3888.scala
@@ -1,3 +1,4 @@
+case class Tuple2[+T1, +T2](_1: T1, _2: T2) extends Product2[T1, T2]
// in a match, which notion of equals prevails?
// extending Tuple doesn't seem to be at issue here.
@@ -7,13 +8,13 @@ object Test {
private[this] val T2 = T1
def m1 =
- (1, 2) match {
+ Tuple2(1, 2) match {
case T1 => true
case _ => false
}
def m2 =
- (1, 2) match {
+ Tuple2(1, 2) match {
case T2 => true
case _ => false
}
diff --git a/test/files/run/t4891.check b/test/files/run/t4891.check
index 1b1108e9ee..a460569fd9 100644
--- a/test/files/run/t4891.check
+++ b/test/files/run/t4891.check
@@ -1,6 +1,7 @@
test.generic.T1
- (m) public default void test.generic.T1.$init$()
+ (m) public static void test.generic.T1.$init$(test.generic.T1)
(m) public default A test.generic.T1.t1(A)
+ (m) public static java.lang.Object test.generic.T1.t1$(test.generic.T1,java.lang.Object)
test.generic.C1
(m) public void test.generic.C1.m1()
test.generic.C2
diff --git a/test/files/run/t5652.check b/test/files/run/t5652.check
index 7c65ba6698..3c039d68aa 100644
--- a/test/files/run/t5652.check
+++ b/test/files/run/t5652.check
@@ -1,6 +1,7 @@
public default int T1.f0()
-public default void T1.$init$()
public static int T1.T1$$g$1()
+public static int T1.f0$(T1)
+public static void T1.$init$(T1)
public int A1.f1()
public static final int A1.A1$$g$2()
public int A2.f2()
diff --git a/test/files/run/t5699.check b/test/files/run/t5699.check
index df19644ae6..8d19ecd321 100644
--- a/test/files/run/t5699.check
+++ b/test/files/run/t5699.check
@@ -1,10 +1,10 @@
[[syntax trees at end of parser]] // annodef.java
package <empty> {
object MyAnnotation extends {
- def <init>() = _
+ def <init>()
};
class MyAnnotation extends scala.annotation.Annotation with _root_.java.lang.annotation.Annotation with scala.annotation.ClassfileAnnotation {
- def <init>() = _;
+ def <init>();
def value(): String
}
}
diff --git a/test/files/run/t6288.check b/test/files/run/t6288.check
index 67877fd56d..7933f516a8 100644
--- a/test/files/run/t6288.check
+++ b/test/files/run/t6288.check
@@ -7,7 +7,7 @@
};
[21]def unapply([29]z: [32]<type: [32]scala.Any>): [21]Option[Int] = [56][52][52]scala.Some.apply[[52]Int]([58]-1);
[64]{
- [64]case <synthetic> val x1: [64]Any = [64]"";
+ [64]case <synthetic> val x1: [64]String = [64]"";
[64]case5()[84]{
[84]<synthetic> val o7: [84]Option[Int] = [84][84]Case3.unapply([84]x1);
[84]if ([84]o7.isEmpty.unary_!)
@@ -30,7 +30,7 @@
};
[127]def unapplySeq([138]z: [141]<type: [141]scala.Any>): [127]Option[List[Int]] = [167]scala.None;
[175]{
- [175]case <synthetic> val x1: [175]Any = [175]"";
+ [175]case <synthetic> val x1: [175]String = [175]"";
[175]case5()[195]{
[195]<synthetic> val o7: [195]Option[List[Int]] = [195][195]Case4.unapplySeq([195]x1);
[195]if ([195][195]o7.isEmpty.unary_!.&&([195][195][195][195]o7.get.!=([195]null).&&([195][195][195][195]o7.get.lengthCompare([195]1).==([195]0))))
@@ -53,7 +53,7 @@
};
[238]def unapply([246]z: [249]<type: [249]scala.Any>): [238]Boolean = [265]true;
[273]{
- [273]case <synthetic> val x1: [273]Any = [273]"";
+ [273]case <synthetic> val x1: [273]String = [273]"";
[273]case5()[293]{
[293]<synthetic> val o7: [293]Option[List[Int]] = [293][293]Case4.unapplySeq([293]x1);
[293]if ([293][293]o7.isEmpty.unary_!.&&([293][293][293][293]o7.get.!=([293]null).&&([293][293][293][293]o7.get.lengthCompare([293]0).==([293]0))))
diff --git a/test/files/run/t7439.check b/test/files/run/t7439.check
index 9ea09f9c40..b95884311a 100644
--- a/test/files/run/t7439.check
+++ b/test/files/run/t7439.check
@@ -1,2 +1,2 @@
Recompiling after deleting t7439-run.obj/A_1.class
-pos: NoPosition Class A_1 not found - continuing with a stub. WARNING
+
diff --git a/test/files/run/t7700.check b/test/files/run/t7700.check
index 1d51e68877..7d18dbfcb4 100644
--- a/test/files/run/t7700.check
+++ b/test/files/run/t7700.check
@@ -1,3 +1,4 @@
-public default void C.$init$()
+public static void C.$init$(C)
public default java.lang.Object C.bar(java.lang.Object)
-public abstract java.lang.Object C.foo(java.lang.Object)
+public static java.lang.Object C.bar$(C,java.lang.Object)
+public abstract java.lang.Object C.foo(java.lang.Object) \ No newline at end of file
diff --git a/test/files/run/t7700.scala b/test/files/run/t7700.scala
index 76d16b808c..fd13666467 100644
--- a/test/files/run/t7700.scala
+++ b/test/files/run/t7700.scala
@@ -7,11 +7,13 @@ trait C[@specialized U] {
def bar[A](u: U) = u
}
-object Test extends App {
- val declared = classOf[C[_]].getDeclaredMethods.sortBy(_.getName)
- println(declared.mkString("\n"))
- object CInt extends C[Int] { def foo(i: Int) = i }
- object CAny extends C[Any] { def foo(a: Any) = a }
- assert(CInt.foo(1) == 1)
- assert(CAny.foo("") == "")
+object Test {
+ def main(args: Array[String]) {
+ val declared = classOf[C[_]].getDeclaredMethods.sortBy(_.getName)
+ println(declared.mkString("\n"))
+ object CInt extends C[Int] { def foo(i: Int) = i }
+ object CAny extends C[Any] { def foo(a: Any) = a }
+ assert(CInt.foo(1) == 1)
+ assert(CAny.foo("") == "")
+ }
}
diff --git a/test/files/run/t7747-repl.scala b/test/files/run/t7747-repl.scala
index c6a7e419aa..0094d3ba98 100644
--- a/test/files/run/t7747-repl.scala
+++ b/test/files/run/t7747-repl.scala
@@ -8,8 +8,12 @@ object Test extends ReplTest {
s
}
- // replace indylambda function names by <function0>
- override def normalize(s: String) = """\$Lambda.*""".r.replaceAllIn(s, "<function0>")
+ override def normalize(s: String) = {
+ // replace indylambda function names by <function0>
+ val s2 = """\$Lambda.*""".r.replaceAllIn(s, "<function0>")
+ // Normalize ordering of LUB
+ s2.replace("Serializable with Product", "Product with Serializable")
+ }
def code = """
|var x = 10
diff --git a/test/files/run/t7932.check b/test/files/run/t7932.check
index a2ad84cd46..76968fd179 100644
--- a/test/files/run/t7932.check
+++ b/test/files/run/t7932.check
@@ -2,5 +2,9 @@ public Category<?> C.category()
public Category<scala.Tuple2> C.category1()
public default Category<java.lang.Object> M1.category()
public default Category<scala.Tuple2> M1.category1()
+public static Category M1.category$(M1)
+public static Category M1.category1$(M1)
public default Category<java.lang.Object> M2.category()
public default Category<scala.Tuple2> M2.category1()
+public static Category M2.category$(M2)
+public static Category M2.category1$(M2) \ No newline at end of file
diff --git a/test/files/run/t7932.scala b/test/files/run/t7932.scala
index e6bdbf2417..40b0b9989b 100644
--- a/test/files/run/t7932.scala
+++ b/test/files/run/t7932.scala
@@ -17,12 +17,14 @@ trait M2[F] { self: M1[F] =>
abstract class C extends M1[Float] with M2[Float]
-object Test extends App {
+object Test {
def t(c: Class[_]) = {
val ms = c.getMethods.filter(_.getName.startsWith("category"))
println(ms.map(_.toGenericString).sorted.mkString("\n"))
}
- t(classOf[C])
- t(classOf[M1[_]])
- t(classOf[M2[_]])
+ def main(args: Array[String]) {
+ t(classOf[C])
+ t(classOf[M1[_]])
+ t(classOf[M2[_]])
+ }
}
diff --git a/test/files/run/t8442.check b/test/files/run/t8442.check
index ce9e8b52ff..8b13789179 100644
--- a/test/files/run/t8442.check
+++ b/test/files/run/t8442.check
@@ -1 +1 @@
-pos: NoPosition Class A_1 not found - continuing with a stub. WARNING
+
diff --git a/test/files/run/t8549.scala b/test/files/run/t8549.scala
index 1ce8933efb..da7a731459 100644
--- a/test/files/run/t8549.scala
+++ b/test/files/run/t8549.scala
@@ -79,10 +79,10 @@ object Test extends App {
}
}
- // Generated on 20160515-00:17:51 with Scala version 2.12.0-SNAPSHOT)
+ // Generated on 20160715-08:27:53 with Scala version 2.12.0-20160715-012500-f5a80bd)
overwrite.foreach(updateComment)
- check(Some(1))("rO0ABXNyAApzY2FsYS5Tb21lESLyaV6hi3QCAAFMAAF4dAASTGphdmEvbGFuZy9PYmplY3Q7eHIADHNjYWxhLk9wdGlvbv5pN/3bDmZ0AgAAeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAQ==")
+ check(Some(1))("rO0ABXNyAApzY2FsYS5Tb21lESLyaV6hi3QCAAFMAAV2YWx1ZXQAEkxqYXZhL2xhbmcvT2JqZWN0O3hyAAxzY2FsYS5PcHRpb27+aTf92w5mdAIAAHhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAE=")
check(None)("rO0ABXNyAAtzY2FsYS5Ob25lJEZQJPZTypSsAgAAeHIADHNjYWxhLk9wdGlvbv5pN/3bDmZ0AgAAeHA=")
check(List(1, 2, 3))( "rO0ABXNyADJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0JFNlcmlhbGl6YXRpb25Qcm94eQAAAAAAAAABAwAAeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHg=")
@@ -95,13 +95,10 @@ object Test extends App {
import collection.{ mutable, immutable }
class C
- // TODO IMPLCLASS not stable across trait encoding change (removal of impl classes)
- // java.io.InvalidClassException: scala.reflect.ClassTag$$anon$1; local class incompatible: stream classdesc serialVersionUID = -4937928798201944954, local class serialVersionUID = 4714485091895415501
- // Switch to using named, rather than anoymous classes, in the class tag implementation, or maybe use a `readResolve` / `writeReplace` approach.
- // check(reflect.classTag[C])("rO0ABXNyAB5zY2FsYS5yZWZsZWN0LkNsYXNzVGFnJCRhbm9uJDG7ePPrmQBkhgIAAUwAD3J1bnRpbWVDbGFzczEkMXQAEUxqYXZhL2xhbmcvQ2xhc3M7eHB2cgAGVGVzdCRDAAAAAAAAAAAAAAB4cA==")
- // check(reflect.classTag[Int])("rO0ABXNyACVzY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSQkYW5vbiQ5zfmiSVNjtVICAAB4cgAcc2NhbGEucmVmbGVjdC5BbnlWYWxNYW5pZmVzdAAAAAAAAAABAgABTAAIdG9TdHJpbmd0ABJMamF2YS9sYW5nL1N0cmluZzt4cHQAA0ludA==")
- // check(reflect.classTag[String])("rO0ABXNyAB5zY2FsYS5yZWZsZWN0LkNsYXNzVGFnJCRhbm9uJDG7ePPrmQBkhgIAAUwAD3J1bnRpbWVDbGFzczEkMXQAEUxqYXZhL2xhbmcvQ2xhc3M7eHB2cgAQamF2YS5sYW5nLlN0cmluZ6DwpDh6O7NCAgAAeHA=")
- // check(reflect.classTag[Object])("rO0ABXNyACVzY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSQkYW5vbiQymPrtq/Ci1gsCAAB4cgAtc2NhbGEucmVmbGVjdC5NYW5pZmVzdEZhY3RvcnkkUGhhbnRvbU1hbmlmZXN0rzigP7KRh/kCAAFMAAh0b1N0cmluZ3QAEkxqYXZhL2xhbmcvU3RyaW5nO3hyAC9zY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSRDbGFzc1R5cGVNYW5pZmVzdFq6NWvfTgYFAgADTAAGcHJlZml4dAAOTHNjYWxhL09wdGlvbjtMAAxydW50aW1lQ2xhc3N0ABFMamF2YS9sYW5nL0NsYXNzO0wADXR5cGVBcmd1bWVudHN0ACFMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvTGlzdDt4cHNyAAtzY2FsYS5Ob25lJEZQJPZTypSsAgAAeHIADHNjYWxhLk9wdGlvbv5pN/3bDmZ0AgAAeHB2cgAQamF2YS5sYW5nLk9iamVjdAAAAAAAAAAAAAAAeHBzcgAyc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuTGlzdCRTZXJpYWxpemF0aW9uUHJveHkAAAAAAAAAAQMAAHhwc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHh0AAZPYmplY3Q=")
+ check(reflect.classTag[C])("rO0ABXNyACZzY2FsYS5yZWZsZWN0LkNsYXNzVGFnJEdlbmVyaWNDbGFzc1RhZy5VPJBpc7h/AgABTAAMcnVudGltZUNsYXNzdAARTGphdmEvbGFuZy9DbGFzczt4cHZyAAZUZXN0JEMAAAAAAAAAAAAAAHhw")
+ check(reflect.classTag[Int])("rO0ABXNyAClzY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSRJbnRNYW5pZmVzdFbjh2PQL01qAgAAeHIAHHNjYWxhLnJlZmxlY3QuQW55VmFsTWFuaWZlc3QAAAAAAAAAAQIAAUwACHRvU3RyaW5ndAASTGphdmEvbGFuZy9TdHJpbmc7eHB0AANJbnQ=")
+ check(reflect.classTag[String])("rO0ABXNyACZzY2FsYS5yZWZsZWN0LkNsYXNzVGFnJEdlbmVyaWNDbGFzc1RhZy5VPJBpc7h/AgABTAAMcnVudGltZUNsYXNzdAARTGphdmEvbGFuZy9DbGFzczt4cHZyABBqYXZhLmxhbmcuU3RyaW5noPCkOHo7s0ICAAB4cA==")
+ check(reflect.classTag[Object])("rO0ABXNyACxzY2FsYS5yZWZsZWN0Lk1hbmlmZXN0RmFjdG9yeSRPYmplY3RNYW5pZmVzdIWY9dplxtUqAgAAeHIALXNjYWxhLnJlZmxlY3QuTWFuaWZlc3RGYWN0b3J5JFBoYW50b21NYW5pZmVzdK84oD+ykYf5AgABTAAIdG9TdHJpbmd0ABJMamF2YS9sYW5nL1N0cmluZzt4cgAvc2NhbGEucmVmbGVjdC5NYW5pZmVzdEZhY3RvcnkkQ2xhc3NUeXBlTWFuaWZlc3TQb2e0Lu/6HQIAA0wABnByZWZpeHQADkxzY2FsYS9PcHRpb247TAAMcnVudGltZUNsYXNzdAARTGphdmEvbGFuZy9DbGFzcztMAA10eXBlQXJndW1lbnRzdAAhTHNjYWxhL2NvbGxlY3Rpb24vaW1tdXRhYmxlL0xpc3Q7eHBzcgALc2NhbGEuTm9uZSRGUCT2U8qUrAIAAHhyAAxzY2FsYS5PcHRpb27+aTf92w5mdAIAAHhwdnIAEGphdmEubGFuZy5PYmplY3QAAAAAAAAAAAAAAHhwc3IAMnNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3QkU2VyaWFsaXphdGlvblByb3h5AAAAAAAAAAEDAAB4cHNyACxzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5MaXN0U2VyaWFsaXplRW5kJIpcY1v3UwttAgAAeHB4dAAGT2JqZWN0")
// TODO SI-8576 unstable under -Xcheckinit
// check(Enum)( "rO0ABXNyAApUZXN0JEVudW0ketCIyQ8C23MCAAJMAAJWMXQAGUxzY2FsYS9FbnVtZXJhdGlvbiRWYWx1ZTtMAAJWMnQAF0xzY2FsYS9FbnVtZXJhdGlvbiRWYWw7eHIAEXNjYWxhLkVudW1lcmF0aW9udaDN3ZgOWY4CAAhJAAZuZXh0SWRJABtzY2FsYSRFbnVtZXJhdGlvbiQkYm90dG9tSWRJABhzY2FsYSRFbnVtZXJhdGlvbiQkdG9wSWRMABRWYWx1ZU9yZGVyaW5nJG1vZHVsZXQAIkxzY2FsYS9FbnVtZXJhdGlvbiRWYWx1ZU9yZGVyaW5nJDtMAA9WYWx1ZVNldCRtb2R1bGV0AB1Mc2NhbGEvRW51bWVyYXRpb24kVmFsdWVTZXQkO0wACG5leHROYW1ldAAbTHNjYWxhL2NvbGxlY3Rpb24vSXRlcmF0b3I7TAAXc2NhbGEkRW51bWVyYXRpb24kJG5tYXB0AB5Mc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL01hcDtMABdzY2FsYSRFbnVtZXJhdGlvbiQkdm1hcHEAfgAHeHAAAAArAAAAAAAAACtwcHBzcgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkhhc2hNYXAAAAAAAAAAAQMAAHhwdw0AAALuAAAAAAAAAAQAeHNxAH4ACXcNAAAC7gAAAAEAAAAEAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAqc3IAFXNjYWxhLkVudW1lcmF0aW9uJFZhbM9pZ6/J/O1PAgACSQAYc2NhbGEkRW51bWVyYXRpb24kVmFsJCRpTAAEbmFtZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hyABdzY2FsYS5FbnVtZXJhdGlvbiRWYWx1ZWJpfC/tIR1RAgACTAAGJG91dGVydAATTHNjYWxhL0VudW1lcmF0aW9uO0wAHHNjYWxhJEVudW1lcmF0aW9uJCRvdXRlckVudW1xAH4AEnhwcQB+AAhxAH4ACAAAACpweHNyABFUZXN0JEVudW0kJGFub24kMVlIjlmE1sXaAgAAeHEAfgARcQB+AAhxAH4ACHEAfgAT")
@@ -119,8 +116,7 @@ object Test extends App {
// TODO SI-8576 unstable under -Xcheckinit
check(collection.convert.Wrappers)( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcA==")
- // TODO IMPLCLASS java.io.InvalidClassException: scala.collection.immutable.Set$EmptySet$; local class incompatible: stream classdesc serialVersionUID = -1118802231467657162, local class serialVersionUID = -5214304379191661165
- // check(new collection.convert.Wrappers.SetWrapper(immutable.Set()))("rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkU2V0V3JhcHBlcgAAAAAAAAABAgACTAAGJG91dGVydAAjTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycztMADhzY2FsYSRjb2xsZWN0aW9uJGNvbnZlcnQkV3JhcHBlcnMkU2V0V3JhcHBlciQkdW5kZXJseWluZ3QAFkxzY2FsYS9jb2xsZWN0aW9uL1NldDt4cHNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcHNyAChzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkRW1wdHlTZXQk8Hk3TFN0uDYCAAB4cA==")
+ check(new collection.convert.Wrappers.SetWrapper(immutable.Set()))("rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkU2V0V3JhcHBlcgAAAAAAAAABAgACTAAGJG91dGVydAAjTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycztMADhzY2FsYSRjb2xsZWN0aW9uJGNvbnZlcnQkV3JhcHBlcnMkU2V0V3JhcHBlciQkdW5kZXJseWluZ3QAFkxzY2FsYS9jb2xsZWN0aW9uL1NldDt4cHNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcHNyAChzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkRW1wdHlTZXQkzP+rBndbbiMCAAB4cA==")
check(new collection.convert.Wrappers.SetWrapper(immutable.Set(1, 2, 3)))("rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkU2V0V3JhcHBlcgAAAAAAAAABAgACTAAGJG91dGVydAAjTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycztMADhzY2FsYSRjb2xsZWN0aW9uJGNvbnZlcnQkV3JhcHBlcnMkU2V0V3JhcHBlciQkdW5kZXJseWluZ3QAFkxzY2FsYS9jb2xsZWN0aW9uL1NldDt4cHNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcHNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0M84syT0560SgAgADTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgAZTAAFZWxlbTNxAH4AGXhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+ABsAAAACc3EAfgAbAAAAAw==")
check(new collection.convert.Wrappers.SetWrapper(mutable.Set()))("rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkU2V0V3JhcHBlcgAAAAAAAAABAgACTAAGJG91dGVydAAjTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycztMADhzY2FsYSRjb2xsZWN0aW9uJGNvbnZlcnQkV3JhcHBlcnMkU2V0V3JhcHBlciQkdW5kZXJseWluZ3QAFkxzY2FsYS9jb2xsZWN0aW9uL1NldDt4cHNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcHNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaFNldAAAAAAAAAABAwAAeHB3DQAAAcIAAAAAAAAABQB4")
check(new collection.convert.Wrappers.SetWrapper(mutable.Set(1, 2, 3)))("rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkU2V0V3JhcHBlcgAAAAAAAAABAgACTAAGJG91dGVydAAjTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycztMADhzY2FsYSRjb2xsZWN0aW9uJGNvbnZlcnQkV3JhcHBlcnMkU2V0V3JhcHBlciQkdW5kZXJseWluZ3QAFkxzY2FsYS9jb2xsZWN0aW9uL1NldDt4cHNyACJzY2FsYS5jb2xsZWN0aW9uLmNvbnZlcnQuV3JhcHBlcnMkrrSziizavIECABJMABhEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADZMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJERpY3Rpb25hcnlXcmFwcGVyJDtMABZJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA0THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRJdGVyYWJsZVdyYXBwZXIkO0wAFkl0ZXJhdG9yV3JhcHBlciRtb2R1bGV0ADRMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEl0ZXJhdG9yV3JhcHBlciQ7TAAZSkNvbGxlY3Rpb25XcmFwcGVyJG1vZHVsZXQAN0xzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkNvbGxlY3Rpb25XcmFwcGVyJDtMABxKQ29uY3VycmVudE1hcFdyYXBwZXIkbW9kdWxldAA6THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKQ29uY3VycmVudE1hcFdyYXBwZXIkO0wAGUpEaWN0aW9uYXJ5V3JhcHBlciRtb2R1bGV0ADdMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpEaWN0aW9uYXJ5V3JhcHBlciQ7TAAaSkVudW1lcmF0aW9uV3JhcHBlciRtb2R1bGV0ADhMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpFbnVtZXJhdGlvbldyYXBwZXIkO0wAF0pJdGVyYWJsZVdyYXBwZXIkbW9kdWxldAA1THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKSXRlcmFibGVXcmFwcGVyJDtMABdKSXRlcmF0b3JXcmFwcGVyJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkl0ZXJhdG9yV3JhcHBlciQ7TAATSkxpc3RXcmFwcGVyJG1vZHVsZXQAMUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSkxpc3RXcmFwcGVyJDtMABJKTWFwV3JhcHBlciRtb2R1bGV0ADBMc2NhbGEvY29sbGVjdGlvbi9jb252ZXJ0L1dyYXBwZXJzJEpNYXBXcmFwcGVyJDtMABlKUHJvcGVydGllc1dyYXBwZXIkbW9kdWxldAA3THNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRKUHJvcGVydGllc1dyYXBwZXIkO0wAEkpTZXRXcmFwcGVyJG1vZHVsZXQAMExzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkSlNldFdyYXBwZXIkO0wAG011dGFibGVCdWZmZXJXcmFwcGVyJG1vZHVsZXQAOUxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZUJ1ZmZlcldyYXBwZXIkO0wAGE11dGFibGVNYXBXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZU1hcFdyYXBwZXIkO0wAGE11dGFibGVTZXFXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNlcVdyYXBwZXIkO0wAGE11dGFibGVTZXRXcmFwcGVyJG1vZHVsZXQANkxzY2FsYS9jb2xsZWN0aW9uL2NvbnZlcnQvV3JhcHBlcnMkTXV0YWJsZVNldFdyYXBwZXIkO0wAEVNlcVdyYXBwZXIkbW9kdWxldAAvTHNjYWxhL2NvbGxlY3Rpb24vY29udmVydC9XcmFwcGVycyRTZXFXcmFwcGVyJDt4cHBwcHBwcHBwcHBwcHBwcHBwcHNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaFNldAAAAAAAAAABAwAAeHB3DQAAAcIAAAADAAAABQBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AGgAAAAJzcQB+ABoAAAADeA==")
@@ -155,8 +151,7 @@ object Test extends App {
// TODO SI-8576 throws scala.UnitializedFieldError under -Xcheckinit
// check(new immutable.Range(0, 1, 1))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5SYW5nZWm7o1SrFTINAgAHSQADZW5kWgAHaXNFbXB0eUkAC2xhc3RFbGVtZW50SQAQbnVtUmFuZ2VFbGVtZW50c0kABXN0YXJ0SQAEc3RlcEkAD3Rlcm1pbmFsRWxlbWVudHhwAAAAAQAAAAAAAAAAAQAAAAAAAAABAAAAAQ==")
- // TODO IMPLCLASS java.io.InvalidClassException: scala.collection.immutable.Set$EmptySet$; local class incompatible: stream classdesc serialVersionUID = -1118802231467657162, local class serialVersionUID = -5214304379191661165
- // check(immutable.Set())( "rO0ABXNyAChzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkRW1wdHlTZXQk8Hk3TFN0uDYCAAB4cA==")
+ check(immutable.Set())( "rO0ABXNyAChzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkRW1wdHlTZXQkzP+rBndbbiMCAAB4cA==")
check(immutable.Set(1))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0MREd3c4yqtWTAgABTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDt4cHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAAB")
check(immutable.Set(1, 2))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0MqaV02sZQzV0AgACTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABeHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAwAAAAI=")
check(immutable.Set(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TZXQkU2V0M84syT0560SgAgADTAAFZWxlbTF0ABJMamF2YS9sYW5nL09iamVjdDtMAAVlbGVtMnEAfgABTAAFZWxlbTNxAH4AAXhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAMAAAACc3EAfgADAAAAAw==")
@@ -168,8 +163,7 @@ object Test extends App {
// TODO SI-8576 Uninitialized field: IndexedSeqLike.scala: 56
// check(immutable.Stream(1, 2, 3))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TdHJlYW0kQ29uc/ekjBXM3TlFAgADTAACaGR0ABJMamF2YS9sYW5nL09iamVjdDtMAAV0bEdlbnQAEUxzY2FsYS9GdW5jdGlvbjA7TAAFdGxWYWx0ACNMc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvU3RyZWFtO3hyACFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5TdHJlYW0552RDntM42gIAAHhwc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcgAtc2NhbGEuY29sbGVjdGlvbi5JdGVyYXRvciQkYW5vbmZ1biR0b1N0cmVhbSQxRWR4We0SX0UCAAFMAAYkb3V0ZXJ0ABtMc2NhbGEvY29sbGVjdGlvbi9JdGVyYXRvcjt4cHNyAChzY2FsYS5jb2xsZWN0aW9uLkluZGV4ZWRTZXFMaWtlJEVsZW1lbnRzGF+1cBwmcx0CAANJAANlbmRJAAVpbmRleEwABiRvdXRlcnQAIUxzY2FsYS9jb2xsZWN0aW9uL0luZGV4ZWRTZXFMaWtlO3hwAAAAAwAAAAFzcgArc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLldyYXBwZWRBcnJheSRvZkludMmRLBcI15VjAgABWwAFYXJyYXl0AAJbSXhwdXIAAltJTbpgJnbqsqUCAAB4cAAAAAMAAAABAAAAAgAAAANw")
- // TODO IMPLCLASS java.io.InvalidClassException: scala.math.Ordering$Int$; local class incompatible: stream classdesc serialVersionUID = 828746404302808924, local class serialVersionUID = -4070467079371527467
- // check(immutable.TreeSet[Int]())( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5UcmVlU2V0sRdVIDjbWAsCAAJMAAhvcmRlcmluZ3QAFUxzY2FsYS9tYXRoL09yZGVyaW5nO0wABHRyZWV0AC5Mc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHA=")
+ check(immutable.TreeSet[Int]())( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5UcmVlU2V0sRdVIDjbWAsCAAJMAAhvcmRlcmluZ3QAFUxzY2FsYS9tYXRoL09yZGVyaW5nO0wABHRyZWV0AC5Mc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQk2YGfBpdmfrACAAB4cHA=")
// TODO SI-8576 unstable under -Xcheckinit
// check(immutable.TreeSet(1, 2, 3))( "rO0ABXNyACJzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5UcmVlU2V0sRdVIDjbWAsCAAJMAAhvcmRlcmluZ3QAFUxzY2FsYS9tYXRoL09yZGVyaW5nO0wABHRyZWV0AC5Mc2NhbGEvY29sbGVjdGlvbi9pbW11dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHNyADFzY2FsYS5jb2xsZWN0aW9uLmltbXV0YWJsZS5SZWRCbGFja1RyZWUkQmxhY2tUcmVlzRxnCKenVAECAAB4cgAsc2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWVrqCSyHJbsMgIABUkABWNvdW50TAADa2V5dAASTGphdmEvbGFuZy9PYmplY3Q7TAAEbGVmdHEAfgACTAAFcmlnaHRxAH4AAkwABXZhbHVlcQB+AAh4cAAAAANzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAnNxAH4ABgAAAAFzcQB+AAoAAAABcHBzcgAXc2NhbGEucnVudGltZS5Cb3hlZFVuaXR0pn1HHezLmgIAAHhwc3EAfgAGAAAAAXNxAH4ACgAAAANwcHEAfgAQcQB+ABA=")
@@ -185,13 +179,12 @@ object Test extends App {
check(mutable.HashMap())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAAAAAAABAB4")
check(mutable.HashMap(1 -> 1))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXEAfgAEeA==")
check(mutable.HashSet(1, 2, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGFzaFNldAAAAAAAAAABAwAAeHB3DQAAAcIAAAADAAAABQBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJzcQB+AAIAAAADeA==")
- // TODO IMPLCLASS java.io.InvalidClassException: scala.math.Ordering$Int$; local class incompatible: stream classdesc serialVersionUID = 828746404302808924, local class serialVersionUID = -4070467079371527467
- // check(mutable.TreeMap[Int, Int]())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZU1hcNx8qC229ZvwAgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZU1hcCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAABw")
- // check(mutable.TreeMap(1 -> 1, 3 -> 6))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZU1hcNx8qC229ZvwAgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZU1hcCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAAJzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSROb2RlGxHsFtValgACAAZaAANyZWRMAANrZXl0ABJMamF2YS9sYW5nL09iamVjdDtMAARsZWZ0cQB+AAdMAAZwYXJlbnRxAH4AB0wABXJpZ2h0cQB+AAdMAAV2YWx1ZXEAfgAKeHAAc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFwcHNxAH4ACQFzcQB+AAwAAAADcHEAfgALcHNxAH4ADAAAAAZxAH4ADg==")
- // check(mutable.TreeMap(1 -> 1, 3 -> 6).range(1, 2))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZU1hcCRUcmVlTWFwVmlldx7MCZxLhVQ8AgADTAAGJG91dGVydAAiTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9UcmVlTWFwO0wABGZyb210AA5Mc2NhbGEvT3B0aW9uO0wABXVudGlscQB+AAJ4cgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlRyZWVNYXDcfKgttvWb8AIAAkwACG9yZGVyaW5ndAAVTHNjYWxhL21hdGgvT3JkZXJpbmc7TAAmc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJFRyZWVNYXAkJHRyZWV0ACxMc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1JlZEJsYWNrVHJlZSRUcmVlO3hwc3IAGHNjYWxhLm1hdGguT3JkZXJpbmckSW50JAuATHa9WedcAgAAeHBzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSRUcmVlAEynNPA1phUCAAJJAARzaXplTAAEcm9vdHQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJE5vZGU7eHAAAAACc3IAKnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5SZWRCbGFja1RyZWUkTm9kZRsR7BbVWpYAAgAGWgADcmVkTAADa2V5dAASTGphdmEvbGFuZy9PYmplY3Q7TAAEbGVmdHEAfgAKTAAGcGFyZW50cQB+AApMAAVyaWdodHEAfgAKTAAFdmFsdWVxAH4ADXhwAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABcHBzcQB+AAwBc3EAfgAPAAAAA3BxAH4ADnBzcQB+AA8AAAAGcQB+ABFzcQB+AANxAH4ACHEAfgALc3IACnNjYWxhLlNvbWURIvJpXqGLdAIAAUwAAXhxAH4ADXhyAAxzY2FsYS5PcHRpb27+aTf92w5mdAIAAHhwcQB+ABFzcQB+ABZzcQB+AA8AAAAC")
- // check(mutable.TreeSet[Int]())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZVNldM10nxFQDpt4AgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZVNldCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAABw")
- // check(mutable.TreeSet(1, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZVNldM10nxFQDpt4AgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZVNldCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQkC4BMdr1Z51wCAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAAJzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSROb2RlGxHsFtValgACAAZaAANyZWRMAANrZXl0ABJMamF2YS9sYW5nL09iamVjdDtMAARsZWZ0cQB+AAdMAAZwYXJlbnRxAH4AB0wABXJpZ2h0cQB+AAdMAAV2YWx1ZXEAfgAKeHAAc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFwcHNxAH4ACQFzcQB+AAwAAAADcHEAfgALcHBw")
- // check(mutable.TreeSet(1, 3).range(1, 2))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZVNldCRUcmVlU2V0Vmlld2JdAzqy0DpGAgADTAAGJG91dGVydAAiTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9UcmVlU2V0O0wABGZyb210AA5Mc2NhbGEvT3B0aW9uO0wABXVudGlscQB+AAJ4cgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlRyZWVTZXTNdJ8RUA6beAIAAkwACG9yZGVyaW5ndAAVTHNjYWxhL21hdGgvT3JkZXJpbmc7TAAmc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJFRyZWVTZXQkJHRyZWV0ACxMc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1JlZEJsYWNrVHJlZSRUcmVlO3hwc3IAGHNjYWxhLm1hdGguT3JkZXJpbmckSW50JAuATHa9WedcAgAAeHBzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSRUcmVlAEynNPA1phUCAAJJAARzaXplTAAEcm9vdHQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJE5vZGU7eHAAAAACc3IAKnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5SZWRCbGFja1RyZWUkTm9kZRsR7BbVWpYAAgAGWgADcmVkTAADa2V5dAASTGphdmEvbGFuZy9PYmplY3Q7TAAEbGVmdHEAfgAKTAAGcGFyZW50cQB+AApMAAVyaWdodHEAfgAKTAAFdmFsdWVxAH4ADXhwAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABcHBzcQB+AAwBc3EAfgAPAAAAA3BxAH4ADnBwcHNxAH4AA3EAfgAIcQB+AAtzcgAKc2NhbGEuU29tZREi8mleoYt0AgABTAABeHEAfgANeHIADHNjYWxhLk9wdGlvbv5pN/3bDmZ0AgAAeHBxAH4AEXNxAH4AFXNxAH4ADwAAAAI=")
+ check(mutable.TreeMap[Int, Int]())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZU1hcNx8qC229ZvwAgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZU1hcCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQk2YGfBpdmfrACAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAABw")
+ check(mutable.TreeMap(1 -> 1, 3 -> 6))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZU1hcNx8qC229ZvwAgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZU1hcCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQk2YGfBpdmfrACAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAAJzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSROb2RlGxHsFtValgACAAZaAANyZWRMAANrZXl0ABJMamF2YS9sYW5nL09iamVjdDtMAARsZWZ0cQB+AAdMAAZwYXJlbnRxAH4AB0wABXJpZ2h0cQB+AAdMAAV2YWx1ZXEAfgAKeHAAc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFwcHNxAH4ACQFzcQB+AAwAAAADcHEAfgALcHNxAH4ADAAAAAZxAH4ADg==")
+ check(mutable.TreeMap(1 -> 1, 3 -> 6).range(1, 2))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZU1hcCRUcmVlTWFwVmlldx7MCZxLhVQ8AgADTAAGJG91dGVydAAiTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9UcmVlTWFwO0wABGZyb210AA5Mc2NhbGEvT3B0aW9uO0wABXVudGlscQB+AAJ4cgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlRyZWVNYXDcfKgttvWb8AIAAkwACG9yZGVyaW5ndAAVTHNjYWxhL21hdGgvT3JkZXJpbmc7TAAmc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJFRyZWVNYXAkJHRyZWV0ACxMc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1JlZEJsYWNrVHJlZSRUcmVlO3hwc3IAGHNjYWxhLm1hdGguT3JkZXJpbmckSW50JNmBnwaXZn6wAgAAeHBzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSRUcmVlAEynNPA1phUCAAJJAARzaXplTAAEcm9vdHQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJE5vZGU7eHAAAAACc3IAKnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5SZWRCbGFja1RyZWUkTm9kZRsR7BbVWpYAAgAGWgADcmVkTAADa2V5dAASTGphdmEvbGFuZy9PYmplY3Q7TAAEbGVmdHEAfgAKTAAGcGFyZW50cQB+AApMAAVyaWdodHEAfgAKTAAFdmFsdWVxAH4ADXhwAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABcHBzcQB+AAwBc3EAfgAPAAAAA3BxAH4ADnBzcQB+AA8AAAAGcQB+ABFzcQB+AANxAH4ACHEAfgALc3IACnNjYWxhLlNvbWURIvJpXqGLdAIAAUwABXZhbHVlcQB+AA14cgAMc2NhbGEuT3B0aW9u/mk3/dsOZnQCAAB4cHEAfgARc3EAfgAWc3EAfgAPAAAAAg==")
+ check(mutable.TreeSet[Int]())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZVNldM10nxFQDpt4AgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZVNldCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQk2YGfBpdmfrACAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAABw")
+ check(mutable.TreeSet(1, 3))( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZVNldM10nxFQDpt4AgACTAAIb3JkZXJpbmd0ABVMc2NhbGEvbWF0aC9PcmRlcmluZztMACZzY2FsYSRjb2xsZWN0aW9uJG11dGFibGUkVHJlZVNldCQkdHJlZXQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJFRyZWU7eHBzcgAYc2NhbGEubWF0aC5PcmRlcmluZyRJbnQk2YGfBpdmfrACAAB4cHNyACpzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuUmVkQmxhY2tUcmVlJFRyZWUATKc08DWmFQIAAkkABHNpemVMAARyb290dAAsTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9SZWRCbGFja1RyZWUkTm9kZTt4cAAAAAJzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSROb2RlGxHsFtValgACAAZaAANyZWRMAANrZXl0ABJMamF2YS9sYW5nL09iamVjdDtMAARsZWZ0cQB+AAdMAAZwYXJlbnRxAH4AB0wABXJpZ2h0cQB+AAdMAAV2YWx1ZXEAfgAKeHAAc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFwcHNxAH4ACQFzcQB+AAwAAAADcHEAfgALcHBw")
+ check(mutable.TreeSet(1, 3).range(1, 2))( "rO0ABXNyACxzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVHJlZVNldCRUcmVlU2V0Vmlld2JdAzqy0DpGAgADTAAGJG91dGVydAAiTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9UcmVlU2V0O0wABGZyb210AA5Mc2NhbGEvT3B0aW9uO0wABXVudGlscQB+AAJ4cgAgc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlRyZWVTZXTNdJ8RUA6beAIAAkwACG9yZGVyaW5ndAAVTHNjYWxhL21hdGgvT3JkZXJpbmc7TAAmc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJFRyZWVTZXQkJHRyZWV0ACxMc2NhbGEvY29sbGVjdGlvbi9tdXRhYmxlL1JlZEJsYWNrVHJlZSRUcmVlO3hwc3IAGHNjYWxhLm1hdGguT3JkZXJpbmckSW50JNmBnwaXZn6wAgAAeHBzcgAqc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLlJlZEJsYWNrVHJlZSRUcmVlAEynNPA1phUCAAJJAARzaXplTAAEcm9vdHQALExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUmVkQmxhY2tUcmVlJE5vZGU7eHAAAAACc3IAKnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5SZWRCbGFja1RyZWUkTm9kZRsR7BbVWpYAAgAGWgADcmVkTAADa2V5dAASTGphdmEvbGFuZy9PYmplY3Q7TAAEbGVmdHEAfgAKTAAGcGFyZW50cQB+AApMAAVyaWdodHEAfgAKTAAFdmFsdWVxAH4ADXhwAHNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAABcHBzcQB+AAwBc3EAfgAPAAAAA3BxAH4ADnBwcHNxAH4AA3EAfgAIcQB+AAtzcgAKc2NhbGEuU29tZREi8mleoYt0AgABTAAFdmFsdWVxAH4ADXhyAAxzY2FsYS5PcHRpb27+aTf92w5mdAIAAHhwcQB+ABFzcQB+ABVzcQB+AA8AAAAC")
// TODO SI-8576 Uninitialized field under -Xcheckinit
// check(new mutable.History())( "rO0ABXNyACBzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuSGlzdG9yeUhuXxDIFJrsAgACSQAKbWF4SGlzdG9yeUwAA2xvZ3QAIExzY2FsYS9jb2xsZWN0aW9uL211dGFibGUvUXVldWU7eHAAAAPoc3IAHnNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5RdWV1ZbjMURVfOuHHAgAAeHIAJHNjYWxhLmNvbGxlY3Rpb24ubXV0YWJsZS5NdXRhYmxlTGlzdFJpnjJ+gFbAAgADSQADbGVuTAAGZmlyc3QwdAAlTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9MaW5rZWRMaXN0O0wABWxhc3QwcQB+AAV4cAAAAABzcgAjc2NhbGEuY29sbGVjdGlvbi5tdXRhYmxlLkxpbmtlZExpc3Sak+nGCZHaUQIAAkwABGVsZW10ABJMamF2YS9sYW5nL09iamVjdDtMAARuZXh0dAAeTHNjYWxhL2NvbGxlY3Rpb24vbXV0YWJsZS9TZXE7eHBwcQB+AApxAH4ACg==")
check(mutable.LinkedHashMap(1 -> 2))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlua2VkSGFzaE1hcAAAAAAAAAABAwAAeHB3DQAAAu4AAAABAAAABABzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4AAgAAAAJ4")
@@ -201,7 +194,7 @@ object Test extends App {
// TODO SI-8576 unstable under -Xcheckinit
// check(mutable.ListBuffer(1, 2, 3))( "rO0ABXNyACNzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuTGlzdEJ1ZmZlci9y9I7QyWzGAwAEWgAIZXhwb3J0ZWRJAANsZW5MAAVsYXN0MHQAKUxzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS8kY29sb24kY29sb247TAAqc2NhbGEkY29sbGVjdGlvbiRtdXRhYmxlJExpc3RCdWZmZXIkJHN0YXJ0dAAhTHNjYWxhL2NvbGxlY3Rpb24vaW1tdXRhYmxlL0xpc3Q7eHBzcgARamF2YS5sYW5nLkludGVnZXIS4qCk94GHOAIAAUkABXZhbHVleHIAEGphdmEubGFuZy5OdW1iZXKGrJUdC5TgiwIAAHhwAAAAAXNxAH4ABAAAAAJzcQB+AAQAAAADc3IALHNjYWxhLmNvbGxlY3Rpb24uaW1tdXRhYmxlLkxpc3RTZXJpYWxpemVFbmQkilxjW/dTC20CAAB4cHcFAAAAAAN4")
check(new mutable.StringBuilder(new java.lang.StringBuilder("123")))( "rO0ABXNyACZzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuU3RyaW5nQnVpbGRlcomvqgGv1tTxAgABTAAKdW5kZXJseWluZ3QAGUxqYXZhL2xhbmcvU3RyaW5nQnVpbGRlcjt4cHNyABdqYXZhLmxhbmcuU3RyaW5nQnVpbGRlcjzV+xRaTGrLAwAAeHB3BAAAAAN1cgACW0OwJmaw4l2ErAIAAHhwAAAAEwAxADIAMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeA==")
- check(mutable.UnrolledBuffer[Int]())( "rO0ABXNyACdzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVW5yb2xsZWRCdWZmZXIAAAAAAAAAAQMAAUwAA3RhZ3QAGExzY2FsYS9yZWZsZWN0L0NsYXNzVGFnO3hwc3IAJXNjYWxhLnJlZmxlY3QuTWFuaWZlc3RGYWN0b3J5JCRhbm9uJDnN+aJJU2O1UgIAAHhyABxzY2FsYS5yZWZsZWN0LkFueVZhbE1hbmlmZXN0AAAAAAAAAAECAAFMAAh0b1N0cmluZ3QAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAADSW50dwQAAAAAeA==")
+ check(mutable.UnrolledBuffer[Int]())( "rO0ABXNyACdzY2FsYS5jb2xsZWN0aW9uLm11dGFibGUuVW5yb2xsZWRCdWZmZXIAAAAAAAAAAQMAAUwAA3RhZ3QAGExzY2FsYS9yZWZsZWN0L0NsYXNzVGFnO3hwc3IAKXNjYWxhLnJlZmxlY3QuTWFuaWZlc3RGYWN0b3J5JEludE1hbmlmZXN0VuOHY9AvTWoCAAB4cgAcc2NhbGEucmVmbGVjdC5BbnlWYWxNYW5pZmVzdAAAAAAAAAABAgABTAAIdG9TdHJpbmd0ABJMamF2YS9sYW5nL1N0cmluZzt4cHQAA0ludHcEAAAAAHg=")
import collection.parallel
check(parallel.immutable.ParHashMap(1 -> 2))( "rO0ABXNyAC5zY2FsYS5jb2xsZWN0aW9uLnBhcmFsbGVsLmltbXV0YWJsZS5QYXJIYXNoTWFwAAAAAAAAAAECAANMAA9TY2FuTGVhZiRtb2R1bGV0ADVMc2NhbGEvY29sbGVjdGlvbi9wYXJhbGxlbC9QYXJJdGVyYWJsZUxpa2UkU2NhbkxlYWYkO0wAD1NjYW5Ob2RlJG1vZHVsZXQANUxzY2FsYS9jb2xsZWN0aW9uL3BhcmFsbGVsL1Bhckl0ZXJhYmxlTGlrZSRTY2FuTm9kZSQ7TAAEdHJpZXQAJExzY2FsYS9jb2xsZWN0aW9uL2ltbXV0YWJsZS9IYXNoTWFwO3hwcHBzcgA1c2NhbGEuY29sbGVjdGlvbi5pbW11dGFibGUuSGFzaE1hcCRTZXJpYWxpemF0aW9uUHJveHkAAAAAAAAAAgMAAHhwdwQAAAABc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAAFzcQB+AAcAAAACeA==")
diff --git a/test/files/run/t8601e/StaticInit.class b/test/files/run/t8601e/StaticInit.class
deleted file mode 100644
index 99a0e2a643..0000000000
--- a/test/files/run/t8601e/StaticInit.class
+++ /dev/null
Binary files differ
diff --git a/test/files/run/t9268.check b/test/files/run/t9268.check
index 90ef940eb3..60afcbb648 100644
--- a/test/files/run/t9268.check
+++ b/test/files/run/t9268.check
@@ -1,5 +1,4 @@
Compiling Client1
-pos: NoPosition Class Waiter not found - continuing with a stub. WARNING
+
Compiling Client2
-pos: NoPosition Class Waiter not found - continuing with a stub. WARNING
pos: NoPosition Unable to locate class corresponding to inner class entry for Predicate in owner Waiter ERROR
diff --git a/test/files/run/trait-static-clash.scala b/test/files/run/trait-static-clash.scala
new file mode 100644
index 0000000000..603cf6b6e5
--- /dev/null
+++ b/test/files/run/trait-static-clash.scala
@@ -0,0 +1,10 @@
+trait T {
+ def foo = 1
+ def foo(t: T) = 2
+}
+object Test extends T {
+ def main(args: Array[String]) {
+ assert(foo == 1)
+ assert(foo(this) == 2)
+ }
+}
diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check
index cd860bf394..1104dbea83 100644
--- a/test/files/run/xMigration.check
+++ b/test/files/run/xMigration.check
@@ -11,7 +11,7 @@ scala> :setting -Xmigration:any
scala> Map(1 -> "eis").values // warn
<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
-`values` returns `Iterable[B]` rather than `Iterator[B]`.
+`values` returns `Iterable[V]` rather than `Iterator[V]`.
Map(1 -> "eis").values // warn
^
res2: Iterable[String] = MapLike(eis)
@@ -25,7 +25,7 @@ scala> :setting -Xmigration:2.7
scala> Map(1 -> "eis").values // warn
<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
-`values` returns `Iterable[B]` rather than `Iterator[B]`.
+`values` returns `Iterable[V]` rather than `Iterator[V]`.
Map(1 -> "eis").values // warn
^
res4: Iterable[String] = MapLike(eis)
@@ -39,7 +39,7 @@ scala> :setting -Xmigration // same as :any
scala> Map(1 -> "eis").values // warn
<console>:12: warning: method values in trait MapLike has changed semantics in version 2.8.0:
-`values` returns `Iterable[B]` rather than `Iterator[B]`.
+`values` returns `Iterable[V]` rather than `Iterator[V]`.
Map(1 -> "eis").values // warn
^
res6: Iterable[String] = MapLike(eis)
diff --git a/test/files/scalacheck/CheckEither.scala b/test/files/scalacheck/CheckEither.scala
index 48f732a22d..f0ec797045 100644
--- a/test/files/scalacheck/CheckEither.scala
+++ b/test/files/scalacheck/CheckEither.scala
@@ -132,6 +132,58 @@ object Test extends Properties("Either") {
case Right(a) => a
}))
+ val prop_getOrElse = forAll((e: Either[Int, Int], or: Int) => e.getOrElse(or) == (e match {
+ case Left(_) => or
+ case Right(b) => b
+ }))
+
+ val prop_contains = forAll((e: Either[Int, Int], n: Int) =>
+ e.contains(n) == (e.isRight && e.right.get == n))
+
+ val prop_forall = forAll((e: Either[Int, Int]) =>
+ e.forall(_ % 2 == 0) == (e.isLeft || e.right.get % 2 == 0))
+
+ val prop_exists = forAll((e: Either[Int, Int]) =>
+ e.exists(_ % 2 == 0) == (e.isRight && e.right.get % 2 == 0))
+
+ val prop_flatMapLeftIdentity = forAll((e: Either[Int, Int], n: Int, s: String) => {
+ def f(x: Int) = if(x % 2 == 0) Left(s) else Right(s)
+ Right(n).flatMap(f(_)) == f(n)})
+
+ val prop_flatMapRightIdentity = forAll((e: Either[Int, Int]) => e.flatMap(Right(_)) == e)
+
+ val prop_flatMapComposition = forAll((e: Either[Int, Int]) => {
+ def f(x: Int) = if(x % 2 == 0) Left(x) else Right(x)
+ def g(x: Int) = if(x % 7 == 0) Right(x) else Left(x)
+ e.flatMap(f(_)).flatMap(g(_)) == e.flatMap(f(_).flatMap(g(_)))})
+
+ val prop_mapIdentity = forAll((e: Either[Int, Int]) => e.map(x => x) == e)
+
+ val prop_mapComposition = forAll((e: Either[Int, String]) => {
+ def f(s: String) = s.toLowerCase
+ def g(s: String) = s.reverse
+ e.map(x => f(g(x))) == e.map(x => g(x)).map(f(_))})
+
+ val prop_filterOrElse = forAll((e: Either[Int, Int], x: Int) => e.filterOrElse(_ % 2 == 0, -x) ==
+ (if(e.isLeft) e
+ else if(e.right.get % 2 == 0) e
+ else Left(-x)))
+
+ val prop_seq = forAll((e: Either[Int, Int]) => e.toSeq == (e match {
+ case Left(_) => collection.immutable.Seq.empty
+ case Right(b) => collection.immutable.Seq(b)
+ }))
+
+ val prop_option = forAll((e: Either[Int, Int]) => e.toOption == (e match {
+ case Left(_) => None
+ case Right(b) => Some(b)
+ }))
+
+ val prop_try = forAll((e: Either[Throwable, Int]) => e.toTry == (e match {
+ case Left(a) => util.Failure(a)
+ case Right(b) => util.Success(b)
+ }))
+
/** Hard to believe I'm "fixing" a test to reflect B before A ... */
val prop_Either_cond = forAll((c: Boolean, a: Int, b: Int) =>
Either.cond(c, a, b) == (if(c) Right(a) else Left(b)))
@@ -169,9 +221,21 @@ object Test extends Properties("Either") {
("prop_Either_right", prop_Either_right),
("prop_Either_joinLeft", prop_Either_joinLeft),
("prop_Either_joinRight", prop_Either_joinRight),
- ("prop_Either_reduce", prop_Either_reduce),
- ("prop_Either_cond", prop_Either_cond)
- )
+ ("prop_Either_reduce", prop_Either_reduce),
+ ("prop_getOrElse", prop_getOrElse),
+ ("prop_contains", prop_contains),
+ ("prop_forall", prop_forall),
+ ("prop_exists", prop_exists),
+ ("prop_flatMapLeftIdentity", prop_flatMapLeftIdentity),
+ ("prop_flatMapRightIdentity", prop_flatMapRightIdentity),
+ ("prop_flatMapComposition", prop_flatMapComposition),
+ ("prop_mapIdentity", prop_mapIdentity),
+ ("prop_mapComposition", prop_mapComposition),
+ ("prop_filterOrElse", prop_filterOrElse),
+ ("prop_seq", prop_seq),
+ ("prop_option", prop_option),
+ ("prop_try", prop_try),
+ ("prop_Either_cond", prop_Either_cond))
for ((label, prop) <- tests) {
property(label) = prop
diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala
index 691a3e961e..605c16857a 100644
--- a/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelArrayCheck.scala
@@ -44,7 +44,7 @@ abstract class ParallelArrayCheck[T](tp: String) extends ParallelSeqCheck[T]("Pa
pa
}
- property("array mappings must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("array mappings must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((f, ind) <- mapFunctions.zipWithIndex)
yield ("op index: " + ind) |: t.map(f) == coll.map(f)
results.reduceLeft(_ && _)
diff --git a/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala b/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala
index 9805e2644f..fb09a5bbb7 100644
--- a/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelArrayViewCheck.scala
@@ -46,7 +46,7 @@
// pa.view
// }
-// property("forces must be equal") = forAll(collectionPairs) { case (s, coll) =>
+// property("forces must be equal") = forAllNoShrink(collectionPairs) { case (s, coll) =>
// val smodif = (s ++ s).reverse.take(s.length).reverse.zip(s).drop(s.length / 2)
// val cmodif = (coll ++ s).reverse.take(s.length).reverse.zip(s).drop(s.length / 2).force
// smodif == cmodif
diff --git a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
index 468bcb6dd1..7e7ef2ce1b 100644
--- a/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelIterableCheck.scala
@@ -109,7 +109,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
println("cf == tf - " + (cf == tf))
}
- property("reductions must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) =>
+ property("reductions must be equal for assoc. operators") = forAllNoShrink(collectionPairs) { case (t, coll) =>
if (t.size != 0) {
val results = for ((op, ind) <- reduceOperators.zipWithIndex) yield {
val tr = t.reduceLeft(op)
@@ -127,7 +127,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
} else "has size 0" |: true
}
- property("counts must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("counts must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((pred, ind) <- countPredicates.zipWithIndex) yield {
val tc = t.count(pred)
val cc = coll.count(pred)
@@ -143,19 +143,19 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
results.reduceLeft(_ && _)
}
- property("forall must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("forall must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((pred, ind) <- forallPredicates.zipWithIndex)
yield ("op index: " + ind) |: t.forall(pred) == coll.forall(pred)
results.reduceLeft(_ && _)
}
- property("exists must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("exists must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((pred, ind) <- existsPredicates.zipWithIndex)
yield ("op index: " + ind) |: t.exists(pred) == coll.exists(pred)
results.reduceLeft(_ && _)
}
- property("both must find or not find an element") = forAll(collectionPairs) { case (t, coll) =>
+ property("both must find or not find an element") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((pred, ind) <- findPredicates.zipWithIndex) yield {
val ft = t.find(pred)
val fcoll = coll.find(pred)
@@ -164,7 +164,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
results.reduceLeft(_ && _)
}
- property("mappings must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("mappings must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((f, ind) <- mapFunctions.zipWithIndex) yield {
val ms = t.map(f)
val mp = coll.map(f)
@@ -185,7 +185,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
results.reduceLeft(_ && _)
}
- property("collects must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("collects must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val results = for ((f, ind) <- partialMapFunctions.zipWithIndex) yield {
val ps = t.collect(f)
val pp = coll.collect(f)
@@ -201,12 +201,12 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
results.reduceLeft(_ && _)
}
- property("flatMaps must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("flatMaps must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((f, ind) <- flatMapFunctions.zipWithIndex)
yield ("op index: " + ind) |: areEqual(t.flatMap(f), coll.flatMap(f))).reduceLeft(_ && _)
}
- property("filters must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("filters must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((p, ind) <- filterPredicates.zipWithIndex) yield {
val tf = t.filter(p)
val cf = coll.filter(p)
@@ -235,7 +235,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}).reduceLeft(_ && _)
}
- property("filterNots must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ property("filterNots must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((p, ind) <- filterNotPredicates.zipWithIndex) yield {
val tf = t.filterNot(p)
val cf = coll.filterNot(p)
@@ -244,7 +244,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}).reduceLeft(_ && _)
}
- if (!isCheckingViews) property("partitions must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ if (!isCheckingViews) property("partitions must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((p, ind) <- partitionPredicates.zipWithIndex) yield {
val tpart = t.partition(p)
val cpart = coll.partition(p)
@@ -258,15 +258,15 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}).reduceLeft(_ && _)
}
- if (hasStrictOrder) property("takes must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
+ if (hasStrictOrder) property("takes must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
("take " + n + " elements") |: t.take(n) == coll.take(n)
}
- if (hasStrictOrder) property("drops must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
+ if (hasStrictOrder) property("drops must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
("drop " + n + " elements") |: t.drop(n) == coll.drop(n)
}
- if (hasStrictOrder) property("slices must be equal") = forAll(collectionPairsWith2Indices)
+ if (hasStrictOrder) property("slices must be equal") = forAllNoShrink(collectionPairsWith2Indices)
{ case (t, coll, fr, slicelength) =>
val from = if (fr < 0) 0 else fr
val until = if (from + slicelength > t.size) t.size else from + slicelength
@@ -290,7 +290,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
("slice from " + from + " until " + until) |: tsl == collsl
}
- if (hasStrictOrder) property("splits must be equal") = forAll(collectionPairsWithLengths) { case (t, coll, n) =>
+ if (hasStrictOrder) property("splits must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (t, coll, n) =>
val tspl = t.splitAt(n)
val cspl = coll.splitAt(n)
if (tspl != cspl) {
@@ -303,7 +303,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
("splitAt " + n) |: tspl == cspl
}
- if (hasStrictOrder) property("takeWhiles must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ if (hasStrictOrder) property("takeWhiles must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((pred, ind) <- takeWhilePredicates.zipWithIndex) yield {
val tt = t.takeWhile(pred)
val ct = coll.takeWhile(pred)
@@ -318,7 +318,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}).reduceLeft(_ && _)
}
- if (hasStrictOrder) property("spans must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ if (hasStrictOrder) property("spans must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((pred, ind) <- spanPredicates.zipWithIndex) yield {
val tsp = t.span(pred)
val csp = coll.span(pred)
@@ -336,13 +336,13 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}).reduceLeft(_ && _)
}
- if (hasStrictOrder) property("dropWhiles must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ if (hasStrictOrder) property("dropWhiles must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for ((pred, ind) <- dropWhilePredicates.zipWithIndex) yield {
("operator " + ind) |: t.dropWhile(pred) == coll.dropWhile(pred)
}).reduceLeft(_ && _)
}
- property("folds must be equal for assoc. operators") = forAll(collectionPairs) { case (t, coll) =>
+ property("folds must be equal for assoc. operators") = forAllNoShrink(collectionPairs) { case (t, coll) =>
(for (((first, op), ind) <- foldArguments.zipWithIndex) yield {
val tres = t.foldLeft(first)(op)
val cres = coll.fold(first)(op)
@@ -389,7 +389,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}
}
- if (hasStrictOrder) property("copies to array must be equal") = forAll(collectionPairs) { case (t, coll) =>
+ if (hasStrictOrder) property("copies to array must be equal") = forAllNoShrink(collectionPairs) { case (t, coll) =>
val tarr = newArray(t.size)
val collarr = newArray(coll.size)
t.copyToArray(tarr, 0, t.size)
@@ -403,7 +403,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
tarr.toSeq == collarr.toSeq
}
- if (hasStrictOrder) property("scans must be equal") = forAll(collectionPairs) {
+ if (hasStrictOrder) property("scans must be equal") = forAllNoShrink(collectionPairs) {
case (t, coll) =>
(for (((first, op), ind) <- foldArguments.zipWithIndex) yield {
val tscan = t.scanLeft(first)(op)
@@ -419,7 +419,7 @@ abstract class ParallelIterableCheck[T](collName: String) extends Properties(col
}).reduceLeft(_ && _)
}
- property("groupBy must be equal") = forAll(collectionPairs) {
+ property("groupBy must be equal") = forAllNoShrink(collectionPairs) {
case (t, coll) =>
(for ((f, ind) <- groupByFunctions.zipWithIndex) yield {
val tgroup = t.groupBy(f)
diff --git a/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala b/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala
index d4643e7f2c..50aa4ad0c7 100644
--- a/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelMapCheck1.scala
@@ -17,7 +17,7 @@ import scala.collection.parallel._
abstract class ParallelMapCheck[K, V](collname: String) extends ParallelIterableCheck[(K, V)](collname) {
type CollType <: ParMap[K, V]
- property("gets iterated keys") = forAll(collectionPairs) {
+ property("gets iterated keys") = forAllNoShrink(collectionPairs) {
case (t, coll) =>
val containsT = for ((k, v) <- t) yield (coll.get(k) == Some(v))
val containsSelf = coll.map { case (k, v) => coll.get(k) == Some(v) }
diff --git a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
index 3f8a8ad4f5..48c3d3f745 100644
--- a/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelSeqCheck.scala
@@ -24,6 +24,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
def fromSeq(s: Seq[T]): CollType
override def instances(vals: Seq[Gen[T]]): Gen[Seq[T]] = oneOf(
+ Gen.const(ofSize(vals, 1)),
sized(
sz =>
ofSize(vals, sz)
@@ -74,7 +75,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
coll.patch(updateStart, coll, howMany)
}
- property("segmentLengths must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ property("segmentLengths must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (s, coll, len) =>
(for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield {
val slen = s.segmentLength(pred, if (len < 0) 0 else len)
val clen = coll.segmentLength(pred, len)
@@ -88,13 +89,13 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}).reduceLeft(_ && _)
}
- property("prefixLengths must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ property("prefixLengths must be equal") = forAllNoShrink(collectionPairs) { case (s, coll) =>
(for ((pred, ind) <- segmentLengthPredicates.zipWithIndex) yield {
("operator " + ind) |: s.prefixLength(pred) == coll.prefixLength(pred)
}).reduceLeft(_ && _)
}
- property("indexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ property("indexWheres must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (s, coll, len) =>
(for ((pred, ind) <- indexWherePredicates.zipWithIndex) yield {
val sind = s.indexWhere(pred, len)
val cind = coll.indexWhere(pred, len)
@@ -109,7 +110,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}).reduceLeft(_ && _)
}
- property("lastIndexWheres must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ property("lastIndexWheres must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (s, coll, len) =>
(for ((pred, ind) <- lastIndexWherePredicates.zipWithIndex) yield {
val end = if (len >= s.size) s.size - 1 else len
val sind = s.lastIndexWhere(pred, end)
@@ -118,7 +119,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}).reduceLeft(_ && _)
}
- property("reverses must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ property("reverses must be equal") = forAllNoShrink(collectionPairs) { case (s, coll) =>
(s.length == 0 && s.getClass == classOf[collection.immutable.Range]) ||
{
val sr = s.reverse
@@ -133,13 +134,13 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}
}
- property("reverseMaps must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ property("reverseMaps must be equal") = forAllNoShrink(collectionPairs) { case (s, coll) =>
(for ((f, ind) <- reverseMapFunctions.zipWithIndex) yield {
("operator " + ind) |: s.reverseMap(f) == coll.reverseMap(f)
}).reduceLeft(_ && _)
}
- property("sameElements must be equal") = forAll(collectionPairsWithModifiedWithLengths) {
+ property("sameElements must be equal") = forAllNoShrink(collectionPairsWithModifiedWithLengths) {
case (s, coll, collmodif, len) =>
val pos = if (len < 0) 0 else len
val scm = s.sameElements(collmodif)
@@ -171,7 +172,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}).reduceLeft(_ && _)
}
- property("startsWiths must be equal") = forAll(collectionPairsWithModifiedWithLengths) {
+ property("startsWiths must be equal") = forAllNoShrink(collectionPairsWithModifiedWithLengths) {
case (s, coll, collmodif, len) =>
val pos = if (len < 0) 0 else len
("start with self" |: s.startsWith(s) == coll.startsWith(coll)) &&
@@ -195,7 +196,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}).reduceLeft(_ && _)
}
- property("endsWiths must be equal") = forAll(collectionPairsWithModified) {
+ property("endsWiths must be equal") = forAllNoShrink(collectionPairsWithModified) {
case (s, coll, collmodif) =>
("ends with self" |: s.endsWith(s) == coll.endsWith(s)) &&
("ends with tail" |: (s.length == 0 || s.endsWith(s.tail) == coll.endsWith(coll.tail))) &&
@@ -214,7 +215,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
}).reduceLeft(_ && _)
}
- property("unions must be equal") = forAll(collectionPairsWithModified) { case (s, coll, collmodif) =>
+ property("unions must be equal") = forAllNoShrink(collectionPairsWithModified) { case (s, coll, collmodif) =>
("modified" |: s.union(collmodif.seq) == coll.union(collmodif)) &&
("empty" |: s.union(Nil) == coll.union(fromSeq(Nil)))
}
@@ -233,7 +234,7 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
("with one" |: (s.length == 0 || s.patch(from, List(s(0)), 1) == coll.patch(from, fromSeq(List(coll(0))), 1)))
}
- if (!isCheckingViews) property("updates must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ if (!isCheckingViews) property("updates must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (s, coll, len) =>
val pos = if (len >= s.length) s.length - 1 else len
if (s.length > 0) {
val supd = s.updated(pos, s(0))
@@ -248,15 +249,15 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
} else "trivially" |: true
}
- property("prepends must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ property("prepends must be equal") = forAllNoShrink(collectionPairs) { case (s, coll) =>
s.length == 0 || s(0) +: s == coll(0) +: coll
}
- property("appends must be equal") = forAll(collectionPairs) { case (s, coll) =>
+ property("appends must be equal") = forAllNoShrink(collectionPairs) { case (s, coll) =>
s.length == 0 || s :+ s(0) == coll :+ coll(0)
}
- property("padTos must be equal") = forAll(collectionPairsWithLengths) { case (s, coll, len) =>
+ property("padTos must be equal") = forAllNoShrink(collectionPairsWithLengths) { case (s, coll, len) =>
val someValue = sampleValue
val sdoub = s.padTo(len * 2, someValue)
val cdoub = coll.padTo(len * 2, someValue)
@@ -267,10 +268,10 @@ abstract class ParallelSeqCheck[T](collName: String) extends ParallelIterableChe
println(cdoub)
}
("smaller" |: s.padTo(len / 2, someValue) == coll.padTo(len / 2, someValue)) &&
- ("bigger" |: sdoub == cdoub)
+ ("bigger" |: sdoub == cdoub)
}
- property("corresponds must be equal") = forAll(collectionPairsWithModified) { case (s, coll, modified) =>
+ property("corresponds must be equal") = forAllNoShrink(collectionPairsWithModified) { case (s, coll, modified) =>
val modifcut = modified.toSeq.slice(0, modified.length)
("self" |: s.corresponds(s)(_ == _) == coll.corresponds(coll)(_ == _)) &&
("modified" |: s.corresponds(modified.seq)(_ == _) == coll.corresponds(modified)(_ == _)) &&
diff --git a/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala b/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala
index 56f7832fed..c22dddf96d 100644
--- a/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala
+++ b/test/files/scalacheck/parallel-collections/ParallelSetCheck.scala
@@ -17,7 +17,7 @@ import scala.collection.parallel._
abstract class ParallelSetCheck[T](collname: String) extends ParallelIterableCheck[T](collname) {
type CollType <: ParSet[T]
- property("gets iterated keys") = forAll(collectionPairs) {
+ property("gets iterated keys") = forAllNoShrink(collectionPairs) {
case (t, coll) =>
val containsT = for (elem <- t) yield (coll.contains(elem))
val containsSelf = for (elem <- coll) yield (coll.contains(elem))
diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala
index 4df29e36c0..09061a3b29 100644
--- a/test/junit/scala/collection/IteratorTest.scala
+++ b/test/junit/scala/collection/IteratorTest.scala
@@ -214,4 +214,32 @@ class IteratorTest {
assertSameElements(exp, res)
assertEquals(8, counter) // was 14
}
+ // SI-9691
+ @Test def bufferedHeadOptionReturnsValueWithHeadOrNone(): Unit = {
+ // Checks BufferedIterator returns Some(value) when there is a value
+ val validHeadOption = List(1,2,3).iterator.buffered.headOption
+ assertEquals(Some(1), validHeadOption)
+ // Checks BufferedIterator returns None when there is no value
+ val invalidHeadOption = List(1,2,3).iterator.drop(10).buffered.headOption
+ assertEquals(None: Option[Int], invalidHeadOption)
+ // Checks BufferedIterator returns Some(value) in the last position with a value
+ val validHeadOptionAtTail = List(1,2,3).iterator.drop(2).buffered.headOption
+ assertEquals(Some(3), validHeadOptionAtTail)
+ // Checks BufferedIterator returns None at the first position without a value
+ val invalidHeadOptionOnePastTail = List(1,2,3).iterator.drop(3).buffered.headOption
+ assertEquals(None, invalidHeadOptionOnePastTail)
+ // Checks BufferedIterator returns Some(null) if the next value is null.
+ val nullHandingList = List(null, "yellow").iterator.buffered.headOption
+ assertEquals(Some(null), nullHandingList)
+ // Checks that BufferedIterator is idempotent. That the head is not
+ // changed by its invocation, nor the headOption by the next call to head.
+ val it = List(1,2,3).iterator.buffered
+ val v1 = it.head
+ val v2 = it.headOption
+ val v3 = it.head
+ val v4 = it.headOption
+ assertEquals(v1, v3)
+ assertEquals(v2, v4)
+ assertEquals(Some(v1), v2)
+ }
}
diff --git a/test/junit/scala/lang/traits/BytecodeTest.scala b/test/junit/scala/lang/traits/BytecodeTest.scala
index f47fc9c127..ec8508df99 100644
--- a/test/junit/scala/lang/traits/BytecodeTest.scala
+++ b/test/junit/scala/lang/traits/BytecodeTest.scala
@@ -9,6 +9,7 @@ import scala.collection.JavaConverters._
import scala.tools.asm.Opcodes
import scala.tools.asm.Opcodes._
import scala.tools.asm.tree.ClassNode
+import scala.tools.nsc.backend.jvm.opt.BytecodeUtils
import scala.tools.partest.ASMConverters._
import scala.tools.testing.BytecodeTesting
import scala.tools.testing.BytecodeTesting._
@@ -18,8 +19,8 @@ class BytecodeTest extends BytecodeTesting {
import compiler._
def checkForwarder(classes: Map[String, ClassNode], clsName: Symbol, target: String) = {
- val List(f) = getMethods(classes(clsName.name), "f")
- assertSameCode(f, List(VarOp(ALOAD, 0), Invoke(INVOKESPECIAL, target, "f", "()I", false), Op(IRETURN)))
+ val f = getMethod(classes(clsName.name), "f")
+ assertSameCode(f, List(VarOp(ALOAD, 0), Invoke(INVOKESTATIC, target, "f$", s"(L$target;)I", true), Op(IRETURN)))
}
@Test
@@ -88,7 +89,7 @@ class BytecodeTest extends BytecodeTesting {
assertSameSummary(getMethod(c("C18"), "f"), List(BIPUSH, IRETURN))
checkForwarder(c, 'C19, "T7")
assertSameCode(getMethod(c("C19"), "T7$$super$f"), List(VarOp(ALOAD, 0), Invoke(INVOKESPECIAL, "C18", "f", "()I", false), Op(IRETURN)))
- assertInvoke(getMethod(c("C20"), "clone"), "T8", "clone") // mixin forwarder
+ assertInvoke(getMethod(c("C20"), "clone"), "T8", "clone$") // mixin forwarder
}
@Test
@@ -141,7 +142,7 @@ class BytecodeTest extends BytecodeTesting {
def invocationReceivers(): Unit = {
val List(c1, c2, t, u) = compileClasses(invocationReceiversTestCode.definitions("Object"))
// mixin forwarder in C1
- assertSameCode(getMethod(c1, "clone"), List(VarOp(ALOAD, 0), Invoke(INVOKESPECIAL, "T", "clone", "()Ljava/lang/Object;", false), Op(ARETURN)))
+ assertSameCode(getMethod(c1, "clone"), List(VarOp(ALOAD, 0), Invoke(INVOKESTATIC, "T", "clone$", "(LT;)Ljava/lang/Object;", true), Op(ARETURN)))
assertInvoke(getMethod(c1, "f1"), "T", "clone")
assertInvoke(getMethod(c1, "f2"), "T", "clone")
assertInvoke(getMethod(c1, "f3"), "C1", "clone")
diff --git a/test/junit/scala/reflect/internal/PrintersTest.scala b/test/junit/scala/reflect/internal/PrintersTest.scala
index 2305e7ea50..d581ca8cf4 100644
--- a/test/junit/scala/reflect/internal/PrintersTest.scala
+++ b/test/junit/scala/reflect/internal/PrintersTest.scala
@@ -79,6 +79,22 @@ class BasePrintTest {
@Test def testConstantLong = assertTreeCode(Literal(Constant(42l)))("42L")
+ val sq = "\""
+ val tq = "\"" * 3
+ val teq = "\"\"\\\""
+
+ @Test def testConstantMultiline = assertTreeCode(Literal(Constant("hello\nworld")))(s"${tq}hello\nworld${tq}")
+
+ @Test def testConstantFormfeed = assertTreeCode(Literal(Constant("hello\fworld")))(s"${sq}hello\\fworld${sq}")
+
+ @Test def testConstantControl = assertTreeCode(Literal(Constant("hello\u0003world")))(s"${sq}hello\\u0003world${sq}")
+
+ @Test def testConstantFormfeedChar = assertTreeCode(Literal(Constant('\f')))("'\\f'")
+
+ @Test def testConstantControlChar = assertTreeCode(Literal(Constant(3.toChar)))("'\\u0003'")
+
+ @Test def testConstantEmbeddedTriple = assertTreeCode(Literal(Constant(s"${tq}hello${tq}\nworld")))(s"${tq}${teq}hello${teq}\nworld${tq}")
+
@Test def testOpExpr = assertPrintedCode("(5).+(4)", checkTypedTree = false)
@Test def testName1 = assertPrintedCode("class test")
diff --git a/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala b/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala
index b2ee8b3a45..5904cb2441 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/BytecodeTest.scala
@@ -168,4 +168,23 @@ class BytecodeTest extends BytecodeTesting {
assertEquals(x.start, labels(1))
assertEquals(x.end, labels(7))
}
+
+ @Test // wrong line numbers for rewritten `this` references in trait static methods
+ def sd186_traitLineNumber(): Unit = {
+ val code =
+ """trait T {
+ | def t(): Unit = {
+ | toString
+ | toString
+ | }
+ |}
+ """.stripMargin
+ val t = compileClass(code)
+ val tMethod = getMethod(t, "t$")
+ val invoke = Invoke(INVOKEVIRTUAL, "java/lang/Object", "toString", "()Ljava/lang/String;", false)
+ assertSameCode(tMethod.instructions,
+ List(Label(0), LineNumber(3, Label(0)), VarOp(ALOAD, 0), invoke, Op(POP),
+ Label(5), LineNumber(4, Label(5)), VarOp(ALOAD, 0), invoke, Op(POP), Op(RETURN), Label(11))
+ )
+ }
}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
index c9a958ee4f..841e850b49 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/DefaultMethodTest.scala
@@ -5,6 +5,7 @@ import org.junit.Test
import scala.collection.JavaConverters
import scala.collection.JavaConverters._
+import scala.reflect.internal.Flags
import scala.tools.asm.Opcodes
import scala.tools.asm.tree.ClassNode
import scala.tools.testing.BytecodeTesting
@@ -21,7 +22,7 @@ class DefaultMethodTest extends BytecodeTesting {
/** Transforms a single tree. */
override def transform(tree: global.Tree): global.Tree = tree match {
case dd @ DefDef(_, Foo, _, _, _, _) =>
- dd.symbol.setFlag(reflect.internal.Flags.JAVA_DEFAULTMETHOD)
+ dd.symbol.setFlag(Flags.JAVA_DEFAULTMETHOD).resetFlag(Flags.DEFERRED)
copyDefDef(dd)(rhs = Literal(Constant(1)).setType(definitions.IntTpe))
case _ => super.transform(tree)
}
@@ -31,6 +32,4 @@ class DefaultMethodTest extends BytecodeTesting {
assertTrue("default method should not be abstract", (foo.access & Opcodes.ACC_ABSTRACT) == 0)
assertTrue("default method body emitted", foo.instructions.size() > 0)
}
-
-
}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala
index a28599cd92..38285fbce1 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala
@@ -1,7 +1,9 @@
package scala.tools.nsc.backend.jvm
+import java.nio.file.{Files, Paths}
+
import org.junit.Assert._
-import org.junit.Test
+import org.junit.{Ignore, Test}
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala
index a2513cacdc..85df42e069 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerSeparateCompilationTest.scala
@@ -97,7 +97,7 @@ class InlinerSeparateCompilationTest {
""".stripMargin
val List(a, t) = compileClassesSeparately(List(codeA, assembly), args)
- assertNoInvoke(getMethod(t, "f"))
- assertNoInvoke(getMethod(a, "n"))
+ assertNoInvoke(getMethod(t, "f$"))
+ assertNoInvoke(getMethod(a, "n$"))
}
}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala
index 9173a1d189..f531ce9322 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/opt/InlinerTest.scala
@@ -475,11 +475,9 @@ class InlinerTest extends BytecodeTesting {
| def t2 = this.f
|}
""".stripMargin
- val warns = Set(
- "C::f()I is annotated @inline but cannot be inlined: the method is not final and may be overridden",
- "T::f()I is annotated @inline but cannot be inlined: the method is not final and may be overridden")
+ val warn = "T::f()I is annotated @inline but cannot be inlined: the method is not final and may be overridden"
var count = 0
- val List(c, t) = compile(code, allowMessage = i => {count += 1; warns.exists(i.msg contains _)})
+ val List(c, t) = compile(code, allowMessage = i => {count += 1; i.msg contains warn})
assert(count == 2, count)
assertInvoke(getMethod(c, "t1"), "T", "f")
assertInvoke(getMethod(c, "t2"), "C", "f")
@@ -520,7 +518,7 @@ class InlinerTest extends BytecodeTesting {
val List(c, oMirror, oModule, t) = compile(code, allowMessage = i => {count += 1; i.msg contains warn})
assert(count == 1, count)
- assertNoInvoke(getMethod(t, "f"))
+ assertNoInvoke(getMethod(t, "f$"))
assertNoInvoke(getMethod(c, "t1"))
assertNoInvoke(getMethod(c, "t2"))
@@ -546,9 +544,9 @@ class InlinerTest extends BytecodeTesting {
val List(assembly, c, t) = compile(code)
- assertNoInvoke(getMethod(t, "f"))
+ assertNoInvoke(getMethod(t, "f$"))
- assertNoInvoke(getMethod(assembly, "n"))
+ assertNoInvoke(getMethod(assembly, "n$"))
assertNoInvoke(getMethod(c, "t1"))
assertNoInvoke(getMethod(c, "t2"))
@@ -624,8 +622,8 @@ class InlinerTest extends BytecodeTesting {
val List(ca, cb, t1, t2a, t2b) = compile(code, allowMessage = i => {count += 1; i.msg contains warning})
assert(count == 4, count) // see comments, f is not inlined 4 times
- assertNoInvoke(getMethod(t2a, "g2a"))
- assertInvoke(getMethod(t2b, "g2b"), "T1", "f")
+ assertNoInvoke(getMethod(t2a, "g2a$"))
+ assertInvoke(getMethod(t2b, "g2b$"), "T1", "f")
assertInvoke(getMethod(ca, "m1a"), "T1", "f")
assertNoInvoke(getMethod(ca, "m2a")) // no invoke, see comment on def g2a
@@ -684,8 +682,8 @@ class InlinerTest extends BytecodeTesting {
|}
""".stripMargin
val List(c, t) = compile(code)
- val t1 = getMethod(t, "t1")
- val t2 = getMethod(t, "t2")
+ val t1 = getMethod(t, "t1$")
+ val t2 = getMethod(t, "t2$")
val cast = TypeOp(CHECKCAST, "C")
Set(t1, t2).foreach(m => assert(m.instructions.contains(cast), m.instructions))
}
@@ -1574,4 +1572,19 @@ class InlinerTest extends BytecodeTesting {
Label(0), LineNumber(9, Label(0)), VarOp(ALOAD, 0), Invoke(INVOKEVIRTUAL, "C", "fx", "()V", false),
Label(4), LineNumber(10, Label(4)), Op(ICONST_1), Op(IRETURN), Label(8)))
}
+
+ @Test
+ def traitHO(): Unit = {
+ val code =
+ """trait T {
+ | def foreach(f: Int => Unit): Unit = f(1)
+ |}
+ |final class C extends T {
+ | def cons(x: Int): Unit = ()
+ | def t1 = foreach(cons)
+ |}
+ """.stripMargin
+ val List(c, t) = compile(code)
+ assertNoIndy(getMethod(c, "t1"))
+ }
}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala
index 938bc7b846..2c697bfe50 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/opt/MethodLevelOptsTest.scala
@@ -750,4 +750,24 @@ class MethodLevelOptsTest extends BytecodeTesting {
-1, LDC, ASTORE,
-1, ALOAD, ARETURN))
}
+
+ @Test
+ def elimSamLambda(): Unit = {
+ val code =
+ """class C {
+ | def t1(x: Int) = {
+ | val fun: java.util.function.IntFunction[Int] = y => y + 1
+ | fun(x)
+ | }
+ | def t2(x: Int) = {
+ | val fun: T = i => i + 1
+ | fun.f(x)
+ | }
+ |}
+ |trait T { def f(x: Int): Int }
+ """.stripMargin
+ val List(c, t) = compileClasses(code)
+ assertSameSummary(getMethod(c, "t1"), List(ILOAD, "$anonfun$t1$1", IRETURN))
+ assertSameSummary(getMethod(c, "t2"), List(ILOAD, "$anonfun$t2$1", IRETURN))
+ }
}
diff --git a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala
index 4791a29bfb..54f4c805c1 100644
--- a/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala
+++ b/test/junit/scala/tools/nsc/backend/jvm/opt/ScalaInlineInfoTest.scala
@@ -31,6 +31,14 @@ class ScalaInlineInfoTest extends BytecodeTesting {
r.toString
}
+ def assertSameMethods(c: ClassNode, nameAndSigs: Set[String]): Unit = {
+ val r = new StringBuilder
+ val inClass = c.methods.iterator.asScala.map(m => m.name + m.desc).toSet
+ for (m <- inClass.diff(nameAndSigs)) r.append(s"method in classfile found, but no inline info: $m")
+ for (m <- nameAndSigs.diff(inClass)) r.append(s"inline info found, but no method in classfile: $m")
+ assert(r.isEmpty, r.toString)
+ }
+
@Test
def traitMembersInlineInfo(): Unit = {
val code =
@@ -79,26 +87,32 @@ class ScalaInlineInfoTest extends BytecodeTesting {
("T$$super$toString()Ljava/lang/String;", MethodInlineInfo(true ,false,false)),
("T$_setter_$x1_$eq(I)V", MethodInlineInfo(false,false,false)),
("f1()I", MethodInlineInfo(false,false,false)),
- ("f2()I", MethodInlineInfo(true, false,false)),
+ ("f1$(LT;)I", MethodInlineInfo(true ,false,false)),
+ ("f2()I", MethodInlineInfo(true ,false,false)), // no static impl method for private method f2
("f3()I", MethodInlineInfo(false,false,false)),
+ ("f3$(LT;)I", MethodInlineInfo(true ,false,false)),
("f4()Ljava/lang/String;", MethodInlineInfo(false,true, false)),
+ ("f4$(LT;)Ljava/lang/String;", MethodInlineInfo(true ,true, false)),
("f5()I", MethodInlineInfo(true ,false,false)),
- ("f6()I", MethodInlineInfo(false,false,true )),
+ ("f5$(LT;)I", MethodInlineInfo(true ,false,false)),
+ ("f6()I", MethodInlineInfo(false,false,true )), // no static impl method for abstract method f6
("x1()I", MethodInlineInfo(false,false,false)),
("y2()I", MethodInlineInfo(false,false,false)),
("y2_$eq(I)V", MethodInlineInfo(false,false,false)),
("x3()I", MethodInlineInfo(false,false,false)),
("x3_$eq(I)V", MethodInlineInfo(false,false,false)),
("x4()I", MethodInlineInfo(false,false,false)),
+ ("x4$(LT;)I", MethodInlineInfo(true ,false,false)),
("x5()I", MethodInlineInfo(true, false,false)),
("L$lzycompute$1(Lscala/runtime/VolatileObjectRef;)LT$L$2$;", MethodInlineInfo(true, false,false)),
("L$1(Lscala/runtime/VolatileObjectRef;)LT$L$2$;", MethodInlineInfo(true ,false,false)),
("nest$1()I", MethodInlineInfo(true, false,false)),
- ("$init$()V", MethodInlineInfo(false,false,false))),
+ ("$init$(LT;)V", MethodInlineInfo(true,false,false))),
None // warning
)
assert(infoT == expectT, mapDiff(expectT.methodInfos, infoT.methodInfos) + infoT)
+ assertSameMethods(t, expectT.methodInfos.keySet)
val infoC = inlineInfo(c)
val expectC = InlineInfo(false, None, Map(
@@ -119,6 +133,7 @@ class ScalaInlineInfoTest extends BytecodeTesting {
None)
assert(infoC == expectC, mapDiff(expectC.methodInfos, infoC.methodInfos) + infoC)
+ assertSameMethods(c, expectC.methodInfos.keySet)
}
@Test
@@ -156,7 +171,6 @@ class ScalaInlineInfoTest extends BytecodeTesting {
("F",None),
("T",Some("h(Ljava/lang/String;)I")),
("U",None)))
-
}
@Test
@@ -169,5 +183,6 @@ class ScalaInlineInfoTest extends BytecodeTesting {
"O$lzycompute()LC$O$;" -> MethodInlineInfo(true,false,false),
"O()LC$O$;" -> MethodInlineInfo(true,false,false))
assert(infoC.methodInfos == expected, mapDiff(infoC.methodInfos, expected))
+ assertSameMethods(c, expected.keySet)
}
}
diff --git a/test/junit/scala/tools/testing/BytecodeTesting.scala b/test/junit/scala/tools/testing/BytecodeTesting.scala
index 4ddb6580df..c0fdb8010f 100644
--- a/test/junit/scala/tools/testing/BytecodeTesting.scala
+++ b/test/junit/scala/tools/testing/BytecodeTesting.scala
@@ -12,6 +12,7 @@ import scala.tools.asm.tree.{AbstractInsnNode, ClassNode, MethodNode}
import scala.tools.cmd.CommandLineParser
import scala.tools.nsc.backend.jvm.AsmUtils
import scala.tools.nsc.backend.jvm.AsmUtils._
+import scala.tools.nsc.backend.jvm.opt.BytecodeUtils
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.reporters.StoreReporter
import scala.tools.nsc.{Global, Settings}
@@ -247,11 +248,19 @@ object BytecodeTesting {
def getAsmMethod(c: ClassNode, name: String): MethodNode = {
val methods = getAsmMethods(c, name)
+ def fail() = {
+ val allNames = getAsmMethods(c, _ => true).map(_.name)
+ throw new AssertionFailedError(s"Could not find method named $name among ${allNames}")
+ }
methods match {
case List(m) => m
- case ms =>
- val allNames = getAsmMethods(c, _ => true).map(_.name)
- throw new AssertionFailedError(s"Could not find method named $name among ${allNames}")
+ case ms @ List(m1, m2) if BytecodeUtils.isInterface(c) =>
+ val (statics, nonStatics) = ms.partition(BytecodeUtils.isStaticMethod)
+ (statics, nonStatics) match {
+ case (List(staticMethod), List(_)) => m1 // prefer the static method of the pair if methods in traits
+ case _ => fail()
+ }
+ case ms => fail()
}
}
diff --git a/test/junit/scala/util/matching/RegexTest.scala b/test/junit/scala/util/matching/RegexTest.scala
index 06d0445e1c..d80e05e512 100644
--- a/test/junit/scala/util/matching/RegexTest.scala
+++ b/test/junit/scala/util/matching/RegexTest.scala
@@ -85,8 +85,9 @@ class RegexTest {
assertFalse(ms.hasNext)
}
- //type NoGroup = NoSuchElementException
type NoGroup = IllegalArgumentException
+ type NoMatch = NoSuchElementException
+ type NoData = IllegalStateException
@Test def `SI-9666: throw on bad name`(): Unit = {
assertThrows[NoGroup] {
@@ -108,4 +109,71 @@ class RegexTest {
ms group "Bee"
}
}
+
+ @Test def `SI-9827 MatchIterator ergonomics`(): Unit = {
+ val r = "(ab)(cd)".r
+ val s = "xxxabcdyyyabcdzzz"
+ assertEquals(3, r.findAllIn(s).start)
+ assertEquals(5, r.findAllIn(s).start(2))
+ locally {
+ val mi = r.findAllIn(s)
+ assertTrue(mi.hasNext)
+ assertEquals(3, mi.start)
+ assertEquals("abcd", mi.next())
+ assertEquals(3, mi.start)
+ assertTrue(mi.hasNext)
+ assertEquals(10, mi.start)
+ }
+ locally {
+ val mi = r.findAllIn(s)
+ assertEquals("abcd", mi.next())
+ assertEquals(3, mi.start)
+ assertEquals("abcd", mi.next())
+ assertEquals(10, mi.start)
+ assertThrows[NoMatch] { mi.next() }
+ assertThrows[NoData] { mi.start }
+ }
+ locally {
+ val mi = r.findAllIn("")
+ assertThrows[NoData] { mi.start }
+ assertThrows[NoMatch] { mi.next() }
+ }
+ locally {
+ val mi = r.findAllMatchIn(s)
+ val x = mi.next()
+ assertEquals("abcd", x.matched)
+ assertEquals(3, x.start)
+ val y = mi.next()
+ assertEquals("abcd", y.matched)
+ assertEquals(10, y.start)
+ assertThrows[NoMatch] { mi.next() }
+ assertEquals(3, x.start)
+ assertEquals(10, y.start)
+ }
+ locally {
+ val regex = "(foo)-(.*)".r
+ val s = "foo-abc-def"
+ val result = regex.findAllIn(s)
+ //result.toString // comment this line to make it not work
+ val r = (result.group(1), result.group(2))
+ assertEquals(("foo", "abc-def"), r)
+ }
+ locally {
+ val t = "this is a test"
+ val rx = " ".r
+ val m = rx.findAllIn(t)
+ assertEquals(5, rx.findAllIn(t).end)
+ }
+ locally {
+ val data = "<a>aaaaa</a><b>bbbbbb</b><c>ccccccc</c>"
+ val p = "^<a>(.+)</a><b>(.+)</b><c>(.+)</c>$".r
+ val parts = p.findAllIn(data)
+ val aes = parts.group(1)
+ val bes = parts.group(2)
+ val ces = parts.group(3)
+ assertEquals("ccccccc", ces)
+ assertEquals("bbbbbb", bes)
+ assertEquals("aaaaa", aes)
+ }
+ }
}
diff --git a/test/scaladoc/resources/SI-4826.java b/test/scaladoc/resources/SI-4826.java
new file mode 100644
index 0000000000..f735ce6335
--- /dev/null
+++ b/test/scaladoc/resources/SI-4826.java
@@ -0,0 +1,20 @@
+package test.scaladoc;
+
+/**
+ * Testing java comments. The presence of a :marker:
+ * tag is verified by tests.
+ */
+public class JavaComments {
+
+ /**
+ * Compute the answer to the ultimate question of life, the
+ * universe, and everything. :marker:
+ * @param factor scaling factor to the answer
+ * @return the answer to everything (42) scaled by factor
+ */
+ public int answer(int factor) {
+ return 42 * factor;
+ }
+
+}
+
diff --git a/test/scaladoc/run/SI-4826.check b/test/scaladoc/run/SI-4826.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-4826.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-4826.scala b/test/scaladoc/run/SI-4826.scala
new file mode 100644
index 0000000000..50e4468002
--- /dev/null
+++ b/test/scaladoc/run/SI-4826.scala
@@ -0,0 +1,30 @@
+import scala.tools.nsc.doc.Universe
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def resourceFile = "SI-4826.java"
+
+ // overridden to pass explicit files to newDocFactory.makeUniverse (rather than code strings)
+ // since the .java file extension is required
+ override def model: Option[Universe] = {
+ val path = resourcePath + "/" + resourceFile
+ newDocFactory.makeUniverse(Left(List(path)))
+ }
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ import access._
+ val Tag = ":marker:"
+
+ val base = rootPackage._package("test")._package("scaladoc")
+ val clazz = base._class("JavaComments")
+ val method = clazz._method("answer")
+
+ assert(extractCommentText(clazz.comment.get).contains(Tag))
+ assert(extractCommentText(method.comment.get).contains(Tag))
+ }
+}
diff --git a/versions.properties b/versions.properties
index 488535c991..ed90768780 100644
--- a/versions.properties
+++ b/versions.properties
@@ -8,7 +8,7 @@
# The scala version used for bootstrapping. This has no impact on the final classfiles:
# there are two stages (locker and quick), so compiler and library are always built
# with themselves. Stability is ensured by building a third stage (strap).
-starr.version=2.12.0-M4
+starr.version=2.12.0-M5
# These are the versions of the modules that go with this release.
# These properties are used during PR validation and in dbuild builds.
@@ -19,7 +19,7 @@ starr.version=2.12.0-M4
# - After 2.x.0 is released, the binary version is 2.x.
# - During milestones and RCs, modules are cross-built against the full version.
# So the value is the full version (e.g. 2.12.0-M2).
-scala.binary.version=2.12.0-M4
+scala.binary.version=2.12.0-M5
# external modules shipped with distribution, as specified by scala-library-all's pom
scala-xml.version.number=1.0.5
@@ -27,11 +27,13 @@ scala-parser-combinators.version.number=1.0.4
scala-swing.version.number=2.0.0-M2
scala-swing.version.osgi=2.0.0.M2
jline.version=2.14.1
-scala-asm.version=5.0.4-scala-3
+scala-asm.version=5.1.0-scala-1
# external modules, used internally (not shipped)
-partest.version.number=1.0.16
-scalacheck.version.number=1.11.6
+partest.version.number=1.0.17
+# We've embedded these sources in partest-extras for now. After 2.12.0 is released
+# we can switch to a public release.
+# scalacheck.version.number=1.11.6
# TODO: modularize the compiler
#scala-compiler-doc.version.number=1.0.0-RC1