Support Java numeric literals in @Params parameters

Vsevolod Tolstopyatov qwwdfsad at gmail.com
Mon Oct 26 08:50:55 UTC 2020


Hi,

During various work with JMH, I've noticed the recurring error pattern in
my benchmarks: I'm frequently using underscores in numeric literals in my
code, but as soon as I move them to @Params annotation, JMH pre-processor
reports an error during the build.

E.g. I can write
```
@Param({"100", "1000", "10000"})
int integerParam = 10_000
```

but not

```
@Param({"100", "1000", "10_000"})
int integerParam = 10_000
```

It feels inconsistent and also complicates eye-balling parameters,
especially when they are the power of 10.
It would be nice to support underscores (generally speaking, to support
integer literals in the same way javac does) and I am willing to contribute
it, but first I would like to ask whether such change is aligned with JMH
API shape and is a reasonable addition to JMH at all.

--
Best regards,
Tolstopyatov Vsevolod


More information about the jmh-dev mailing list