changeset 184:07d522190f84

Accept @OperationsPerInvocation as the class-level annotation.
author shade
date Thu, 26 Sep 2013 12:19:37 +0400
parents 6d995aa6d6de
children 32a5a7addff6
files jmh-core/src/main/java/org/openjdk/jmh/annotations/OperationsPerInvocation.java jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/annotations/OperationsPerInvocation.java	Mon Sep 23 22:45:52 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/annotations/OperationsPerInvocation.java	Thu Sep 26 12:19:37 2013 +0400
@@ -44,7 +44,7 @@
  * </pre></blockquote></p>
  */
 
-@Target(ElementType.METHOD)
+@Target({ElementType.METHOD,ElementType.TYPE})
 @Retention(RetentionPolicy.SOURCE)
 @Inherited
 public @interface OperationsPerInvocation {
--- a/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java	Mon Sep 23 22:45:52 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/processor/internal/GenerateMicroBenchmarkProcessor.java	Thu Sep 26 12:19:37 2013 +0400
@@ -507,6 +507,8 @@
             if (operationsPerInvocation != null && operationsPerInvocation.value() > 1) {
                 ann = guardedSet(ann, operationsPerInvocation);
             }
+
+            ann = guardedSet(ann, method.getEnclosingElement().getAnnotation(OperationsPerInvocation.class));
         }
         return (ann != null) ? ann.value() : 1;
     }