matthiasblaesing commented on code in PR #9091:
URL: https://github.com/apache/netbeans/pull/9091#discussion_r2635754675
##########
platform/core.execution/src/org/netbeans/core/execution/ExecutionEngine.java:
##########
@@ -194,7 +195,7 @@ protected final PermissionCollection
createPermissions(CodeSource cs, InputOutpu
protected final void fireExecutionStarted (ExecutionEvent ev) {
runningTasks.add( ev.getProcess() );
@SuppressWarnings("unchecked")
- Iterator<ExecutionListener> iter = ((HashSet<ExecutionListener>)
executionListeners.clone()).iterator();
+ Iterator<ExecutionListener> iter = executionListeners.iterator();
Review Comment:
This makes me nervous. Why is the removal of the `clone` safe? HashMaps are
not synchronized and if I remember correctly iteration of a map that is
modified by another thread is undefined behavior. The clone removes the need
for synchronization (at least I would read it as such).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists