UnitTestBot / UTBotJava

Automated unit test generation and precise code analysis for Java
Apache License 2.0
136 stars 43 forks source link

`RefType sun.nio.cs.UTF_8 not loaded` in `seata-core-0.5.0` project #1670

Closed tyuldashev closed 1 year ago

tyuldashev commented 1 year ago

Description During test generation by ContestEstimator exceptions RefType sun.nio.cs.UTF_8 not loaded are thwrown.

To Reproduce

Steps to reproduce the behavior:

  1. Open utbot project
  2. Open org.utbot.contest.ContestEstimatorKt file
  3. Set filters on project and class:
        methodFilter = "io.seata.core.protocol.transaction.GlobalBeginResponse.doEncode"
        projectFilter = listOf("seata-core-0.5.0")
  4. Increase timeout if tests are not generated (val timeLimit = 120`)
  5. Run ContestEstimator

Expected behavior Tests are generated without errors

Actual behavior There are errors in console output

11:35:31.655 | ERROR | Symbolic execution FAILED
java.lang.IllegalStateException: RefType sun.nio.cs.UTF_8 not loaded. If you tried to get the RefType of a library class, did you call loadNecessaryClasses()? Otherwise please check Soot's classpath.
    at soot.Scene.getRefType(Scene.java:1135) ~[soot-utbot-fork-4.4.0-FORK-2.jar:?]
    at org.utbot.engine.ResolverKt$toMethodResult$10.invoke(Resolver.kt:1214) ~[main/:?]
    at org.utbot.engine.ResolverKt$toMethodResult$10.invoke(Resolver.kt:1207) ~[main/:?]
    at org.utbot.engine.ResolverKt.arrayToMethodResult(Resolver.kt:1270) ~[main/:?]
    at org.utbot.engine.ResolverKt.toMethodResult(Resolver.kt:1207) ~[main/:?]
    at org.utbot.engine.Traverser.makeConcreteUpdatesForNonEnumStaticField(Traverser.kt:692) ~[main/:?]
    at org.utbot.engine.Traverser.processStaticFieldConcretely(Traverser.kt:600) ~[main/:?]
    at org.utbot.engine.Traverser.processStaticInitializer(Traverser.kt:490) ~[main/:?]
    at org.utbot.engine.Traverser.processStaticInitializerIfRequired(Traverser.kt:394) ~[main/:?]
    at org.utbot.engine.Traverser.doPreparatoryWorkIfRequired(Traverser.kt:366) ~[main/:?]
    at org.utbot.engine.Traverser.traverseStmt(Traverser.kt:329) ~[main/:?]
    at org.utbot.engine.Traverser.traverse(Traverser.kt:312) ~[main/:?]
    at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invokeSuspend(UtBotSymbolicEngine.kt:301) [main/:?]
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.7.20.jar:1.7.20-release-201(1.7.20)]
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [kotlinx-coroutines-core-jvm-1.6.3.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_352]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_352]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_352]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_352]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_352]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_352]
    at java.lang.Thread.run(Thread.java:750) [?:1.8.0_352]
11:35:32.786 | DEBUG | --new testCase collected, to generate: testIo.seata.core.protocol.transaction.GlobalBeginResponse.doEncode6
Domonion commented 1 year ago

Regularly meet this problem in project spon-core-7.0.0