Title: Concrete executor tries to create enum instances by reflection and fails · Issue #619 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Concrete executor tries to create enum instances by reflection and fails · Issue #619 · UnitTestBot/UTBotJava
X Title: Concrete executor tries to create enum instances by reflection and fails · Issue #619 · UnitTestBot/UTBotJava
Description: Description In MockValueConstructor class, concrete executor creates objects using reflection. No special filtering is performed for enum classes. When the concrete executor tries to create instances of an enum, it fails with IllegalArgu...
Open Graph Description: Description In MockValueConstructor class, concrete executor creates objects using reflection. No special filtering is performed for enum classes. When the concrete executor tries to create instanc...
X Description: Description In MockValueConstructor class, concrete executor creates objects using reflection. No special filtering is performed for enum classes. When the concrete executor tries to create instanc...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/619
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Concrete executor tries to create enum instances by reflection and fails","articleBody":"**Description**\r\n\r\nIn `MockValueConstructor` class, concrete executor creates objects using reflection. No special filtering is performed for enum classes. When the concrete executor tries to create instances of an enum, it fails with `IllegalArgumentException`, as it is specifically forbidden to create enums by reflection (the reason is to ensure that no difference instances of the same enum value can be created, so reference equality is always possible).\r\n\r\nA special check for enums should be added, so that real values could be returned instead of new instances.\r\n\r\n**To Reproduce**\r\n\r\nRun the constest estimator with settings from the issue #300. \r\n\r\n**Expected behavior**\r\n\r\nNo exceptions are thrown during the contest estimator run.\r\n\r\n**Actual behavior**\r\n\r\nAn `IllegalArgumentException` is thrown when the concrete executor tries to create an instance of an enum class, and the corresponding `org.utbot.instrumentation.util.ChildProcessError` exception is thrown.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n```\r\norg.utbot.instrumentation.util.ChildProcessError: Error in the child process |\u003e java.lang.IllegalArgumentException: Cannot reflectively create enum objects\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:417)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.call(MockValueConstructor.kt:455)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:381)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:360)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:129)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.value(MockValueConstructor.kt:435)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:377)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:360)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:129)\r\n\tat org.utbot.framework.concrete.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:104)\r\n\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:143)\r\n\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:106)\r\n\tat org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)\r\n\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)\r\n\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)\r\n\r\n\tat org.utbot.instrumentation.ConcreteExecutor.executeAsync(ConcreteExecutor.kt:416) ~[main/:?]\r\n\tat org.utbot.instrumentation.ConcreteExecutor$executeAsync$1.invokeSuspend(ConcreteExecutor.kt) ~[main/:?]\r\n\tat kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.4.30.jar:1.4.30-release-302 (1.4.30)]\r\n\tat kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [kotlinx-coroutines-core-jvm-1.4.1.jar:?]\r\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_342]\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_342]\r\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_342]\r\n\tat java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_342]\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_342]\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_342]\r\n\tat java.lang.Thread.run(Thread.java:750) [?:1.8.0_342]\r\nCaused by: java.lang.IllegalArgumentException: Cannot reflectively create enum objects\r\n\tat java.lang.reflect.Constructor.newInstance(Constructor.java:417) ~[?:1.8.0_342]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.call(MockValueConstructor.kt:455) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:381) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:360) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:129) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.value(MockValueConstructor.kt:435) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:377) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:360) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:129) ~[main/:?]\r\n\tat org.utbot.framework.concrete.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:104) ~[main/:?]\r\n\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:143) ~[main/:?]\r\n\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:106) ~[main/:?]\r\n\tat org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133) ~[main/:?]\r\n\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77) ~[main/:?]\r\n\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt) ~[main/:?]\r\n```\r\n\r\n**Environment**\r\n\r\nThe exact behavior of the contest estimator depends on its arguments, and on the enum handling code that is not currently in `main` (PR #611), but generally the exception should be reproduced even without enum patches.\r\n\r\n**Additional context**\r\n\r\nNo additional context.\r\n","author":{"url":"https://github.com/dtim","@type":"Person","name":"dtim"},"datePublished":"2022-07-30T22:18:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/619/UTBotJava/issues/619"}
| 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:d3aed530-ab4c-3f18-f37c-e8518ee04600 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 91B4:1A2E3D:14F4B9E:1B28C1C:69908C3B |
| html-safe-nonce | 3ff06b7db1db313ba5c7744952915bdbc9d4a64cb0faefa242a865f591cce41e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUI0OjFBMkUzRDoxNEY0QjlFOjFCMjhDMUM6Njk5MDhDM0IiLCJ2aXNpdG9yX2lkIjoiMTg5NDUzODg1NjYxMjUzMTI2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8b9e565a81a3c8af2015badc6c07706f953d3d19f9789d9d12e4c4e19efc1f09 |
| hovercard-subject-tag | issue:1323309266 |
| 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/619/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8aaaca8450de1b619b04b4387ecce732073dd0ef230bbd6422ee575b169b8724/UnitTestBot/UTBotJava/issues/619 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8aaaca8450de1b619b04b4387ecce732073dd0ef230bbd6422ee575b169b8724/UnitTestBot/UTBotJava/issues/619 |
| og:image:alt | Description In MockValueConstructor class, concrete executor creates objects using reflection. No special filtering is performed for enum classes. When the concrete executor tries to create instanc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dtim |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| 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 | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width