kotlinx-lincheck icon indicating copy to clipboard operation
kotlinx-lincheck copied to clipboard

ClassCastException with dynamic reflection

Open nickrobison opened this issue 1 year ago • 2 comments

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.

nickrobison avatar Feb 22 '24 20:02 nickrobison

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 avatar Feb 22 '24 22:02 ndkoval

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?

ndkoval avatar Apr 29 '24 18:04 ndkoval

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

nickrobison avatar May 24 '24 19:05 nickrobison