Support inner @State classes

Aleksey Shipilev shade at redhat.com
Thu Dec 8 14:00:00 UTC 2016


Hi,

On 12/07/2016 04:12 AM, Roman Leventov wrote:
> If a @State class is an inner class of another @State class, it could mean
> the same dependency as if the first @State class is static and has the
> second class as a parameter of it's @Setup method.
> 
> It would be nice to have this feature because it would allow to reduce
> verbosity of dependent @State classes.

Can you give a motivating example?

I thought we only support nested classes, not inners. Mostly because there are
non-trivial lifecycle dependencies between them, e.g.:

@State
static class BS {

  @State
  class TS1 {
    // Thread initializes this, but needs BS instance to call new...
  }
}

...which, I think are resolvable, but need to see the motivating example.

Thanks,
-Aleksey



More information about the jmh-dev mailing list