Title: GitHub · Where software is built
Open Graph Title: UnitTestBot/UTBotJava
X Title: UnitTestBot/UTBotJava
Description: Automated unit test generation and precise code analysis for Java - UnitTestBot/UTBotJava
Open Graph Description: Automated unit test generation and precise code analysis for Java - UnitTestBot/UTBotJava
X Description: Automated unit test generation and precise code analysis for Java - UnitTestBot/UTBotJava
Opengraph URL: https://github.com/UnitTestBot/UTBotJava
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Collection.toArray(T[] a) test generation fails at soot.Scene.getSootClass","articleBody":"**Description**\r\n\r\nJava 11 feature\r\nTest generation for method Collection.toArray(T[] a) fails with RuntimeException: at soot.Scene.getSootClass\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n1. Define JDK-11 as primary (Path, JAVA_HOME)\r\n2. Open IntelliJ IDEA\r\n3. Plugin is installed\r\n4. A Maven project is opened with SDK 11 used\r\n5. Add a class using Collection.toArray(T[] a) - with NON-empty array, like that:\r\n\r\n```\r\nimport java.util.List;\r\n\r\npublic class CollectionToArrayExample {\r\n\r\n public void method() {\r\n List\u003cString\u003e list = List.of(\"uno\", \"trez\", \"quatro\");\r\n\r\n Object[] strings1 = list.toArray();\r\n\r\n String[] strings2a = list.toArray(new String[list.size()]);\r\n String[] strings2b = list.toArray(new String[0]);\r\n\r\n for (Object str : strings2a) {\r\n System.out.println(str);\r\n }\r\n }\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\nTests are supposed to be generated.\r\n\r\n**Actual behavior**\r\n\r\nThe following exception is thrown and displayed as error in IDE:\r\n\r\n```\r\njava.lang.RuntimeException: \r\nAborting: can't find classfile java.lang.Object\r\n\tat soot.Scene.getSootClass(Scene.java:1176)\r\n\tat org.utbot.engine.TypeResolverKt.getOBJECT_TYPE(TypeResolver.kt:316)\r\n\tat org.utbot.engine.ExtensionsKt.isJavaLangObject(Extensions.kt:134)\r\n\tat org.utbot.engine.pc.Z3TranslatorVisitor.filterInappropriateTypes(Z3TranslatorVisitor.kt:210)\r\n\tat org.utbot.engine.pc.Z3TranslatorVisitor.visit(Z3TranslatorVisitor.kt:165)\r\n\tat org.utbot.engine.pc.Z3TranslatorVisitor.visit(Z3TranslatorVisitor.kt:35)\r\n\tat org.utbot.engine.pc.UtIsExpression.accept(UtExpression.kt:349)\r\n\tat org.utbot.engine.pc.Z3TranslatorVisitor.translate(Z3TranslatorVisitor.kt:49)\r\n\tat org.utbot.engine.pc.UtSolver.check(UtSolver.kt:228)\r\n\tat org.utbot.engine.selectors.BasePathSelector.checkUnsat(BasePathSelector.kt:64)\r\n\tat org.utbot.engine.selectors.BasePathSelector.checkUnsatIfFork(BasePathSelector.kt:70)\r\n\tat org.utbot.engine.selectors.BasePathSelector.poll(BasePathSelector.kt:83)\r\n\tat org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invokeSuspend(UtBotSymbolicEngine.kt:509)\r\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)\r\n\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)\r\n\tat kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)\r\n\tat kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)\r\n\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)\r\n\tat kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)\r\n\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)\r\n\tat kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)\r\n\tat org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38)\r\n\tat org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:279)\r\n\tat org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:56)\r\n\tat org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47)\r\n\tat org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods(UtBotTestCaseGenerator.kt:278)\r\n\tat org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods$default(UtBotTestCaseGenerator.kt:265)\r\n\tat org.utbot.intellij.plugin.generator.CodeGenerator.generateForSeveralMethods(CodeGenerator.kt:55)\r\n\tat org.utbot.intellij.plugin.ui.UtTestsDialogProcessor$createTests$2$1.run(UtTestsDialogProcessor.kt:174)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)\r\n\tat com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)\r\n\tat com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)\r\n\tat com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)\r\n\tat com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:176)\r\n\tat com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)\r\n\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\r\n\tat java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)\r\n\tat java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)\r\n\tat java.base/java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)\r\n\tat java.base/java.lang.Thread.run(Thread.java:829)\r\n```\r\n\r\n**Additional context**\r\n\r\nOnly the first run of the test generation crashes.","author":{"url":"https://github.com/alisevych","@type":"Person","name":"alisevych"},"datePublished":"2022-07-04T09:09:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/387/UTBotJava/issues/387"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:7573aae9-23a2-bd72-e52f-a3f8ff2709fe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF84:2F5DBF:71301B:99A6BD:698E37FD |
| html-safe-nonce | df830c2ebd3340e281662676429df61185e0eb7a9df42260ace860ae19211961 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjg0OjJGNURCRjo3MTMwMUI6OTlBNkJEOjY5OEUzN0ZEIiwidmlzaXRvcl9pZCI6IjIzOTYxOTE1MTM1MjY1NDg0NzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0bf7ef0951f6510cb950cc010d657a50e1872b65c5994dd71380156216cda1ef |
| hovercard-subject-tag | repository:480810501 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/UnitTestBot/UTBotJava/issues/387 |
| twitter:image | https://opengraph.githubassets.com/016daada226eea8afa380b5e18f218a1a7bf127c1b47d7b78097a4ad3ad43b30/UnitTestBot/UTBotJava |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/016daada226eea8afa380b5e18f218a1a7bf127c1b47d7b78097a4ad3ad43b30/UnitTestBot/UTBotJava |
| og:image:alt | Automated unit test generation and precise code analysis for Java - UnitTestBot/UTBotJava |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a5632af64f7fed7bff1d6a428d1aca1b94fa7a48f760de2d39d9b1effdbf0082 |
| turbo-cache-control | no-cache |
| go-import | github.com/UnitTestBot/UTBotJava git https://github.com/UnitTestBot/UTBotJava.git |
| octolytics-dimension-user_id | 87413538 |
| octolytics-dimension-user_login | UnitTestBot |
| octolytics-dimension-repository_id | 480810501 |
| octolytics-dimension-repository_nwo | UnitTestBot/UTBotJava |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 480810501 |
| octolytics-dimension-repository_network_root_nwo | UnitTestBot/UTBotJava |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | aa1fa9100f85cd8b602c63c7e337f9151e70024f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width