changeset 1093:67f78641923f

7901265: JMH generators produce duplicate @State handling blocks
author shade
date Tue, 20 Jan 2015 13:25:42 +0300
parents 465d7aca5a00
children d40ed4e0fb5d
files jmh-core/src/main/java/org/openjdk/jmh/generators/core/StateObjectHandler.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/StateObjectHandler.java	Mon Jan 19 16:13:06 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/StateObjectHandler.java	Tue Jan 20 13:25:42 2015 +0300
@@ -414,14 +414,20 @@
         List<StateObject> statesForward = new ArrayList<StateObject>();
         for (StateObject so : stateOrder(method, true)) {
             for (HelperMethodInvocation hmi : so.getHelpers()) {
-                if (hmi.helperLevel == helperLevel) statesForward.add(so);
+                if (hmi.helperLevel == helperLevel) {
+                    statesForward.add(so);
+                    break;
+                }
             }
         }
 
         List<StateObject> statesReverse = new ArrayList<StateObject>();
         for (StateObject so : stateOrder(method, false)) {
             for (HelperMethodInvocation hmi : so.getHelpers()) {
-                if (hmi.helperLevel == helperLevel) statesReverse.add(so);
+                if (hmi.helperLevel == helperLevel) {
+                    statesReverse.add(so);
+                    break;
+                }
             }
         }