{"record":{"id":"c2361bfd1468d6cb","repo":"projectlombok/lombok","slug":"i-can-t-make-sense-of-this-annotation-value-try-u","errorCode":null,"errorMessage":"I can't make sense of this annotation value. Try using a fully qualified literal.","messagePattern":"I can't make sense of this annotation value\\. Try using a fully qualified literal\\.","errorType":"exception","errorClass":"AnnotationValueDecodeFail","httpStatus":null,"severity":"error","filePath":"src/core/lombok/core/AnnotationValues.java","lineNumber":181,"sourceCode":"\t\n\tpublic List<String> getAsStringList(String methodName) {\n\t\tAnnotationValue v = values.get(methodName);\n\t\t\n\t\tif (v == null) {\n\t\t\tString[] s = getDefaultIf(methodName, new String[0]);\n\t\t\treturn Collections.unmodifiableList(Arrays.asList(s));\n\t\t}\n\t\t\n\t\tList<String> out = new ArrayList<String>(v.valueGuesses.size());\n\t\tint idx = 0;\n\t\tfor (Object guess : v.valueGuesses) {\n\t\t\tObject result = guess == null ? null : guessToType(guess, String.class, v, idx);\n\t\t\tif (result == null) {\n\t\t\t\tif (v.valueGuesses.size() == 1) {\n\t\t\t\t\tString[] s = getDefaultIf(methodName, new String[0]);\n\t\t\t\t\treturn Collections.unmodifiableList(Arrays.asList(s));\n\t\t\t\t} \n\t\t\t\tthrow new AnnotationValueDecodeFail(v, \n\t\t\t\t\t\"I can't make sense of this annotation value. Try using a fully qualified literal.\", idx);\n\t\t\t}\n\t\t\tout.add((String) result);\n\t\t\tidx++;\n\t\t}\n\t\t\n\t\treturn Collections.unmodifiableList(out);\n\t}\n\t\n\tpublic String getAsString(String methodName) {\n\t\tAnnotationValue v = values.get(methodName);\n\t\tif (v == null || v.valueGuesses.size() != 1) {\n\t\t\treturn getDefaultIf(methodName, \"\");\n\t\t}\n\t\t\n\t\tObject guess = guessToType(v.valueGuesses.get(0), String.class, v, 0);\n\t\tif (guess instanceof String) return (String) guess;\n\t\treturn getDefaultIf(methodName, \"\");","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/core/lombok/core/AnnotationValues.java#L163-L199","documentation":"AnnotationValues.getAsStringList() decodes annotation string-array members from the compiler's parse tree. When a value guess cannot be resolved to a String by guessToType() and there are multiple guesses (so no single-value default fallback applies), lombok throws AnnotationValueDecodeFail asking the user to write a fully qualified literal. This is lombok's way of rejecting annotation values it cannot statically interpret.","triggerScenarios":"A lombok annotation method expecting a String list receives an element that guessToType() cannot coerce to String (e.g. a FieldSelect referencing a field or an unresolvable select), and valueGuesses.size() > 1 so the getDefaultIf fallback path is skipped.","commonSituations":"Writing an annotation like @Getter(onMethod_=...) or a config annotation whose string array elements use non-literal references (e.g. SomeClass.CONSTANT) or typos in class references that fail qualification; also occurs after IDE refactors rename constants referenced from annotations.","solutions":["Replace the annotation value element with a plain string literal or fully qualified literal (e.g. fully spell out package.Class instead of an import-dependent select).","Remove references to static fields/constants from the annotation value; Java annotations require compile-time constant literals.","If a default exists for the method, use the single-value form so lombok can fall back to the default instead of throwing.","Check for typos in the class/field name so guessToType can resolve it.","Rebuild cleanly; stale incremental compilation state can leave guesses unresolved."],"exampleFix":"// before\n@Getter(value = {MyConstants.FOO, MyConstants.BAR})\n// after\n@Getter(value = {\"foo\", \"bar\"})","handlingStrategy":"validation","validationCode":"function isPlainStringList(vals) { return Array.isArray(vals) && vals.every(v => typeof v === 'string' && !/[A-Za-z_$][\\w$]*\\s*\\.[\\w$]+/.test(v)); }\nif (!isPlainStringList(myAnnotationValues)) throw new Error('Use plain string literals in the annotation');","typeGuard":"function isStringLiteral(v) { return typeof v === 'string'; }","tryCatchPattern":"try { List<String> l = annotationValues.getAsStringList(\"value\"); } catch (AnnotationValueDecodeFail e) { log.error(\"Bad annotation value at index \" + e.idx + \": use a fully qualified literal\"); }","preventionTips":["Use plain string literals, not static-field references, in lombok annotation values.","Fully qualify class names in annotation string arrays.","Rebuild after renaming constants referenced anywhere near annotations.","Keep annotation usage minimal and literal-first."],"tags":["annotations","lombok","compile-time","string-parsing"],"backgroundTag":"invalid-argument-value","analyzedSha":"6d6a3e9fec0a9555702561fbeb8eac836575116e","analyzedAt":"2026-09-07T23:18:01.841Z","contentChangedAt":"2026-09-07T23:18:01.841Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}