Skip to content

Instantly share code, notes, and snippets.

@adriaanm
Created August 24, 2016 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriaanm/3bd376e0522ce4d9cd7bcf0d17d423a3 to your computer and use it in GitHub Desktop.
Save adriaanm/3bd376e0522ce4d9cd7bcf0d17d423a3 to your computer and use it in GitHub Desktop.
/*
* Decompiled with CFR 0_102.
*
* Could not load the following classes:
* scala.reflect.ScalaSignature
* scala.runtime.BoxedUnit
* scala.runtime.LazyRef
*/
import scala.reflect.ScalaSignature;
import scala.runtime.BoxedUnit;
import scala.runtime.LazyRef;
@ScalaSignature(bytes="\u0006\u0001q1A!\u0001\u0002\u0001\u000b\t\t1IC\u0001\u0004\u0003\u001daT-\u001c9usz\u001a\u0001a\u0005\u0002\u0001\rA\u0011qAC\u0007\u0002\u0011)\t\u0011\"A\u0003tG\u0006d\u0017-\u0003\u0002\f\u0011\t1\u0011I\\=SK\u001aDQ!\u0004\u0001\u0005\u00029\ta\u0001P5oSRtD#A\b\u0011\u0005A\u0001Q\"\u0001\u0002\t\u000bI\u0001A\u0011A\n\u0002\u00035,\u0012\u0001\u0006\t\u0003+ii\u0011A\u0006\u0006\u0003/a\tA\u0001\\1oO*\t\u0011$\u0001\u0003kCZ\f\u0017BA\u000e\u0017\u0005\u0019\u0019FO]5oO\u0002")
public class C {
public String m() {
LazyRef x$lzy = new LazyRef();
return C.x$1(x$lzy);
}
private static final /* synthetic */ String x$lzycompute$1(LazyRef x$lzy$1) {
String x$lzy = null;
LazyRef lazyRef = x$lzy$1;
synchronized (lazyRef) {
Object object;
if (x$lzy$1.initialized()) {
x$lzy = (String)x$lzy$1.value();
object = BoxedUnit.UNIT;
} else {
x$lzy = "1";
x$lzy$1.value_$eq((Object)x$lzy);
x$lzy$1.initialized_$eq(true);
object = x$lzy;
}
}
return x$lzy;
}
private static final String x$1(LazyRef x$lzy$1) {
return x$lzy$1.initialized() ? (String)x$lzy$1.value() : C.x$lzycompute$1(x$lzy$1);
}
}
> scalac /Users/adriaan/Library/Preferences/IdeaIC2016.2/scratches/scratch_16.scala -Xprint:all
[info] Running scala.tools.nsc.Main -usejavacp /Users/adriaan/Library/Preferences/IdeaIC2016.2/scratches/scratch_16.scala -Xprint:all
[[syntax trees at end of parser]] // scratch_16.scala
package <empty> {
class C extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
def m = {
lazy val x = "1";
x
}
}
}
[[syntax trees at end of namer]] // scratch_16.scala: tree is unchanged since parser
[[syntax trees at end of packageobjects]] // scratch_16.scala: tree is unchanged since parser
[[syntax trees at end of typer]] // scratch_16.scala
package <empty> {
class C extends scala.AnyRef {
def <init>(): C = {
C.super.<init>();
()
};
def m: String = {
<stable> <accessor> lazy val x: String = "1";
x
}
}
}
[[syntax trees at end of patmat]] // scratch_16.scala: tree is unchanged since typer
[[syntax trees at end of superaccessors]] // scratch_16.scala: tree is unchanged since typer
[[syntax trees at end of extmethods]] // scratch_16.scala: tree is unchanged since typer
[[syntax trees at end of pickler]] // scratch_16.scala: tree is unchanged since typer
[[syntax trees at end of refchecks]] // scratch_16.scala: tree is unchanged since typer
[[syntax trees at end of uncurry]] // scratch_16.scala
package <empty> {
class C extends Object {
def <init>(): C = {
C.super.<init>();
()
};
def m(): String = {
<stable> <accessor> lazy val x: String = "1";
x()
}
}
}
[[syntax trees at end of fields]] // scratch_16.scala
package <empty> {
class C extends Object {
def <init>(): C = {
C.super.<init>();
()
};
def m(): String = {
<artifact> val x$lzy: scala.runtime.LazyRef[String] = new scala.runtime.LazyRef[String]();
<artifact> private def x$lzycompute(): String = {
<artifact> var x$lzy: String = _;
x$lzy.synchronized[Any](if (x$lzy.initialized())
x$lzy = x$lzy.value()
else
{
x$lzy = "1";
x$lzy.value_=(x$lzy);
x$lzy.initialized_=(true);
x$lzy
});
x$lzy
};
def x(): String = if (x$lzy.initialized())
x$lzy.value()
else
x$lzycompute();
x()
}
}
}
[[syntax trees at end of tailcalls]] // scratch_16.scala: tree is unchanged since fields
[[syntax trees at end of specialize]] // scratch_16.scala: tree is unchanged since fields
[[syntax trees at end of explicitouter]] // scratch_16.scala: tree is unchanged since fields
[[syntax trees at end of erasure]] // scratch_16.scala
package <empty> {
class C extends Object {
def <init>(): C = {
C.super.<init>();
()
};
def m(): String = {
<artifact> val x$lzy: scala.runtime.LazyRef = new scala.runtime.LazyRef();
<artifact> private def x$lzycompute(): String = {
<artifact> var x$lzy: String = _;
x$lzy.synchronized(if (x$lzy.initialized())
{
x$lzy = x$lzy.value().$asInstanceOf[String]();
scala.runtime.BoxedUnit.UNIT
}
else
{
x$lzy = "1";
x$lzy.value_=(x$lzy);
x$lzy.initialized_=(true);
x$lzy
});
x$lzy
};
def x(): String = if (x$lzy.initialized())
x$lzy.value().$asInstanceOf[String]()
else
x$lzycompute();
x()
}
}
}
[[syntax trees at end of posterasure]] // scratch_16.scala: tree is unchanged since erasure
[[syntax trees at end of lambdalift]] // scratch_16.scala
package <empty> {
class C extends Object {
def <init>(): C = {
C.super.<init>();
()
};
def m(): String = {
<artifact> val x$lzy: scala.runtime.LazyRef = new scala.runtime.LazyRef();
C.this.x$1(x$lzy)
};
final <artifact> private[this] def x$lzycompute$1(x$lzy$1: scala.runtime.LazyRef): String = {
<artifact> var x$lzy: String = _;
x$lzy$1.synchronized(if (x$lzy$1.initialized())
{
x$lzy = x$lzy$1.value().$asInstanceOf[String]();
scala.runtime.BoxedUnit.UNIT
}
else
{
x$lzy = "1";
x$lzy$1.value_=(x$lzy);
x$lzy$1.initialized_=(true);
x$lzy
});
x$lzy
};
final private[this] def x$1(x$lzy$1: scala.runtime.LazyRef): String = if (x$lzy$1.initialized())
x$lzy$1.value().$asInstanceOf[String]()
else
C.this.x$lzycompute$1(x$lzy$1)
}
}
[[syntax trees at end of constructors]] // scratch_16.scala
package <empty> {
class C extends Object {
def m(): String = {
<artifact> val x$lzy: scala.runtime.LazyRef = new scala.runtime.LazyRef();
C.this.x$1(x$lzy)
};
final <artifact> private[this] def x$lzycompute$1(x$lzy$1: scala.runtime.LazyRef): String = {
<artifact> var x$lzy: String = _;
x$lzy$1.synchronized(if (x$lzy$1.initialized())
{
x$lzy = x$lzy$1.value().$asInstanceOf[String]();
scala.runtime.BoxedUnit.UNIT
}
else
{
x$lzy = "1";
x$lzy$1.value_=(x$lzy);
x$lzy$1.initialized_=(true);
x$lzy
});
x$lzy
};
final private[this] def x$1(x$lzy$1: scala.runtime.LazyRef): String = if (x$lzy$1.initialized())
x$lzy$1.value().$asInstanceOf[String]()
else
C.this.x$lzycompute$1(x$lzy$1);
def <init>(): C = {
C.super.<init>();
()
}
}
}
[[syntax trees at end of flatten]] // scratch_16.scala: tree is unchanged since constructors
[[syntax trees at end of mixin]] // scratch_16.scala: tree is unchanged since constructors
[[syntax trees at end of cleanup]] // scratch_16.scala: tree is unchanged since constructors
[[syntax trees at end of delambdafy]] // scratch_16.scala
package <empty> {
class C extends Object {
def m(): String = {
<artifact> val x$lzy: scala.runtime.LazyRef = new scala.runtime.LazyRef();
C.this.x$1(x$lzy)
};
final <static> <artifact> private[this] def x$lzycompute$1(x$lzy$1: scala.runtime.LazyRef): String = {
<artifact> var x$lzy: String = _;
x$lzy$1.synchronized(if (x$lzy$1.initialized())
{
x$lzy = x$lzy$1.value().$asInstanceOf[String]();
scala.runtime.BoxedUnit.UNIT
}
else
{
x$lzy = "1";
x$lzy$1.value_=(x$lzy);
x$lzy$1.initialized_=(true);
x$lzy
});
x$lzy
};
final <static> private[this] def x$1(x$lzy$1: scala.runtime.LazyRef): String = if (x$lzy$1.initialized())
x$lzy$1.value().$asInstanceOf[String]()
else
C.this.x$lzycompute$1(x$lzy$1);
def <init>(): C = {
C.super.<init>();
()
}
}
}
[[syntax trees at end of jvm]] // scratch_16.scala: tree is unchanged since delambdafy
[success] Total time: 6 s, completed Aug 24, 2016 8:40:10 AM
>
class C { def m = { lazy val x = "1" ; x } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment