{"record":{"id":"8320ab9245ea0ad9","repo":"projectlombok/lombok","slug":"invalid-type-name","errorCode":null,"errorMessage":"Invalid type name ","messagePattern":"Invalid type name ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/core/lombok/core/configuration/TypeName.java","lineNumber":38,"sourceCode":" * THE SOFTWARE.\n */\npackage lombok.core.configuration;\n\nimport lombok.core.JavaIdentifiers;\n\npublic final class TypeName implements ConfigurationValueType {\n\tprivate final String name;\n\t\n\tprivate TypeName(String name) {\n\t\tthis.name = name;\n\t}\n\t\n\tpublic static TypeName valueOf(String name) {\n\t\tif (name == null || name.trim().isEmpty()) return null;\n\t\t\n\t\tString trimmedName = name.trim();\n\t\tfor (String identifier : trimmedName.split(\"\\\\.\")) {\n\t\t\tif (!JavaIdentifiers.isValidJavaIdentifier(identifier)) throw new IllegalArgumentException(\"Invalid type name \" + trimmedName + \" (part \" + identifier + \")\");\n\t\t}\n\t\treturn new TypeName(trimmedName);\n\t}\n\t\n\tpublic static String description() {\n\t\treturn \"type-name\";\n\t}\n\t\n\tpublic static String exampleValue() {\n\t\treturn \"<fully.qualified.Type>\";\n\t}\n\t\n\t@Override public boolean equals(Object obj) {\n\t\tif (!(obj instanceof TypeName)) return false;\n\t\treturn name.equals(((TypeName) obj).name);\n\t}\n\t\n\t@Override public int hashCode() {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/core/lombok/core/configuration/TypeName.java#L20-L56","documentation":"TypeName.valueOf parses a dotted type name used as a lombok configuration value. It returns null for null/blank input and throws IllegalArgumentException when any dot-separated segment fails JavaIdentifiers.isValidJavaIdentifier. This ensures only syntactically valid type names are stored as configuration values.","triggerScenarios":"Calling TypeName.valueOf with a string where at least one segment between dots is not a valid Java identifier: empty segments (leading/trailing/double dots), segments starting with a digit (e.g. \"3rdParty.Type\"), or segments containing hyphens, spaces or other symbols.","commonSituations":"A lombok.config value like 'import: lombok/Getter', a typo'd class name such as 'com.example..Foo', or version-qualified names with hyphens passed where a Java type name is expected.","solutions":["Fix the type name so every dot-separated part is a valid Java identifier (letters, digits, $, _, not starting with a digit)","Remove empty segments caused by leading, trailing, or consecutive dots","Pre-validate segments with a regex such as ^[A-Za-z_$][A-Za-z0-9_$]*$ for each part"],"exampleFix":"// before\nTypeName.valueOf(\"com.example.-.Foo\")\n// after\nTypeName.valueOf(\"com.example.core.Foo\")","handlingStrategy":"validation","validationCode":"boolean isValidTypeName(String s) {\n    if (s == null || s.trim().isEmpty()) return true;\n    for (String p : s.trim().split(\"\\\\.\"))\n        if (!p.matches(\"[A-Za-z_$][A-Za-z0-9_$]*\")) return false;\n    return true;\n}","typeGuard":null,"tryCatchPattern":"try { TypeName t = TypeName.valueOf(cfg); ... } catch (IllegalArgumentException e) { log.configError(\"Invalid type name in config\", e); }","preventionTips":["Validate config strings segment-by-segment before storing","Watch for empty segments from double dots or trailing dots","Never embed version qualifiers or hyphens in Java type names"],"tags":["lombok","configuration","identifier-validation"],"backgroundTag":"invalid-identifier-format","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"}