@Param support for enum

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Jun 23 18:32:45 UTC 2014


On 06/14/2014 11:27 PM, Martin Grajcar wrote:
> On Sat, Jun 14, 2014 at 8:38 PM, Aleksey Shipilev
> <aleksey.shipilev at oracle.com <mailto:aleksey.shipilev at oracle.com>> wrote:
> 
>     (on vacation, asking briefly)
> 
>     In JMH 0.9+, @Param(<enum>) already has the value set with all enum
>     constants. Are you saying you want parameter-less @Param(<boolean>)
>     to implicitly have ("false", "true") value set?
> 
> 
> Thanks, I wasn't sure about the current state. And yes, @Param for
> booleans working out of the box would be nice, too.

On a second thought, this seems to introduce yet another special case in
our @Param rules. The exception for enums is largely caused by the
problem for converting the enum value set into String[]. Is the same
problem present for booleans? E.g. does it really bother people to write
this:

 @Param({"true", "false"})
 public boolean paramVal;

...instead of this?

 @Param
 public boolean paramVal;

Note that the constant order is something we are after: it strictly
defines the order in which the parameter values are explored, which may
be useful for some users.

Thanks,
-Aleksey.


More information about the jmh-dev mailing list