{"record":{"id":"0bbf600fca60c3fa","repo":"quarkusio/quarkus","slug":"a-receiver-method-must-not-be-private","errorCode":null,"errorMessage":"A receiver method must not be private: ","messagePattern":"A receiver method must not be private: ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java","lineNumber":149,"sourceCode":"                    if (!params.isEmpty()) {\n                        for (MethodParameterInfo param : params) {\n                            if (param.hasDeclaredAnnotation(DotNames.RECEIVES)) {\n                                if (signalParam != null) {\n                                    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                                }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/signals/deployment/src/main/java/io/quarkus/signals/deployment/SignalsProcessor.java#L131-L167","documentation":"The signals extension requires receiver methods (those with a @Receives parameter) to be non-private so the generated invoker can call them on the bean. During deployment, collectReceivers rejects a private @Receives method with this IllegalStateException, including the method description.","triggerScenarios":"Declaring private void handle(@Receives Signal signal) in a CDI bean; the build step walks the class hierarchy, sees the method has a signalParam and Modifier.isPrivate is true, and fails the build.","commonSituations":"Making a signal handler private for encapsulation (IDE default when extracting methods); moving an existing handler to private during refactoring; adding @Receives to an internal helper method.","solutions":["Remove 'private' and make the method package-private, protected, or public","Keep the private logic internal and have a non-private @Receives method delegate to it","Note the same rule bans static receiver methods - make it an instance method too"],"exampleFix":"// before\nprivate void onSignal(@Receives Signal signal) {...}\n// after\nvoid onSignal(@Receives Signal signal) {...}","handlingStrategy":"validation","validationCode":"// Audit receiver methods before build: must not be private or static\n// grep -rnA1 \"@Receives\" src/main/java | check 'private'/'static' on enclosing method","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make all @Receives methods package-private or public instance methods","Beware IDE 'extract method' defaults producing private handlers","Delegate from a non-private receiver to private helpers if encapsulation is needed","Avoid static receivers - the extension rejects them likewise"],"tags":["quarkus","build-time","signals","cdi"],"backgroundTag":"invalid-annotated-method-signature","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"}