{"record":{"id":"61a21dc83f05eff5","repo":"flowable/flowable-engine","slug":"function-delegate-has-more-than-one-function-metho","errorCode":null,"errorMessage":"Function Delegate has more than one function method","messagePattern":"Function Delegate has more than one function method","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common-api/src/main/java/org/flowable/common/engine/api/delegate/FlowableMultiFunctionDelegate.java","lineNumber":33,"sourceCode":"import java.lang.reflect.Method;\nimport java.util.Collection;\n\n/**\n * @author Filip Hrisafov\n */\npublic interface FlowableMultiFunctionDelegate extends FlowableFunctionDelegate {\n\n    @Override\n    default String localName() {\n        throw new UnsupportedOperationException(\"Function has more than one local name\");\n    }\n\n    @Override\n    Collection<String> localNames();\n\n    @Override\n    default Method functionMethod() {\n        throw new UnsupportedOperationException(\"Function Delegate has more than one function method\");\n    }\n\n    @Override\n    Method functionMethod(String prefix, String localName) throws  NoSuchMethodException;\n}\n","sourceCodeStart":15,"sourceCodeEnd":39,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common-api/src/main/java/org/flowable/common/engine/api/delegate/FlowableMultiFunctionDelegate.java#L15-L39","documentation":"FlowableMultiFunctionDelegate.functionMethod() is a default interface method that deliberately throws UnsupportedOperationException(\"Function Delegate has more than one function method\") because a multi-function delegate exposes multiple function methods selected by prefix and local name. Callers must use functionMethod(String prefix, String localName) instead.","triggerScenarios":"Calling functionMethod() on a FlowableMultiFunctionDelegate, or generic function-resolution code that invokes the no-arg functionMethod() without checking for multi-function delegates.","commonSituations":"Function-registry code written for single-method FlowableFunctionDelegate being reused with FlowableFunction implementations that register several related functions under one delegate.","solutions":["Resolve via functionMethod(prefix, localName) with the actual parsed function name instead of the no-arg overload","Check instanceof FlowableMultiFunctionDelegate before calling functionMethod()","If only one method is intended, implement plain FlowableFunctionDelegate"],"exampleFix":"// before\nMethod m = delegate.functionMethod();\n// after\nMethod m = delegate instanceof FlowableMultiFunctionDelegate\n        ? ((FlowableMultiFunctionDelegate) delegate).functionMethod(prefix, localName)\n        : delegate.functionMethod();","handlingStrategy":"type-guard","validationCode":"// resolve the method via the multi-function API when applicable\nMethod m = delegate instanceof FlowableMultiFunctionDelegate\n        ? ((FlowableMultiFunctionDelegate) delegate).functionMethod(prefix, localName)\n        : delegate.functionMethod();","typeGuard":"static boolean isMultiFunction(FlowableFunctionDelegate d) {\n    return d instanceof FlowableMultiFunctionDelegate;\n}","tryCatchPattern":"try {\n    Method m = delegate.functionMethod();\n} catch (UnsupportedOperationException e) {\n    Method m2 = ((FlowableMultiFunctionDelegate) delegate).functionMethod(prefix, localName);\n}","preventionTips":["Always resolve multi-function delegates with functionMethod(prefix, localName)","Branch on instanceof FlowableMultiFunctionDelegate in shared resolution code","Keep prefix/localName parsing in one utility to avoid inconsistent calls","Cover both delegate types in unit tests"],"tags":["java","unsupported-operation","api-misuse"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}