I am getting below error during compilation, using HILT for DI.
Component methods cannot have type variables
Its complaining about the below code
public abstract class BaseDialogFragment extends DialogFragment {
@EntryPoint
@InstallIn(ApplicationComponent.class)
interface BaseDialogFragmentEntryPoint {
public <T extends ViewModelBase> T T();
}
protected ViewModelBase dataContext;
protected <T extends ViewModelBase> T configure(Class<T> type)
{
BaseDialogFragmentEntryPoint baseDialogFragmentEntryPoint = EntryPointAccessors.fromApplication(getActivity().getApplicationContext(), BaseDialogFragmentEntryPoint.class);
T viewModel = baseDialogFragmentEntryPoint.T();
this.dataContext = viewModel;
return viewModel;
}
}
ViewModelBase class is extended by number of classes.
Does HILT support injecting generic objects? I have not found much information on this regarding HILT.