{"record":{"id":"c9e177a1590bd791","repo":"quarkusio/quarkus","slug":"class-classname-used-in-annotationname-on","errorCode":null,"errorMessage":"Class ${className} used in ${annotationName} on ${declaringClass} not found","messagePattern":"Class (.+?) used in (.+?) on (.+?) not found","errorType":"exception","errorClass":"RestClientDefinitionException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java","lineNumber":426,"sourceCode":"            TryBlock tryBlock = null;\n\n            if (!required) {\n                tryBlock = creator.tryBlock();\n                methodCallCreator = tryBlock;\n            }\n            String methodName = values[0].substring(1, values[0].length() - 1); // strip curly braces\n\n            MethodInfo paramValueMethod;\n            ResultHandle paramValue;\n            if (methodName.contains(\".\")) {\n                // calling a static method\n                int endOfClassName = methodName.lastIndexOf('.');\n                String className = methodName.substring(0, endOfClassName);\n                String staticMethodName = methodName.substring(endOfClassName + 1);\n\n                ClassInfo clazz = index.getClassByName(DotName.createSimple(className));\n                if (clazz == null) {\n                    throw new RestClientDefinitionException(\n                            \"Class \" + className + \" used in \" + annotationName + \" on \" + declaringClass + \" not found\");\n                }\n                paramValueMethod = findMethod(clazz, declaringClass, staticMethodName, clientParamAnnotation.toString());\n\n                if (paramValueMethod.parametersCount() == 0) {\n                    paramValue = methodCallCreator.invokeStaticMethod(paramValueMethod);\n                } else if (paramValueMethod.parametersCount() == 1 && isString(paramValueMethod.parameterType(0))) {\n                    paramValue = methodCallCreator.invokeStaticMethod(paramValueMethod, methodCallCreator.load(paramName));\n                } else {\n                    throw new RestClientDefinitionException(\n                            annotationName + \" method \" + declaringClass.toString() + \"#\" + staticMethodName\n                                    + \" has too many parameters, at most one parameter, param name, expected\");\n                }\n            } else {\n                // interface method\n                String mockName = mockInterface(declaringClass, generatedClasses, index);\n                ResultHandle interfaceMock = methodCallCreator.newInstance(MethodDescriptor.ofConstructor(mockName));\n","sourceCodeStart":408,"sourceCodeEnd":444,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/MicroProfileRestClientEnricher.java#L408-L444","documentation":"When a REST client parameter annotation value uses a static-method reference (e.g. @DefaultValue(value = \"com.acme.Util#defaultQ\")), the enricher resolves the referenced class from the Jandex index. If the class named before the last '.'/'#' in the value is not in the index, the build fails with this RestClientDefinitionException.","triggerScenarios":"An annotation value references com.acme.Util#someMethod but the class com.acme.Util is not part of the indexed application classes (not on the app classpath / not in the Quarkus index), or the class name string is misspelled.","commonSituations":"Typos in the fully-qualified class name; class lives in a dependency not indexed by Quarkus; class removed in a refactor while annotation values still reference it; wrong package after a move.","solutions":["Correct the fully-qualified class name in the annotation value","Ensure the referenced class is in the application (or an indexed dependency), not an unindexed jar","Use the app-model/index-supported location — move the helper class into the application module","Verify the static method exists on the class with the expected signature (next step after this check)"],"exampleFix":"// before\n@QueryParam(\"q\") @DefaultValue(\"com.acme.Uttil#defaultQ\") String q // typo: Uttil\n// after\n@QueryParam(\"q\") @DefaultValue(\"com.acme.Util#defaultQ\") String q","handlingStrategy":"validation","validationCode":"String methodName = \"com.acme.Util#defaultQ\"; // from annotation value\nString cls = methodName.substring(0, methodName.lastIndexOf('.'));\ntry {\n    Class.forName(cls); // must be loadable & part of the indexed app\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\"Class \" + cls + \" referenced in annotation not found\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    enricher.addParam(...);\n} catch (RestClientDefinitionException e) {\n    if (e.getMessage().contains(\"not found\")) { /* fix class reference */ }\n    throw e;\n}","preventionTips":["Use the exact fully-qualified class name in '#'-style annotation values","Keep referenced helper classes in the application module (indexed by Quarkus/Jandex)","Grep for '#'-method references in @DefaultValue/@QueryParam values after package refactors","Verify static method existence and zero-arg signature on the referenced class"],"tags":["rest-client","microprofile","jandex","class-not-found","build-time"],"backgroundTag":"class-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}