Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901009

JMH confuses the @Benchmark in super-class and sub-class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • tools
    • None
    • jmh

      http://mail.openjdk.java.net/pipermail/jmh-dev/2014-August/001329.html

      Providing a base class with:

      class SuperClass {
          @Benchmark
          public void myBenchmark() { ... }
      }

      ...and the subclass with the same:

      class SubClass extends SuperClass {
          @Benchmark
          public void myBenchmark() { ... }
      }

      Yields the cryptic message:
          Internal error: multiple methods per @Group, but not all methods have @Group

      (or, in recent JMH versions, "Duplicate @Benchmark method. JMH needs an uniquely named method, regardless of the arguments list.")

      This is because the @Benchmark lookup code treats both methods are distinct methods, and tries to put them in the same group.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: