b117: Self-reference in initializer does no longer work
zhong.j.yu at gmail.com
Mon Dec 2 09:46:34 PST 2013
Basically a field cannot reference itself in the initializer, even if
the reference occurs inside a lambda expression.
However, you can bypass this kind of static analysis by using
`this.r`. If that doesn't work in some context (where javac equates
`this.r` and `r`) you can try `(this).r`.
On Mon, Dec 2, 2013 at 8:29 AM, Millies, Sebastian
<Sebastian.Millies at softwareag.com> wrote:
> I just upgraded from b114 to b114. Self-references in initializers do no longer work, e. g.
> Zhong Yu's variation on the fix point operator:
> static <A,B> Function<A,B> fix2(Function<Function<A,B>, Function<A,B>> f)
> return new Object()
> Function<A,B> r = a -> f.apply(r).apply(a);
> Why has this feature been dropped? Or is it a bug in b117?
> n Sebastian
> Software AG – Sitz/Registered office: Uhlandstraße 12, 64297 Darmstadt, Germany – Registergericht/Commercial register: Darmstadt HRB 1562 - Vorstand/Management Board: Karl-Heinz Streibich (Vorsitzender/Chairman), Dr. Wolfram Jost, Arnd Zinnhardt; - Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Dr. Andreas Bereczky - http://www.softwareag.com
More information about the lambda-dev