[ https://issues.apache.org/jira/browse/KAFKA-17270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17871405#comment-17871405 ]
Greg Harris commented on KAFKA-17270: ------------------------------------- Eliminating the scala form would also make it easier to implement KAFKA-16450, since that needed to add new scala code. +1 > Let test code use Exit.java rather than Exit.scala > -------------------------------------------------- > > Key: KAFKA-17270 > URL: https://issues.apache.org/jira/browse/KAFKA-17270 > Project: Kafka > Issue Type: Test > Reporter: Chia-Ping Tsai > Assignee: Ming-Yen Chung > Priority: Minor > Fix For: 4.0.0 > > > Exit.scala is a wrap of Exit.java, and the benefit is "Nothing" which can > make methods throw exception. IMHO, the benefit is too small, and also we are > going to drop scala code. Hence, it would be great to use Exit.java directly > and then remove Exit.scala > *BEFORE* > I noticed it due to following exception. > {code:java} > java.lang.ClassCastException: class scala.runtime.BoxedUnit cannot be cast to > class scala.runtime.Nothing$ (scala.runtime.BoxedUnit and > scala.runtime.Nothing$ are in unnamed module of loader 'app') > at > kafka.server.ServerShutdownTest.$anonfun$testNoCleanShutdownAfterFailedStartupDueToCorruptLogs$3(ServerShutdownTest.scala:176) > at > kafka.server.ServerShutdownTest.$anonfun$testNoCleanShutdownAfterFailedStartupDueToCorruptLogs$3$adapted(ServerShutdownTest.scala:174) > at kafka.utils.Exit$$anon$1.execute(Exit.scala:81) > at org.apache.kafka.common.utils.Exit.halt(Exit.java:71) > at kafka.utils.Exit$.halt(Exit.scala:33) > at kafka.log.LogManager.handleLogDirFailure(LogManager.scala:230) > at > kafka.server.ReplicaManager.handleLogDirFailure(ReplicaManager.scala:2501) > at > kafka.server.ReplicaManager$LogDirFailureHandler.doWork(ReplicaManager.scala:325) > at > org.apache.kafka.server.util.ShutdownableThread.run(ShutdownableThread.java:136) > {code} > It seems to me using `Nothing` as returned type is weird and in this case the > suitable type should be `Unit` (same as other methods). Also, that can fix > the casting error in `testNoCleanShutdownAfterFailedStartupDueToCorruptLogs` > [0] > https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/utils/Exit.scala#44 > [1] > https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/utils/Exit.scala#50 -- This message was sent by Atlassian Jira (v8.20.10#820010)