GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Collection.toArray(T[] a) test generation fails at soot.Scene.getSootClass · Issue #387 · UnitTestBot/UTBotJava

Collection.toArray(T[] a) test generation fails at soot.Scene.getSootClass #387

New issue
Copy link
New issue
Copy link
Closed
#400
Closed
Collection.toArray(T[] a) test generation fails at soot.Scene.getSootClass#387
#400
Copy link
Assignees
Damtev
Labels
ctg-bugIssue is a bugIssue is a bug

Description

@alisevych
alisevych
opened on Jul 4, 2022
Issue body actions

Description

Java 11 feature
Test generation for method Collection.toArray(T[] a) fails with RuntimeException: at soot.Scene.getSootClass

To Reproduce

Steps to reproduce the behavior:

  1. Define JDK-11 as primary (Path, JAVA_HOME)
  2. Open IntelliJ IDEA
  3. Plugin is installed
  4. A Maven project is opened with SDK 11 used
  5. Add a class using Collection.toArray(T[] a) - with NON-empty array, like that:
import java.util.List;

public class CollectionToArrayExample {

    public void method() {
        List<String> list = List.of("uno", "trez", "quatro");

        Object[] strings1 = list.toArray();

        String[] strings2a = list.toArray(new String[list.size()]);
        String[] strings2b = list.toArray(new String[0]);

        for (Object  str : strings2a) {
            System.out.println(str);
        }
    }
}

Expected behavior

Tests are supposed to be generated.

Actual behavior

The following exception is thrown and displayed as error in IDE:

java.lang.RuntimeException: 
Aborting: can't find classfile java.lang.Object
	at soot.Scene.getSootClass(Scene.java:1176)
	at org.utbot.engine.TypeResolverKt.getOBJECT_TYPE(TypeResolver.kt:316)
	at org.utbot.engine.ExtensionsKt.isJavaLangObject(Extensions.kt:134)
	at org.utbot.engine.pc.Z3TranslatorVisitor.filterInappropriateTypes(Z3TranslatorVisitor.kt:210)
	at org.utbot.engine.pc.Z3TranslatorVisitor.visit(Z3TranslatorVisitor.kt:165)
	at org.utbot.engine.pc.Z3TranslatorVisitor.visit(Z3TranslatorVisitor.kt:35)
	at org.utbot.engine.pc.UtIsExpression.accept(UtExpression.kt:349)
	at org.utbot.engine.pc.Z3TranslatorVisitor.translate(Z3TranslatorVisitor.kt:49)
	at org.utbot.engine.pc.UtSolver.check(UtSolver.kt:228)
	at org.utbot.engine.selectors.BasePathSelector.checkUnsat(BasePathSelector.kt:64)
	at org.utbot.engine.selectors.BasePathSelector.checkUnsatIfFork(BasePathSelector.kt:70)
	at org.utbot.engine.selectors.BasePathSelector.poll(BasePathSelector.kt:83)
	at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invokeSuspend(UtBotSymbolicEngine.kt:509)
	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:274)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
	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.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38)
	at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:279)
	at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:56)
	at org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47)
	at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods(UtBotTestCaseGenerator.kt:278)
	at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods$default(UtBotTestCaseGenerator.kt:265)
	at org.utbot.intellij.plugin.generator.CodeGenerator.generateForSeveralMethods(CodeGenerator.kt:55)
	at org.utbot.intellij.plugin.ui.UtTestsDialogProcessor$createTests$2$1.run(UtTestsDialogProcessor.kt:174)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:176)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	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.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)

Additional context

Only the first run of the test generation crashes.

Activity

  1. alisevych
    added
    ctg-bugIssue is a bugIssue is a bug
    on Jul 4, 2022
  2. Damtev
    self-assigned this
    on Jul 4, 2022
  3. Damtev commented on Jul 4, 2022

    @Damtev
    Damtev
    on Jul 4, 2022
    Member
    More actions

    Cannot reproduce the error but another bug is discovered - no executions are generated because List#of returns real List instead of UT wrapper UtArrayList. Fixed in #400

  4. Damtev
    closed this as completedin #400on Jul 4, 2022
  5. alexeyfridman
    added this to UTBot Javaon Jul 6, 2022
  6. alexeyfridman
    moved this to Todo in UTBot Javaon Jul 6, 2022
  7. JaneEugenia
    moved this from Todo to Done in UTBot Javaon Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Damtev
    Damtev

Labels

ctg-bugIssue is a bugIssue is a bug

Type

No type

Projects

  • UTBot Java
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.