changeset 351:d561a2727cb1

Runners: Allow methods in tests; used to be broken by validation mechanics.
author shade
date Fri, 20 Jan 2017 22:07:08 +0100
parents 878eae7a1f23
children 87229545b408
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java	Fri Jan 20 14:22:55 2017 +0100
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/processors/JCStressTestProcessor.java	Fri Jan 20 22:07:08 2017 +0100
@@ -163,18 +163,22 @@
                 info.setSignal(method);
             }
 
-            for (VariableElement var : method.getParameters()) {
-                TypeElement paramClass = (TypeElement) processingEnv.getTypeUtils().asElement(var.asType());
-                if (paramClass.getAnnotation(State.class) != null) {
-                    info.setState(paramClass);
-                } else if (paramClass.getAnnotation(Result.class) != null) {
-                    info.setResult(paramClass);
-                } else {
-                    if (e.getAnnotation(JCStressTest.class).value() != Mode.Termination ||
-                            !paramClass.getQualifiedName().toString().equals("java.lang.Thread")) {
-                        throw new GenerationException("The parameter for @" + Actor.class.getSimpleName() +
-                                " methods requires either @" + State.class.getSimpleName() + " or @" + Result.class.getSimpleName() +
-                                " annotated class", var);
+            if (method.getAnnotation(Actor.class) != null ||
+                    method.getAnnotation(Arbiter.class) != null ||
+                    method.getAnnotation(Signal.class) != null) {
+                for (VariableElement var : method.getParameters()) {
+                    TypeElement paramClass = (TypeElement) processingEnv.getTypeUtils().asElement(var.asType());
+                    if (paramClass.getAnnotation(State.class) != null) {
+                        info.setState(paramClass);
+                    } else if (paramClass.getAnnotation(Result.class) != null) {
+                        info.setResult(paramClass);
+                    } else {
+                        if (e.getAnnotation(JCStressTest.class).value() != Mode.Termination ||
+                                !paramClass.getQualifiedName().toString().equals("java.lang.Thread")) {
+                            throw new GenerationException("The parameter for @" + Actor.class.getSimpleName() +
+                                    " methods requires either @" + State.class.getSimpleName() + " or @" + Result.class.getSimpleName() +
+                                    " annotated class", var);
+                        }
                     }
                 }
             }