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

Resolve unchecked call warning for WrappedEpoxyModelClickListener #1337

Merged
merged 1 commit into from
May 19, 2023

Conversation

SubhrajyotiSen
Copy link
Contributor

Generated classes that contain a View.ClickListener attribute has a method similar to the following:

public DateViewHolder_ clickListener(
      @NonNull final OnModelClickListener<DateViewHolder_, ViewBindingHolder> clickListener) {
    onMutation();
    if (clickListener == null) {
      super.setClickListener(null);
    }
    else {
      super.setClickListener(new WrappedEpoxyModelClickListener(clickListener));
    }
    return this;
  }

The code new WrappedEpoxyModelClickListener(clickListener) causes a warning similar to

 warning: [unchecked] unchecked call to WrappedEpoxyModelClickListener(OnModelClickListener<T,V>) as a member of the raw type WrappedEpoxyModelClickListener
            super.setClickListener(new WrappedEpoxyModelClickListener(clickListener));
                                   ^
  where T,V are type-variables:
    T extends EpoxyModel<?> declared in class WrappedEpoxyModelClickListener
    V extends Object declared in class WrappedEpoxyModelClickListener

This PR resolves the warning by writing super.setClickListener(new WrappedEpoxyModelClickListener<>(clickListener)); to the generated code instead of super.setClickListener(new WrappedEpoxyModelClickListener(clickListener));

Also, XTypeElement.superType is Deprecated. Hence replacing it with XTypeElement.superClass

@SubhrajyotiSen
Copy link
Contributor Author

@elihart Tagging you here since I'm unable to request reviews on this PR. I hope that's okay.

@elihart
Copy link
Contributor

elihart commented May 19, 2023

Thanks for the fix!

@elihart elihart merged commit dcb463e into airbnb:master May 19, 2023
@SubhrajyotiSen SubhrajyotiSen deleted the unchecked-call-warning branch May 19, 2023 18:56
@elihart elihart mentioned this pull request May 19, 2023
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