Skip to content

ClassNotFoundException for a method returning Predicate #958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alisevych opened this issue Sep 19, 2022 · 1 comment · Fixed by #989
Closed

ClassNotFoundException for a method returning Predicate #958

alisevych opened this issue Sep 19, 2022 · 1 comment · Fixed by #989
Assignees
Labels
ctg-bug Issue is a bug

Comments

@alisevych
Copy link
Member

Description

ClassNotFoundException is thrown in Concrete Execution of a method returning a Predicate.

To Reproduce

  1. IntelliJ IDEA is opened
  2. Download and install UnitTestBot plugin with merged Support lambda expressions #825
  3. Check Settings : Symbolic execution is ON, Fuzzing is OFF

image

  1. Add the following code to utbot-sample/src/main/java/org/utbot/examples/lambda/SimpleLambdaExamples.java
  2. Generate tests for it with UTBot:
    public Predicate<Object> predicateEquals(Object a) {
        if (a != null) {
            return (o -> o.equals(a));
        } else {
            return (o -> o.equals(5));
        }
    }

Expected behavior

Tests are supposed to be generated.

Actual behavior

Test generation fails with error message.

Visual proofs (screenshots, logs, images)

ClassNotFoundException is thrown - see the stacktrace from Concrete Executor logs

java.lang.ClassNotFoundException: org.utbot.examples.lambda.SimpleLambdaExamples$$Lambda$67/0x000000080022f840
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at org.utbot.instrumentation.process.HandlerClassesLoader.loadClass(ChildProcess.kt:63)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at org.utbot.framework.plugin.api.util.IdUtilKt.getJClass(IdUtil.kt:100)
at org.utbot.framework.concrete.UtAssembleModelConstructorsKt.findUtAssembleModelConstructor(UtAssembleModelConstructors.kt:91)
at org.utbot.framework.concrete.UtModelConstructor.tryConstructUtAssembleModel(UtModelConstructor.kt:256)
at org.utbot.framework.concrete.UtModelConstructor.constructFromAny(UtModelConstructor.kt:247)
at org.utbot.framework.concrete.UtModelConstructor.construct(UtModelConstructor.kt:114)
at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$1$1$concreteExecutionResult$1.invoke(UtExecutionInstrumentation.kt:195)
at org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$1$1$concreteExecutionResult$1.invoke(UtExecutionInstrumentation.kt:174)
at org.utbot.framework.concrete.UtExecutionInstrumentation.withStaticFields(UtExecutionInstrumentation.kt:308)
at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:174)
at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:117)
at org.utbot.instrumentation.process.ChildProcessKt$setup$2.invoke(ChildProcess.kt:211)
at org.utbot.instrumentation.process.ChildProcessKt$setup$2.invoke(ChildProcess.kt:208)
at org.utbot.instrumentation.process.ChildProcessKt$measureExecutionForTermination$2$1$1.invoke(ChildProcess.kt:190)
at org.utbot.instrumentation.process.ChildProcessKt$measureExecutionForTermination$1.invokeSuspend(ChildProcess.kt:174)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at org.utbot.instrumentation.process.ChildProcessKt.measureExecutionForTermination(ChildProcess.kt:171)
at org.utbot.instrumentation.process.ChildProcessKt.access$measureExecutionForTermination(ChildProcess.kt:1)
at org.utbot.instrumentation.process.ChildProcessKt$measureExecutionForTermination$2$1.invokeSuspend(ChildProcess.kt:188)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at org.utbot.instrumentation.process.ChildProcessKt$measureExecutionForTermination$2.invoke(ChildProcess.kt:187)
at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
at com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:360)
at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57)
at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:56)
at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:148)
at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56)
at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:54)
at com.jetbrains.rd.util.threading.SingleThreadSchedulerBase.queue$lambda-3(SingleThreadScheduler.kt:41)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)

Environment

IntelliJ IDEA 2022.1.4
JDK 11
UTBotJava project, utbot-sample module

Additional context

JDK 11 is used. Predicate.not() can be added - compiling.

@alisevych alisevych added the ctg-bug Issue is a bug label Sep 19, 2022
@korifey korifey moved this to Todo in UTBot Java Sep 19, 2022
@Damtev
Copy link
Member

Damtev commented Sep 19, 2022

Looks like a bug in a concrete execution, @sergeypospelov please take a look.

Repository owner moved this from Todo to Done in UTBot Java Sep 22, 2022
@alisevych alisevych self-assigned this Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants