{"record":{"id":"f0df0936f98c91e0","repo":"quarkusio/quarkus","slug":"global-variable-method-declared-on-method-decl-f0df09","errorCode":null,"errorMessage":"Global variable method declared on \" + method.declaringClass().name() + \" must not accept any parameter: \" + method","messagePattern":"Global variable method declared on \" \\+ method\\.declaringClass\\(\\)\\.name\\(\\) \\+ \" must not accept any parameter: \" \\+ method","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java","lineNumber":172,"sourceCode":"        return generatedClassName;\n    }\n\n    public Set<String> getGeneratedTypes() {\n        return generatedTypes;\n    }\n\n    public static void validate(MethodInfo method) {\n        if (!Modifier.isStatic(method.flags())) {\n            throw new IllegalStateException(\n                    \"Global variable method declared on \" + method.declaringClass().name() + \" must be static: \"\n                            + method);\n        }\n        if (method.returnType().kind() == Kind.VOID) {\n            throw new IllegalStateException(\"Global variable method declared on \" + method.declaringClass().name()\n                    + \" must not return void: \" + method);\n        }\n        if (!method.parameterTypes().isEmpty()) {\n            throw new IllegalStateException(\"Global variable method declared on \" + method.declaringClass().name()\n                    + \" must not accept any parameter: \" + method);\n        }\n        if (Modifier.isPrivate(method.flags())) {\n            throw new IllegalStateException(\"Global variable method declared on \" + method.declaringClass().name()\n                    + \" must not be private: \" + method);\n        }\n    }\n\n    public static void validate(FieldInfo field) {\n        if (!Modifier.isStatic(field.flags())) {\n            throw new IllegalStateException(\n                    \"Global variable field declared on \" + field.declaringClass().name() + \"  must be static: \" + field);\n        }\n        if (Modifier.isPrivate(field.flags())) {\n            throw new IllegalStateException(\"Global variable field declared on \" + field.declaringClass().name()\n                    + \" must not be private: \" + field);\n        }\n    }","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java#L154-L190","documentation":"IllegalStateException from TemplateGlobalGenerator.validate(MethodInfo): the @TemplateGlobal method declares parameters. Global variable accessors are invoked with no arguments, so any parameter list is rejected; the method signature appears in the message.","triggerScenarios":"Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove all parameters from the @TemplateGlobal method","If parameters are needed, use a value resolver or an EvalContext-based approach instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}