{"record":{"id":"0e210a47880ee95c","repo":"quarkusio/quarkus","slug":"a-constant-of-a-localized-enum-may-not-contain","errorCode":null,"errorMessage":"A constant of a localized enum may not contain '_$': {constant}","messagePattern":"A constant of a localized enum may not contain '_\\$': (.+?)","errorType":"exception","errorClass":"MessageBundleException","httpStatus":null,"severity":"error","filePath":"extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java","lineNumber":1217,"sourceCode":"                                }\n                            }\n                            // Render the template\n                            // At this point it's already validated that the method returns String\n                            bc.return_(bc.invokeInterface(\n                                    io.quarkus.qute.deployment.Descriptors.TEMPLATE_INSTANCE_RENDER, templateInstance));\n                        }\n                    });\n                });\n            }\n            implementResolve(defaultBundleImpl, cc, keyMap, resolveMethodPrefix, generatedClassName);\n        });\n        return generatedClassName;\n    }\n\n    private String enumConstantSeparator(Set<String> enumConstants) {\n        for (String constant : enumConstants) {\n            if (constant.contains(\"_$\")) {\n                throw new MessageBundleException(\"A constant of a localized enum may not contain '_$': \" + constant);\n            }\n            if (constant.contains(\"$\") || constant.contains(\"_\")) {\n                // If any of the constants contains \"_\" or \"$\" then \"_$\" is used\n                return \"_$\";\n            }\n        }\n        return \"_\";\n    }\n\n    private String toEnumConstantKey(String methodName, String separator, String enumConstant) {\n        return methodName + separator + enumConstant;\n    }\n\n    private void generateEnumConstantMessageMethod(ClassCreator bundleCreator, String bundleName, String locale,\n            ClassInfo bundleInterface, ClassInfo defaultBundleInterface, String enumConstantKey,\n            Map<String, MessageMethod> keyMap, String messageTemplate,\n            BuildProducer<MessageBundleMethodBuildItem> messageTemplateMethods) {\n        String templateId = null;","sourceCodeStart":1199,"sourceCodeEnd":1235,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java#L1199-L1235","documentation":"Qute uses '_$' as a special separator when deriving enum-constant message keys, so enum constants containing the literal sequence '_$' would produce ambiguous keys. enumConstantSeparator() throws MessageBundleException if any constant of a localized enum contains '_$'.","triggerScenarios":"Localizing an enum (via a message bundle method taking the enum) where at least one enum constant name contains the substring \"_$\" and another constant contains '_' or '$' (triggering '_$' as separator).","commonSituations":"Machine-generated or encoded enum constant names that embed '_$'; constants like FOO_$BAR colliding with the separator scheme.","solutions":["Rename the enum constant to remove the '_$' sequence","Do not localize that enum via the message bundle mechanism","Split the constant into a name without special characters plus separate data"],"exampleFix":"// before\nenum Codes { A_$1, A_B }\n// after\nenum Codes { A_1, A_B }\n","handlingStrategy":"validation","validationCode":"for (Field f : MyEnum.class.getEnumConstants()) {\n    if (((Enum<?>) f).name().contains(\"_$\"))\n        throw new IllegalStateException(\"Enum constant contains '_$': \" + ((Enum<?>) f).name());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Coding-standard check banning '_$' in enum constant names","Review generated/mapped enum names before localizing them"],"tags":["qute","message-bundle","enum-localization"],"backgroundTag":"missing-message-bundle-key","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"}