[weld-dev] Validating for fields that are annotated with both EJB and Inject

Benjamin Confino BENJAMIC at uk.ibm.com
Tue Apr 14 10:27:05 EDT 2020


Hello weld

I had a customer with an issue that I believe occurred because they 
annotated a field with both @Inject and @EJB. This has given me two 
questions: 

1) Should weld throw an error when a field is annotated with both 
annotations? 

2) If so is the correct way to add something like 

 if (ij.getAnnotated().isAnnotationPresent(Inject.class) && 
ij.getAnnotated().isAnnotationPresent(EJB.class)) {
    throw ...
}

to Validator.validateInjectionPointForDefinitionErrors()

If so I'm willing to create a pull request, all I'd need is for you to 
tell me what the error message should say and please point me to which 
test I should expand to cover this case. 

Regards
Benjamin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20200414/345e6b80/attachment.html 


More information about the weld-dev mailing list