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

error: incompatible types: Function1<CAP#1,Unit> cannot be converted to #1367

Open
mobilekosmos opened this issue Nov 3, 2023 · 1 comment

Comments

@mobilekosmos
Copy link

mobilekosmos commented Nov 3, 2023

error: incompatible types: Function1<CAP#1,Unit> cannot be converted to Function1<? super Pair<? extends PredefinedDateRange,? extends DayOfWeek>,Unit>
super.onPredefinedRangeSelected = onPredefinedRangeSelected;
^
where CAP#1 is a fresh type-variable:
CAP#1 extends Object super: Pair<PredefinedDateRange,DayOfWeek> from capture of ? super Pair<PredefinedDateRange,DayOfWeek>
1 error

This code is causing it:

@EpoxyModelClass
abstract class FilterDateDynamicItemModel :
    ViewBindingKotlinModel<ItemFilterDateDynamicBinding>(R.layout.item_filter_date_dynamic) {

    @EpoxyAttribute(EpoxyAttribute.Option.DoNotHash)
    lateinit var onPredefinedRangeSelected: (Pair<FilterData.PredefinedDateRange, java.time.DayOfWeek?>) -> Unit

enum class PredefinedDateRange(val stringResId: Int) {

Any idea how to solve this?

This was working before updating the epoxy lib to the latest version.

@stephen-mojo
Copy link

I believe I may be running into the same issue after upgrading to 5.1.3. This issue is not present on 5.1.1.

I have made a repository with the minimal amount of code necessary to reproduce the issue:
https://github.com/stephen-mojo/epoxy-issue-repro

When you attempt to build this project, you get the following error:

/epoxy-issue-repro/app/build/generated/ksp/debug/java/com/example/epoxyissuerepro/MyEpoxyModel_.java:146: error: incompatible types: List<CAP#1> cannot be converted to List<MyEnum>
    return myEnums;
           ^
  where CAP#1 is a fresh type-variable:
    CAP#1 extends MyEnum from capture of ? extends MyEnum

It appears that the generated subclass for the EpoxyModel changes between the two versions.

In 5.1.1 (works):

...

@NonNull
public List<MyEnum> myEnums() {
  return super.getMyEnums();
}

...

In 5.1.3 (does not work):

...

@NonNull
public List<MyEnum> myEnums() {
  return myEnums;
}

...

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

No branches or pull requests

2 participants