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

[proposal] Ensure broadest interface #2206

Open
gatesn opened this issue Apr 19, 2022 · 0 comments
Open

[proposal] Ensure broadest interface #2206

gatesn opened this issue Apr 19, 2022 · 0 comments

Comments

@gatesn
Copy link
Contributor

gatesn commented Apr 19, 2022

What happened?

I have a constructor that accepts a Foo, where Foo implements/extends Bar.

My class only uses methods from Bar though, so the argument it accepts is overly restrictive.

What did you want to happen?

Warn me when I take a more specific class when a superclass / interface would suffice.

However...

This probably breaks for semantic behavior. e.g. ThreadSafeFoo implements Foo. Maybe an annotation denoting a semantic extension could be added?

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

1 participant