See https://github.com/scala/scala/releases/tag/v2.12.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Scala (https://www.scala-lang.org) | |
* | |
* Copyright EPFL and Lightbend, Inc. | |
* | |
* Licensed under Apache License 2.0 | |
* (http://www.apache.org/licenses/LICENSE-2.0). | |
* | |
* See the NOTICE file distributed with this work for | |
* additional information regarding copyright ownership. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.monitoring.runtime.instrumentation.AllocationRecorder | |
import com.google.monitoring.runtime.instrumentation.Sampler | |
import scala.collection.convert._ | |
import scala.collection.JavaConverters._ | |
// download java-allocation-instrumenter-3.2.0.jar from here: | |
// http://repo1.maven.org/maven2/com/google/code/java-allocation-instrumenter/java-allocation-instrumenter/3.2.0/ | |
// compile and run with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala.collection.immutable | |
import scala.collection.{IterableOnce, Iterator} | |
class LazyListLazinessTest { | |
import LazyListLazinessTest._ | |
def assertEquals(a: Int, b: Int): Unit = () | |
/* op laziness tests */ |
tl;dr.
- Don't inline from your dependencies when publishing a library, it breaks binary compatibility. Use
-opt-inline-from:my.package.**
to only inline from packages within your library. - When compiling with the inliner enabled, ensure that the run-time classpath is exactly the same as the compile-time classpath.
- Don't enable the optimizer for development: it breaks sbt's incremental compilation, and it makes the compiler slower. Only enable it for testing, on CI and to build releases.
- The
@inline
annotation only has an effect if the inliner is enabled. It tells the inliner to always try to inline the annotated method or callsite. - Without the
@inline
annotation, the inliner generally inlines higher-order methods and forwarder methods. The main goal is to eliminate megamorphic callsites due to functions passed as argument, and to eliminate value boxing. Other optimizations are delegated to the JVM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jabba use 1.8.191 | |
for sv in 2.13.0-pre-84de40d 2.13.0-pre-84de40d-noopt 2.13.0-pre-8d17277-SNAPSHOT; do | |
for vm in 1.8.191 1.8.172-graal-ce-rc7 1.8.172-graal-ee-rc7; do | |
echo "----- $sv ----- $vm -----" | |
sbt \ | |
'set resolvers in ThisBuild ++= List("scala-integration" at "https://scala-ci.typesafe.com/artifactory/scala-integration/", "scala-release-temp" at "https://scala-ci.typesafe.com/artifactory/scala-release-temp/", "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/")' \ | |
"set scalaVersion in ThisBuild := \"$sv\"" \ | |
clean \ | |
"hot -jvm $(jabba which $vm)/bin/java -psource=scalap -f 1 -wi 20 -w 10 -i 10 -r 10" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": true, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
Here's a javac crash with an incomplete compilation classpath.
$> rm *.class
$> java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object SerDes { | |
import java.io._ | |
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 = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.invoke.SerializedLambda | |
// lambda syntax for this type uses LambdaMetaFactory | |
trait SamT1 { | |
def foo(x: Int): Int | |
} | |
// lambda syntax for this type creates a class at compile-time | |
trait SamT2 { | |
def foo(x: Int): Int |