-
Notifications
You must be signed in to change notification settings - Fork 1.7k
--no-implicit-dynamic should take @optionalTypeArgs into account #26901
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
Comments
FYI @jmesserly |
what is |
Hmmm. But what's it used for? I don't understand why it's a good idea. It seems to defeat the purpose of --no-implicit-dynamic, which is opt in, but is intended to give you confidence there is no "accidental dynamic" in your code anywhere. There is a way to get similar behavior with strong mode+no-implicit-dynamic: class MapDataItem<K extends Object, V extends Object> extends ... By adding I suppose we could combine them and have f(MapDataItem<String, int> m) { ... }
var myItem = new MapDataItem(...);
f(myItem); // boom, cast failure! That's why we were trying to encourage type arguments. With a type like CC @leafpetersen as well |
I didn't realize that generic type parameter constraints are used this way. I tried it and it seems to solve my problem. I like this better than |
BTW 🍻 🍻 🍻 for |
awesome! Let us know if that feeling changes based on experience :) I will leave this open because it's at least an inconsistency we should think about. And I do worry about taking away the nice "raw type" syntax. If it seems to come up a lot, we can bump the priority to figure out something better. |
Closing this issue as stale; we do have work planned for new |
The text was updated successfully, but these errors were encountered: