How can I make a constructor's argument be available from instance initialisers?
<pre><code>class Foo {
    final String s;

    final int x = s.length();

    Foo(String s) {
        this.s = s;
    }
}
</code></pre>

<p>The above code will not compile, because the assignment to x happens before the assignment to s.  I could place the assignment to x inside the constructor, but for readability in a real case with 100 fields, I'd rather not.</p>

<p>I have come up with a workaround, which I dislike.  Can you find a better one?</p>

<pre><code>abstract class Hack {
    final String s;

    Hack(String s) {
        this.s = s;
    }
}

class Foo extends Hack {
    final int x = s.length();

    Foo(String s) {
        super(s);
    }
}
</code></pre>
