[PATCH]: override a parameter value, constrained to a specific class

Alex Averbuch alex.averbuch at neo4j.com
Wed Feb 7 12:25:40 UTC 2018


An alternative to the provided patch is to 'name' to @param, which defaults
to the class member name but can be overridden to, for example, the class
member name prefixed by the fully qualified name of its containing class.

E.g.,

@Inherited
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Param {

    String BLANK_ARGS = "blank_blank_blank_2014";

    /** @return field name */
    String name() default BLANK_ARGS;

    /**
     * Default values sequence for the parameter. By default, the parameter
     * values will be traversed during the run in the given order.
     *
     * @return values sequence to follow.
     */
    String[] value() default { BLANK_ARGS };
}


On Wed, Feb 7, 2018 at 11:13 AM, Alex Averbuch <alex.averbuch at neo4j.com>
wrote:

> Hi,
> I'd like to submit a patch to JMH, is the mailing list a valid place to
> that?
> The change makes it possible to override a parameter value, but that
> override only affects the value of a @param in a specific benchmark class
> -- i.e., one level is added to the @param namespace.
> This is useful when you have the combination of:
>
>    - JMH project with many benchmark classes
>    - Multiple benchmark classes have @param fields with the same name
>    - @param values are set via the Java builder (or CLI interface)
>
> Feedback welcome!
> Cheers,
> Alex
>


More information about the jmh-dev mailing list