Title: Java fuzzer crashes when referencing classes not in the classpath · Issue #2594 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Java fuzzer crashes when referencing classes not in the classpath · Issue #2594 · UnitTestBot/UTBotJava
X Title: Java fuzzer crashes when referencing classes not in the classpath · Issue #2594 · UnitTestBot/UTBotJava
Description: Description Fuzzer crushes when method under test directly or indirectly accepts value of type X (indirectly meaning that it accepts some Y whose creation directly or indirectly may involve using X) such that: X is not a common reference...
Open Graph Description: Description Fuzzer crushes when method under test directly or indirectly accepts value of type X (indirectly meaning that it accepts some Y whose creation directly or indirectly may involve using X...
X Description: Description Fuzzer crushes when method under test directly or indirectly accepts value of type X (indirectly meaning that it accepts some Y whose creation directly or indirectly may involve using X...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/2594
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Java fuzzer crashes when referencing classes not in the classpath","articleBody":"**Description**\r\n\r\nFuzzer crushes when method under test directly or **indirectly** accepts value of type `X` (indirectly meaning that it accepts some `Y` whose creation directly or indirectly **may involve** using `X`) such that:\r\n * `X` is not a common reference type that has a custom value provider (e.g. `List`, `Map`)\r\n * `X` doesn't have a public constructor\r\n * there's a class `Z` such that:\r\n * it's reachable from user code (**not necessarily from class under test**)\r\n * it has a non-static method returning `X`\r\n * it has a constructor that accepts class that is not on the classpath\r\n\r\nAlthough, it may seem that this bug requires unlikely combination of tested program properties, as **bolded** text shows it's enough for some unrelated parts of the project to posses these properties, making this bug exceedingly likelier to occur as the project under test gets larger (in fact, it happened for me on the very first method in `spring-boot-testing` that I tried to generate tests for to check performance of #2583).\r\n\r\n**To Reproduce**\r\n\r\n1. Use UtBot version from #2583\r\n2. Create Java project (I used Java 11)\r\n3. Add `implementation(\"org.hibernate:hibernate-validator:8.0.1.Final\")` dependency (can also be reproduced with other libraries)\r\n4. Add the following classes\r\n5. Generate tests for the `ClassUnderTest` (optionally use `100%` fuzzing)\r\n\r\n```java\r\npublic class ClassUnderTest {\r\n public static int getLength(CharSequence charSequence) {\r\n return charSequence.length();\r\n }\r\n}\r\n```\r\n\r\n```java\r\npublic class UnrelatedClass {\r\n public static void useHibernateValidator(HibernateValidator hibernateValidator) { }\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\nTest generation completes without errors.\r\n\r\n**Actual behavior**\r\n\r\nFuzzer crashes (in this particular case fuzzer managed to cover the method under test before crashing, but we can't rely on it)\r\n\r\n**Visual proofs**\r\n\r\n~~~\r\n21:25:21.574 | INFO | JavaLanguage | Fuzzing is stopped because of an error\r\njava.lang.NoClassDefFoundError: jakarta/el/ExpressionFactory\r\n\tat java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?]\r\n\tat java.lang.Class.privateGetDeclaredConstructors(Class.java:3137) ~[?:?]\r\n\tat java.lang.Class.getDeclaredConstructors(Class.java:2357) ~[?:?]\r\n\tat org.utbot.framework.plugin.api.ClassId.getAllConstructors(Api.kt:1076) ~[utbot-framework-api-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.providers.ObjectValueProvider$generate$1.invokeSuspend(Objects.kt:72) ~[utbot-java-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:129) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat org.utbot.fuzzing.ValueProvider$Combined$generate$1.invokeSuspend(Providers.kt:231) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:129) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat org.utbot.fuzzing.ValueProvider$Fallback.generate(Providers.kt:161) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.ValueProvider$Combined$generate$1.invokeSuspend(Providers.kt:198) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.SequenceBuilderIterator.hasNext(SequenceBuilder.kt:129) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.FlatteningSequence$iterator$1.ensureItemIterator(Sequences.kt:316) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.FlatteningSequence$iterator$1.hasNext(Sequences.kt:303) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:787) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:817) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:808) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat org.utbot.fuzzing.FuzzingApi$produce$seeds$1.apply(Api.kt:427) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi$produce$seeds$1.apply(Api.kt:426) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat java.util.HashMap.computeIfAbsent(HashMap.java:1134) ~[?:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.produce(Api.kt:426) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.fuzz(Api.kt:399) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.reduce(Api.kt:519) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.produce(Api.kt:437) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.fuzz(Api.kt:399) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.fuzz$fuzzOne(Api.kt:331) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.fuzz(Api.kt:350) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi.access$fuzz(Api.kt:1) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.fuzzing.FuzzingApi$fuzz$2.invokeSuspend(Api.kt) ~[utbot-fuzzing-2023.09-SNAPSHOT.jar:?]\r\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.8.10.jar:1.8.10-release-430(1.8.10)]\r\n\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]\r\n\tat org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38) ~[utbot-core-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.framework.plugin.api.TestCaseGenerator$generate$2$3.invoke(TestCaseGenerator.kt:194) ~[utbot-framework-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.framework.plugin.api.TestCaseGenerator$generate$2$3.invoke(TestCaseGenerator.kt:193) ~[utbot-framework-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47) ~[utbot-core-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.framework.plugin.api.TestCaseGenerator.generate(TestCaseGenerator.kt:193) ~[utbot-framework-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.framework.process.EngineProcessMainKt$setup$4.invoke(EngineProcessMain.kt:127) ~[utbot-framework-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.framework.process.EngineProcessMainKt$setup$4.invoke(EngineProcessMain.kt:112) ~[utbot-framework-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.rd.IdleWatchdog$measureTimeForActiveCall$1$2$1.invoke(ClientProcessUtil.kt:115) ~[utbot-rd-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.rd.IdleWatchdog.wrapActive(ClientProcessUtil.kt:88) ~[utbot-rd-2023.09-SNAPSHOT.jar:?]\r\n\tat org.utbot.rd.IdleWatchdog$measureTimeForActiveCall$1.invoke(ClientProcessUtil.kt:114) ~[utbot-rd-2023.09-SNAPSHOT.jar:?]\r\n\tat com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:362) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:56) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:148) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:54) ~[rd-framework-2023.1.2.jar:?]\r\n\tat com.jetbrains.rd.util.threading.SingleThreadSchedulerBase.queue$lambda-3(SingleThreadScheduler.kt:41) ~[rd-core-2023.1.2.jar:?]\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]\r\n\tat java.lang.Thread.run(Thread.java:829) [?:?]\r\nCaused by: java.lang.ClassNotFoundException: jakarta.el.ExpressionFactory\r\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:476) ~[?:?]\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[?:?]\r\n\tat org.utbot.common.FallbackClassLoader.loadClass(FallbackClassLoader.kt:41) ~[utbot-core-2023.09-SNAPSHOT.jar:?]\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[?:?]\r\n\t... 61 more\r\n~~~","author":{"url":"https://github.com/IlyaMuravjov","@type":"Person","name":"IlyaMuravjov"},"datePublished":"2023-09-12T18:30:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2594/UTBotJava/issues/2594"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ff376ba7-f8e6-c0d9-c054-4127d759a124 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB54:5D9CD:36327C1:490EDFA:698DBC46 |
| html-safe-nonce | d66eb4e07d187ee61e7e683e4a2fcc54fb8fc5f596baa9b4676f9c3087cbd3e7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjU0OjVEOUNEOjM2MzI3QzE6NDkwRURGQTo2OThEQkM0NiIsInZpc2l0b3JfaWQiOiI0NzI4NzgxMDAwODM3NTIwMDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c441d9efb2fcaa5bb97c20d958d37835a60804cb50ca4e4b3b8f22cad715225c |
| hovercard-subject-tag | issue:1893049432 |
| 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/_view_fragments/issues/show/UnitTestBot/UTBotJava/2594/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bc6cce206409f200f033a1a29f8fc1baa77d06aa23e37a7a7def2a1924b8f70a/UnitTestBot/UTBotJava/issues/2594 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bc6cce206409f200f033a1a29f8fc1baa77d06aa23e37a7a7def2a1924b8f70a/UnitTestBot/UTBotJava/issues/2594 |
| og:image:alt | Description Fuzzer crushes when method under test directly or indirectly accepts value of type X (indirectly meaning that it accepts some Y whose creation directly or indirectly may involve using X... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IlyaMuravjov |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2457fd9a1b17ca7f38c3c2653895ccb2e0dd04f18f77446a21354e9bc4b7902f |
| turbo-cache-control | no-preview |
| 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 | 878672b82363fd98fbdc5bd0edb68e572c8a8d9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width