File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
src/main/java/io/iworkflow/core Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 1+ package io .iworkflow .core ;
2+
3+ // This indicates issues in the implementation of the workflow
4+ public class ImplementationException extends RuntimeException {
5+ public ImplementationException (Throwable cause ) {
6+ super (cause );
7+ }
8+
9+ public ImplementationException (String message ) {
10+ super (message );
11+ }
12+ }
Original file line number Diff line number Diff line change 11package io .iworkflow .core ;
22
3- import com .google .common .collect .ImmutableMap ;
43import io .iworkflow .core .communication .Communication ;
54import io .iworkflow .core .persistence .Persistence ;
65
76import java .io .Serializable ;
87import java .lang .reflect .Method ;
9- import java .util . Map ;
8+ import java .lang . reflect . Modifier ;
109
1110public final class RpcDefinitions {
1211 private RpcDefinitions () {
@@ -100,12 +99,20 @@ public interface RpcProc0NoPersistence extends Serializable {
10099 void execute (Context context , Communication communication );
101100 }
102101
103- public static final String ERROR_MESSAGE = "An RPC method must be in the form of one of {@link RpcDefinitions}" ;
102+ public static final String DEFINITION_ERROR_MESSAGE = "An RPC method must be in the form of one of {@link RpcDefinitions}" ;
103+
104+ public static final String FINAL_MODIFIER_ERROR_MESSAGE = "An RPC method must not be final" ;
104105
105106 public static void validateRpcMethod (final Method method ) {
106107 RpcMethodMetadata methodMetadata = RpcMethodMatcher .match (method );
108+ final boolean isFinal = Modifier .isFinal (method .getModifiers ());
109+
110+ if (isFinal ) {
111+ throw new ImplementationException (FINAL_MODIFIER_ERROR_MESSAGE );
112+ }
113+
107114 if (methodMetadata == null ) {
108- throw new WorkflowDefinitionException (ERROR_MESSAGE );
115+ throw new WorkflowDefinitionException (DEFINITION_ERROR_MESSAGE );
109116 }
110117 }
111118}
You can’t perform that action at this time.
0 commit comments