{"record":{"id":"cd9e0cd33338e249","repo":"quarkusio/quarkus","slug":"a-receiver-method-must-not-be-static","errorCode":null,"errorMessage":"A receiver method must not be static: ","messagePattern":"A receiver method must not be static: ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java","lineNumber":153,"sourceCode":"                                    throw new IllegalStateException(\n                                            \"A receiver method must have exactly one parameter annotated with @Receives: \"\n                                                    + methodDesc(method));\n                                }\n                                signalParam = param;\n                            }\n                        }\n                    }\n                    if (!seenMethods.add(method.signatureKey())) {\n                        // Overridden by a subclass\n                        continue;\n                    }\n                    if (signalParam != null) {\n                        if (Modifier.isPrivate(method.flags())) {\n                            throw new IllegalStateException(\n                                    \"A receiver method must not be private: \" + methodDesc(method));\n                        }\n                        if (Modifier.isStatic(method.flags())) {\n                            throw new IllegalStateException(\n                                    \"A receiver method must not be static: \" + methodDesc(method));\n                        }\n                        ExecutionModel executionModel = getExecutionModel(method);\n                        if (!receiverExecutorImplementation.isSupported(executionModel)) {\n                            throw new IllegalStateException(\n                                    \"%s execution model is not supported: %s\".formatted(executionModel, methodDesc(method)));\n                        }\n                        InvokerBuilder invokerBuilder = invokerFactory.createInvoker(bean, method)\n                                .withInstanceLookup();\n                        if (params.size() > 1) {\n                            for (MethodParameterInfo param : params) {\n                                if (param != signalParam) {\n                                    invokerBuilder.withArgumentLookup(param.position());\n                                }\n                            }\n                        }\n                        List<AnnotationInstance> qualifiers = new ArrayList<>();\n                        for (AnnotationInstance a : signalParam.declaredAnnotations()) {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java#L135-L171","documentation":"The Quarkus signals extension builds invokers for receiver methods (methods annotated to receive signals). A receiver method must be an instance method because the bean instance is used as the receiver target; a static method has no instance to invoke against. During discovery of receivers, a static method is rejected with this IllegalStateException.","triggerScenarios":"Declaring a signal receiver method as `static` (e.g. `static void onSignal(...)` with a signal parameter) in a bean discovered by the signals processor.","commonSituations":"Developers copying a listener style from plain-Java signal handling where static handlers are common, or making a helper method static after refactoring.","solutions":["Remove the `static` modifier from the receiver method.","Ensure the method is on a CDI bean instance so the generated invoker can call it on the bean.","If the method was never intended to receive signals, remove the signal annotation/parameter so it is not discovered as a receiver."],"exampleFix":"// before\n@SignalReceiver\nstatic void onSig(SignalEvent evt) { ... }\n\n// after\n@SignalReceiver\nvoid onSig(SignalEvent evt) { ... }","handlingStrategy":"validation","validationCode":"if (java.lang.reflect.Modifier.isStatic(ReceiverClass.class.getDeclaredMethod(\"onSig\", SignalEvent.class).getModifiers())) { throw new IllegalStateException(\"receiver method must not be static\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never mark signal receiver methods static.","Keep receiver methods on managed CDI bean classes.","Review refactors that add `static` to instance handler methods."],"tags":["quarkus","cdi","build-time","signals"],"backgroundTag":"static-receiver-method-not-allowed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}