Find Bean Classes In Inherited '@Inject'-ed Field #112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wondered why I had to specify
@AddBeanClass
with a class the same test inherited an injected field of that type. The bean class would have been found and added automatically if the injected field would have been on the test class itself as opposed to inherited. Weld also makes no such difference on whether injected fields are inherited or not so I figureweld-junit
should follow the same rules with@EnableAutoWeld
mode as well.My guess is that there was an error in
ClassScanning
's method formerly namedfindAnnotatedFields
and now renamed tofindAnnotatedDeclaredFields
having calledgetDeclaredFields
which excludes inherited fields but the name of that method formerly namedfindAnnotatedFields
did not reflect this restriction and was missed where it is used inscanForRequiredBeanClasses
.Producers, however, are not inherited, see https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#member_level_inheritance.