New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$delayedInit$body.$outer is missing synthetic flag #9858
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9858?orig=1 |
Ausmarton Fernandes (ausmarton-at-gmail.com) said: However, the syntax tree for the example provided seems to generate a package <empty> {
class Outer extends Object with DelayedInit {
private[this] val code: scala.collection.mutable.ListBuffer = _;
<stable> <accessor> private def code(): scala.collection.mutable.ListBuffer = Outer.this.code;
override def delayedInit(body: Function0): Unit = {
Outer.this.code().+=(body);
()
};
final <synthetic> def delayedEndpoint$Outer$1: Unit = {
Outer.this.code = new scala.collection.mutable.ListBuffer();
()
};
def <init>(): Outer = {
Outer.super.<init>();
Outer.this.delayedInit(new Outer$delayedInit$body(Outer.this));
()
}
};
final <synthetic> class Outer$delayedInit$body extends runtime.AbstractFunction0 {
<paramaccessor> private[this] val $outer: Outer = _;
final def apply(): Object = {
Outer$delayedInit$body.this.$outer.delayedEndpoint$Outer$1();
scala.runtime.BoxedUnit.UNIT
};
def <init>($outer: Outer): Outer$delayedInit$body = {
if ($outer.eq(null))
throw null
else
Outer$delayedInit$body.this.$outer = $outer;
Outer$delayedInit$body.super.<init>();
()
}
}
} |
@SethTisue said: |
Ausmarton Fernandes (ausmarton-at-gmail.com) said: Also, I tried adding a package <empty> {
class Outer extends Object with DelayedInit {
private[this] val code: scala.collection.mutable.ListBuffer = _;
<stable> <accessor> private def code(): scala.collection.mutable.ListBuffer = Outer.this.code;
override def delayedInit(body: Function0): Unit = {
Outer.this.code().+=(body);
()
};
final <synthetic> def delayedEndpoint$Outer$1: Unit = {
Outer.this.code = new scala.collection.mutable.ListBuffer();
()
};
def <init>(): Outer = {
Outer.super.<init>();
Outer.this.delayedInit(new Outer$delayedInit$body(Outer.this));
()
}
};
final <synthetic> class Outer$delayedInit$body extends runtime.AbstractFunction0 {
<synthetic> <paramaccessor> private[this] val $outer: Outer = _;
final def apply(): Object = {
Outer$delayedInit$body.this.$outer.delayedEndpoint$Outer$1();
scala.runtime.BoxedUnit.UNIT
};
def <init>($outer: Outer): Outer$delayedInit$body = {
if ($outer.eq(null))
throw null
else
Outer$delayedInit$body.this.$outer = $outer;
Outer$delayedInit$body.super.<init>();
()
}
}
} However, I'm not sure having a |
When extending DelayedInit trait the field referencing to an outer class "$outer" in the generated "$delayedInit$body" is not marked as synthetic. At the same time for any normal usage of inner classes generated "$outer" field is marked as synthetic.
See: https://gist.github.com/pbadenski/982dc47e8636a0f706c7bf46d610574f
The text was updated successfully, but these errors were encountered: