Annotation Type CompilerControl


  • @Target({METHOD,CONSTRUCTOR,TYPE})
    @Retention(RUNTIME)
    public @interface CompilerControl

    Compiler control annotation may be used to affect the compilation of particular methods in the benchmarks.

    JMH interfaces with the JVM by the means of CompilerCommand interface. These annotations only work with forking enabled. Non-forked runs will not be able to pass the hints to the compiler. Also, these control annotations might get freely ignored by the compiler, reduced to no-ops, or otherwise invalidated. Be cautious, and check the compiler logs and/or the generated code to see if the effect is there.

    This annotation may be put at a method to have effect on that method only, or at the enclosing class instance to have the effect over all methods in the class. Remarkably, this annotation works on any class/method, even those not marked by other JMH annotations.

    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      CompilerControl.Mode value
      The compilation mode.