gemmellr commented on code in PR #5477: URL: https://github.com/apache/activemq-artemis/pull/5477#discussion_r1934128714
########## artemis-commons/src/main/java/org/apache/activemq/artemis/utils/runnables/AtomicRunnable.java: ########## @@ -23,8 +23,8 @@ public abstract class AtomicRunnable implements Runnable { public static AtomicRunnable checkAtomic(Runnable run) { - if (run instanceof AtomicRunnable) { - return (AtomicRunnable)run; + if (run instanceof AtomicRunnable runnable) { + return runnable; Review Comment: ```suggestion if (run instanceof AtomicRunnable atomicRunnable) { return atomicRunnable; ``` It is already a Runnable, so calling it merely _runnable_ right after we determined it is more than just that and return it as a different type, simply reads horribly, far more than the original cast. -- 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: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact