{"record":{"id":"fc5271fb5d1c5eb2","repo":"quarkusio/quarkus","slug":"named-without-value-may-not-be-used-on-method-par","errorCode":null,"errorMessage":"@Named without value may not be used on method parameter: ","messagePattern":"@Named without value may not be used on method parameter: ","errorType":"validation","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java","lineNumber":95,"sourceCode":"        return fromMethod(method, beanClass, beanDeployment, null, transformer);\n    }\n\n    static List<InjectionPointInfo> fromMethod(MethodInfo method, ClassInfo beanClass, BeanDeployment beanDeployment,\n            BiPredicate<Set<AnnotationInstance>, Integer> skipPredicate, InjectionPointModifier transformer) {\n        List<InjectionPointInfo> injectionPoints = new ArrayList<>();\n        for (ListIterator<Type> iterator = method.parameterTypes().listIterator(); iterator.hasNext();) {\n            Type paramType = iterator.next();\n            int position = iterator.previousIndex();\n            Set<AnnotationInstance> paramAnnotations = Annotations.getParameterAnnotations(beanDeployment, method, position);\n            if (skipPredicate != null && skipPredicate.test(paramAnnotations, position)) {\n                // Skip parameter, e.g. @Disposes\n                continue;\n            }\n            Set<AnnotationInstance> paramQualifiers = new HashSet<>();\n            for (AnnotationInstance paramAnnotation : paramAnnotations) {\n                for (AnnotationInstance annotationInstance : beanDeployment.extractQualifiers(paramAnnotation)) {\n                    if (isNamedWithoutValue(annotationInstance)) {\n                        throw new DefinitionException(\"@Named without value may not be used on method parameter: \" + method);\n                    }\n                    paramQualifiers.add(annotationInstance);\n                }\n            }\n            Type type = resolveType(paramType, beanClass, method.declaringClass(), beanDeployment);\n            injectionPoints.add(new InjectionPointInfo(type,\n                    transformer.applyTransformers(type, method, method.parameters().get(position), paramQualifiers),\n                    method, method.parameters().get(position), contains(paramAnnotations, DotNames.TRANSIENT_REFERENCE),\n                    contains(paramAnnotations, DotNames.DELEGATE)));\n        }\n        return injectionPoints;\n    }\n\n    public static InjectionPointInfo fromSyntheticInjectionPoint(TypeAndQualifiers typeAndQualifiers) {\n        return new InjectionPointInfo(typeAndQualifiers, InjectionPointKind.CDI, null, null, false, false);\n    }\n\n    private final TypeAndQualifiers typeAndQualifiers;","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java#L77-L113","documentation":"The @Named qualifier without an explicit value is only meaningful on classes (derived from the EL name); on a method parameter of an initializer/producer/injector method it has no resolvable value, so ArC throws a DefinitionException.","triggerScenarios":"Annotating a method parameter with bare @Named (no value) where qualifiers are extracted, e.g. an initializer or producer method parameter; detected in InjectionPointInfo.fromMethod.","commonSituations":"Copy-pasting @Named from class-level usage onto parameters; expecting @Named on a parameter to act like @Named(\"x\") elsewhere.","solutions":["Give @Named an explicit value: @Named(\"myName\")","Replace bare @Named with a proper qualifier annotation","Remove @Named from the parameter if it is not needed"],"exampleFix":"// before\nvoid init(@Named String name) {}\n// after\nvoid init(@Named(\"myName\") String name) {}","handlingStrategy":"validation","validationCode":"for (Method m : MyClass.class.getDeclaredMethods()) {\n    for (Annotation[] pa : m.getParameterAnnotations()) {\n        for (Annotation a : pa) {\n            if (a instanceof jakarta.inject.Named n && n.value().isEmpty()) {\n                throw new IllegalStateException(\"Bare @Named on parameter: \" + m);\n            }\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply a value when using @Named: @Named(\"x\")","Prefer dedicated qualifier annotations over @Named for injection points"],"tags":["cdi","arc","named","qualifier"],"backgroundTag":"named-qualifier-without-value","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"}