JetBrains / lincheck

Framework for testing concurrent data structures
Mozilla Public License 2.0
545 stars 31 forks source link

ClassCastException with dynamic reflection #282

Closed nickrobison closed 1 month ago

nickrobison commented 4 months ago

I've been playing around with Lincheck to verify some properties on an algorithm I've been working on. The code itself is built using Akka and when attempting to instantiate the class using LinChecker I get the following error:

Caused by: java.lang.ClassCastException: interface akka.event.LoggingFilter is not assignable from class akka.event.slf4j.Slf4jLoggingFilter
    at akka.actor.ReflectiveDynamicAccess.$anonfun$getClassFor$1(ReflectiveDynamicAccess.scala:31)
    at scala.util.Try$.apply(Try.scala:210)
    at akka.actor.ReflectiveDynamicAccess.getClassFor(ReflectiveDynamicAccess.scala:28)
    at akka.actor.ReflectiveDynamicAccess.createInstanceFor(ReflectiveDynamicAccess.scala:47)
    at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:929)
    at akka.actor.typed.ActorSystem$.createInternal(ActorSystem.scala:289)
    at akka.actor.typed.ActorSystem$.apply(ActorSystem.scala:204)
    at akka.actor.testkit.typed.scaladsl.ActorTestKit$.apply(ActorTestKit.scala:126)

The code works correctly under different test situations (and when bundled into UberJARs and docker) so I'm assuming it's because of the use custom class loaders as mentioned in https://github.com/JetBrains/lincheck/issues/133. Is there a timeline for when this feature might land? Or am I missing something entirely? The actual test code is attempting to the use the stress testing option, just to get started.

ndkoval commented 4 months ago

Hi @nickrobison, we are working on removing the custom ClassLoader. I will let you know when we release the change. It should be soon.

ndkoval commented 2 months ago

Hi, @nickrobison! It has taken a while to address the issue, but the recent 2.30 release should've fixed it. Could you please check?

nickrobison commented 1 month ago

@ndkoval Apologies for the delayed response, this did indeed address my issue. Thanks!