{"record":{"id":"b98ff419bb353a87","repo":"projectlombok/lombok","slug":"element-message","errorCode":null,"errorMessage":"${element} ${message}","messagePattern":"\\$\\{element\\} \\$\\{message\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/spiProcessor/lombok/spi/SpiProcessor.java","lineNumber":247,"sourceCode":"\t}\n\t\n\tprivate Name getQualifiedTypeName(AnnotationMirror mirror) {\n\t\tElement elem = mirror.getAnnotationType().asElement();\n\t\tif (!(elem instanceof TypeElement)) return null;\n\t\treturn ((TypeElement) elem).getQualifiedName();\n\t}\n\t\n\tprivate TypeElement toElement(TypeMirror typeMirror) {\n\t\tif (typeMirror instanceof DeclaredType) {\n\t\t\tElement asElement = ((DeclaredType) typeMirror).asElement();\n\t\t\tif (asElement instanceof TypeElement) return (TypeElement) asElement;\n\t\t}\n\t\treturn null;\n\t}\n\t\n\tprivate void report(Element elem, String message) {\n\t\t/* In eclipse, messages just seem to get ignored, so we throw instead. */\n\t\tif (Boolean.TRUE) throw new RuntimeException(elem.getSimpleName() + \" \" + message);\n\t\tprocessingEnv.getMessager().printMessage(Kind.ERROR, elem.getSimpleName() + \" \" + message, elem);\n\t}\n\t\n\tprivate String createProperQualifiedName(TypeElement provider) {\n\t\treturn processingEnv.getElementUtils().getBinaryName(provider).toString();\n\t}\n}\n","sourceCodeStart":229,"sourceCodeEnd":255,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/spiProcessor/lombok/spi/SpiProcessor.java#L229-L255","documentation":"SpiProcessor.report raises a RuntimeException with '<element> <message>' because in Eclipse annotation processing round, printed Kind.ERROR messages are silently ignored, so the processor throws instead to surface the problem.","triggerScenarios":"handleProvidingElement detects an invalid @Provider-style SPI declaration (e.g. provider class not implementing the advertised interface) and calls report; under Eclipse this always throws.","commonSituations":"Using lombok's SPI annotation processor with a misdeclared service provider class; running annotation processing inside Eclipse where normal messaging fails.","solutions":["Read the thrown message: it names the element and the actual problem","Fix the SPI provider declaration flagged in the message (implement the required interface, correct the class)","Run the build outside Eclipse (javac/Gradle) to get the error as a normal diagnostic","Check that the annotated class matches what the SPI annotation expects"],"exampleFix":"// before\n@Provider(MyService.class)\npublic class MyImpl { }\n// after\n@Provider(MyService.class)\npublic class MyImpl implements MyService { }","handlingStrategy":"try-catch","validationCode":"if (!typeElement.getInterfaces().stream().anyMatch(i -> i.toString().equals(providerInterface))) {\n  throw new IllegalStateException(\"provider must implement \" + providerInterface);\n}","typeGuard":null,"tryCatchPattern":"try { compileWithProcessor(); } catch (RuntimeException e) { if (e.getMessage().contains(\"simpleName\") || wasThrownBySpiProcessor(e)) reportAsDiagnostic(e.getMessage()); else throw e; }","preventionTips":["Ensure @Provider-annotated classes implement the advertised interface","Compile with javac/Gradle rather than relying on Eclipse's messager for this processor","Read the thrown message — it states the element and the exact problem"],"tags":["java","annotation-processor","spi","eclipse"],"backgroundTag":"schema-validation-failed","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"}