Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find Bean Classes In Inherited '@Inject'-ed Field #112

Merged
merged 8 commits into from
Jan 8, 2021

Conversation

philippkunz
Copy link
Contributor

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 figure weld-junit should follow the same rules with @EnableAutoWeld mode as well.

My guess is that there was an error in ClassScanning's method formerly named findAnnotatedFields and now renamed to findAnnotatedDeclaredFields having called getDeclaredFields which excludes inherited fields but the name of that method formerly named findAnnotatedFields did not reflect this restriction and was missed where it is used in scanForRequiredBeanClasses.

Producers, however, are not inherited, see https://docs.jboss.org/cdi/spec/2.0/cdi-spec.html#member_level_inheritance.

Copy link
Collaborator

@manovotn manovotn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@philippkunz please create a tracking issue for this PR. Other than that, I have no objections.

@philippkunz philippkunz changed the title Find Bean Classes In Inherited '@Inject'-ed Field #114 Find Bean Classes In Inherited '@Inject'-ed Field Jan 8, 2021
@philippkunz philippkunz changed the title #114 Find Bean Classes In Inherited '@Inject'-ed Field Find Bean Classes In Inherited '@Inject'-ed Field Jan 8, 2021
@manovotn manovotn merged commit 96f3dbe into weld:master Jan 8, 2021
@manovotn
Copy link
Collaborator

manovotn commented Jan 8, 2021

Merged.
Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants