-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Issue #17000: AvoidOutdatedUsage: Use modern Java collections API (toList() instead of collect(Collectors.toList()))
#17012
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
Conversation
0cbdb2f
to
50f3cb2
Compare
50f3cb2
to
7d459bb
Compare
wip |
// Test other Collector methods | ||
Collectors.toCollection(ArrayList::new); // ok, modern API | ||
// FIXME: but was : [22, 23, 26, 27, 28, 35] | ||
// Foo.toList(); // ok, as custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we are not java types aware, no class path details. All we have are strings in AST. https://checkstyle.org/writingchecks.html#Limitations
can we fix this overloading issue then? We only should exclude class specific. @romani
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No types available, we can not distinguish overloaded methods.
We don't know hierarchy of types.
All this limitations makes any implementation to be very error prone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thats right. Maybe then go like lombok ? This always worked for my and better to have it and not miss it. We can tell as it is.
Just check out codebase its capable of so we are example for what its good for.
in the land of the blind, the one-eyed man is king.
263e748
to
a02264b
Compare
|
aa73234
to
83091b9
Compare
…ections API (toList() instead of collect(Collectors.toList()))
83091b9
to
29520ad
Compare
wip #16774 |
Issue #17000:
AvoidOutdatedUsage: Use modern Java collections API (toList() instead of collect(Collectors.toList()))