Make class implementations of Subcomponents static if they do not reference the parent component
See original GitHub issueHaving an ImprintActivityComponent
which is a subcomponent of ApplicationComponent
which does not reference anything from the parent yields to the following generated implementation that could be made static:
private final class ImprintActivityComponentImpl implements ImprintActivityComponent {
private Provider<ActionBarHelper> provideActionBarHelperProvider;
private MembersInjector<ImprintActivity> imprintActivityMembersInjector;
private ImprintActivityComponentImpl(ImprintActivityComponentBuilder builder) {
assert builder != null;
initialize(builder);
}
@SuppressWarnings("unchecked")
private void initialize(final ImprintActivityComponentBuilder builder) {
this.provideActionBarHelperProvider =
DoubleCheck.provider(
ActivityModule_ProvideActionBarHelperFactory.create(builder.imprintActivityModule));
this.imprintActivityMembersInjector =
ImprintActivity_MembersInjector.create(provideActionBarHelperProvider);
}
@Override
public void injectMembers(ImprintActivity arg0) {
imprintActivityMembersInjector.injectMembers(arg0);
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
Subcomponents - Dagger
Subcomponents are components that inherit and extend the object graph of a parent component. You can use them to partition your application's object...
Read more >Call child method from parent - Stack Overflow
If best practice is to create a maze of logic to do something as simple as calling a child component's method - then...
Read more >Composition vs Inheritance - React
React has a powerful composition model, and we recommend using composition instead of inheritance to reuse code between components. In this section, we...
Read more >Component (Java Platform SE 7 ) - Oracle Help Center
A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user....
Read more >How to access parent component from child component. #15651
You can get parent instance reference inside OnInit with keyword this and pass as parameter or save in static class variable. In my...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Subcomponents don’t know their parent component, and may sometimes be used in a context where they use the parent’s bindings and other times not. I think this is reasonable, just not a super high priority.
I’m going to claim this as infeasible. I don’t think the work required to make it happen is justified for such a small benefit.