quarkusio/quarkus · error · DefinitionException
Event injection point can never be raw type - please specify
Error message
Event injection point can never be raw type - please specify the type parameter. Injection point:
What it means
An injected Event must be a parameterized type (e.g. Event<String>); a raw Event injection point cannot carry the event type, so ArC rejects it with a DefinitionException during InjectionPointInfo construction.
Source
Thrown at independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java:158
InjectionPointInfo(TypeAndQualifiers typeAndQualifiers, InjectionPointKind kind,
AnnotationTarget target, AnnotationTarget methodParameterTarget, boolean isTransientReference, boolean isDelegate) {
this.typeAndQualifiers = typeAndQualifiers;
this.resolvedBean = new AtomicReference<BeanInfo>(null);
this.targetBean = new AtomicReference<BeanInfo>(null);
this.kind = kind;
this.hasDefaultQualifier = typeAndQualifiers.qualifiers.size() == 1
&& typeAndQualifiers.qualifiers.iterator().next().name().equals(DotNames.DEFAULT);
this.target = target;
this.methodParameterTarget = methodParameterTarget;
this.position = (methodParameterTarget == null || !Kind.METHOD_PARAMETER.equals(methodParameterTarget.kind())) ? -1
: methodParameterTarget.asMethodParameter().position();
this.isTransientReference = isTransientReference;
this.isDelegate = isDelegate;
// validation - Event injection point can never be a raw type
if (DotNames.EVENT.equals(typeAndQualifiers.type.name()) && typeAndQualifiers.type.kind() == Type.Kind.CLASS) {
throw new DefinitionException(
"Event injection point can never be raw type - please specify the type parameter. Injection point: "
+ target);
}
}
void resolve(BeanInfo bean) {
resolvedBean.set(bean);
}
public BeanInfo getResolvedBean() {
return resolvedBean.get();
}
public Optional<BeanInfo> getTargetBean() {
return Optional.ofNullable(targetBean.get());
}
public void setTargetBean(BeanInfo bean) {View on GitHub (pinned to e1c734241f)
Solutions
- Add the event type parameter: @Inject Event<MyPayload> event;
- Use the raw-ignoring alternative Event<Object> if any payload is acceptable
Example fix
// before @Inject Event event; // after @Inject Event<MyEvent> event;
Defensive patterns
Strategy: validation
Validate before calling
Field f = MyBean.class.getDeclaredField("event");
if (f.getType() == jakarta.enterprise.event.Event.class) {
throw new IllegalStateException("Raw Event injection: " + f);
} Prevention
- Always parameterize Event<T> at injection points
- Enable IDE raw-types warnings; treat raw generic usage as an error
When it happens
Trigger: Injecting raw Event, e.g. @Inject Event event; detected in the InjectionPointInfo constructor when the type is a plain CLASS named jakarta.enterprise.event.Event.
Common situations: Omitting generics for brevity; code migrated from pre-generics patterns; IDE quick-fixes that drop type arguments.
Related errors
- Event#select(TypeLiteral, Annotation...) cannot be used with
- CDI event payload cannot contain unresolved type variable; f
- InterceptionProxy parameter must be a parameterized type: ${
- Producer field type is a parameterized type with a type vari
- Declaring class of a managed bean is generic, its scope must
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/266a025fdc4d7fd4.
Report an issue: GitHub.