<AWT Dev> Integrated: 8263530: sun.awt.X11.ListHelper.removeAll() should use clear()
Aleksey Shipilev
shade at openjdk.java.net
Mon Mar 15 09:54:06 UTC 2021
On Fri, 12 Mar 2021 15:44:39 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> SonarCloud reports:
> Remove or correct this "removeAll" call.
>
> void removeAll() {
> items.removeAll(items); // <--- here
> updateScrollbars();
> }
>
> Calling `removeAll()` with the same collection risks concurrent modification exceptions. `clear()` would be correct and more efficient.
This pull request has now been integrated.
Changeset: 7b4aefe9
Author: Aleksey Shipilev <shade at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/7b4aefe9
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
8263530: sun.awt.X11.ListHelper.removeAll() should use clear()
Reviewed-by: serb, kizune
-------------
PR: https://git.openjdk.java.net/jdk/pull/2974
More information about the awt-dev
mailing list