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

Lint check for type mismatch of ComponentFactory/ViewModelFactory #23

Closed
yamasa opened this issue Jan 22, 2020 · 2 comments
Closed

Lint check for type mismatch of ComponentFactory/ViewModelFactory #23

yamasa opened this issue Jan 22, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@yamasa
Copy link
Member

yamasa commented Jan 22, 2020

  • If type Foo's companion object extends ComponentFactory or ViewModelFactory, its type parameter must be Foo.

I'd like to have a lint checker for the above rule.
That is, the lint checker reports mismatches like this:

class Foo {
    // snip...
    companion object : ComponentFactory<Bar>() { // <- WRONG!!
        override fun createComponent(context: Context): Bar = TODO()
    }
}
@yamasa yamasa added the enhancement New feature or request label Jan 22, 2020
@dtvc87
Copy link
Contributor

dtvc87 commented Jan 22, 2020

Right, it is definitely doable. We could also add a quick fix. So the type parameter gets replaced with Foo, what do you think?
What would be the severity level of this lint? I assume it would be error and not warning?

@yamasa
Copy link
Member Author

yamasa commented Jan 22, 2020

@dtvc87
Thanks!

We could also add a quick fix. So the type parameter gets replaced with Foo, what do you think?

Yes, it should be replaced with Foo.

What would be the severity level of this lint? I assume it would be error and not warning?

I think it should be error.

@yamasa yamasa mentioned this issue Jan 29, 2020
@yamasa yamasa closed this as completed Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants