Title: Functional interfaces defined as class members - InaccessibleObjectException on test generation · Issue #448 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Functional interfaces defined as class members - InaccessibleObjectException on test generation · Issue #448 · UnitTestBot/UTBotJava
X Title: Functional interfaces defined as class members - InaccessibleObjectException on test generation · Issue #448 · UnitTestBot/UTBotJava
Description: Description Test generation for Functional interfaces defined as class members - fails with InaccessibleObjectException from constructCompositeModel To Reproduce Steps to reproduce the behavior: Open IntelliJ IDEA Plugin is installed Cre...
Open Graph Description: Description Test generation for Functional interfaces defined as class members - fails with InaccessibleObjectException from constructCompositeModel To Reproduce Steps to reproduce the behavior: Op...
X Description: Description Test generation for Functional interfaces defined as class members - fails with InaccessibleObjectException from constructCompositeModel To Reproduce Steps to reproduce the behavior: Op...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/448
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Functional interfaces defined as class members - InaccessibleObjectException on test generation","articleBody":"**Description**\r\n\r\nTest generation for Functional interfaces defined as class members - fails with InaccessibleObjectException from constructCompositeModel\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n1. Open IntelliJ IDEA\r\n2. Plugin is installed\r\n3. Create a new project with JDK 8\r\n4. Add a class LambdaVarExample (see below)\r\n5. Run test generation\r\n6. Repeat 3-5 steps for a project with JDK 11\r\n\r\n```\r\nimport java.util.function.Predicate;\r\n\r\npublic class LambdaVarExample {\r\n\r\n private Predicate\u003c? super String\u003e byCondition = l -\u003e l.contains(\"b\");\r\n\r\n public void runTest(String input) {\r\n if (byCondition.test(input)) {\r\n firstScenario();\r\n } else {\r\n secondScenario();\r\n }\r\n }\r\n\r\n private void firstScenario() {\r\n System.out.println(\"1\");\r\n }\r\n\r\n private void secondScenario() {\r\n System.out.println(\"2\");\r\n }\r\n\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\n5-6. Tests are supposed to be generated without errors.\r\n\r\n**Actual behavior**\r\n\r\nAn error test is generated with information about...\r\n5. JDK 8 - ClassNotFoundException in concrete...\r\n6. JDK 11 - InaccessibleObjectException in constructCompositeModel.\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\n5. JDK 8 error:\r\n\r\n~~~\r\npublic void testRunTest_errors() {\r\n // Couldn't generate some tests. List of errors:\r\n // \r\n // 1 occurrences of:\r\n // Default concrete execution failed\r\n\r\n // 1 occurrences of:\r\n /* Error in the child process |\u003e java.lang.ClassNotFoundException: jdk.internal.logger.SimpleConsoleLogger$CallerFinder\r\n \t\tat java.net.URLClassLoader.findClass(URLClassLoader.java:387)\r\n \t\tat java.lang.ClassLoader.loadClass(ClassLoader.java:418)\r\n \t\tat org.utbot.instrumentation.process.HandlerClassesLoader.loadClass(ChildProcess.kt:38)\r\n \t\tat java.lang.ClassLoader.loadClass(ClassLoader.java:351)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.kClass(MockValueConstructor.kt:470)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.javaClass(MockValueConstructor.kt:455)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.constructObject(MockValueConstructor.kt:158)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:127)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.constructObject(MockValueConstructor.kt:184)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:127)\r\n \t\tat org.utbot.framework.concrete.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:104)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:144)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107)\r\n \t\tat org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)\r\n \t\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)\r\n \t\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)\r\n \t */\r\n\r\n }\r\n~~~\r\n\r\n6. JDK 11 error: \r\n\r\n~~~\r\npublic void testRunTest_errors() {\r\n // Couldn't generate some tests. List of errors:\r\n // \r\n // 1 occurrences of:\r\n /* Error in the child process |\u003e java.lang.reflect.InaccessibleObjectException: Unable to make\r\n field private boolean jdk.internal.logger.SimpleConsoleLogger$CallerFinder.lookingForLogger accessible: module java.base does not \"opens\r\n jdk.internal.logger\" to unnamed module @29e6eb25\r\n \t\tat java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)\r\n \t\tat java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)\r\n \t\tat java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:176)\r\n \t\tat java.base/java.lang.reflect.Field.setAccessible(Field.java:170)\r\n \t\tat org.utbot.framework.concrete.UtModelConstructor.constructCompositeModel(UtModelConstructor.kt:356)\r\n \t\tat org.utbot.framework.concrete.UtModelConstructor.constructFromAny(UtModelConstructor.kt:239)\r\n \t\tat org.utbot.framework.concrete.UtModelConstructor.construct(UtModelConstructor.kt:107)\r\n \t\tat org.utbot.framework.concrete.UtModelConstructor.constructCompositeModel(UtModelConstructor.kt:285)\r\n \t\tat org.utbot.framework.concrete.UtModelConstructor.constructFromAny(UtModelConstructor.kt:239)\r\n \t\tat org.utbot.framework.concrete.UtModelConstructor.construct(UtModelConstructor.kt:107)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1.invoke(UtExecutionInstrumentation.kt:179)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation$invoke$$inlined$withReflection$lambda$1.invoke(UtExecutionInstrumentation.kt:107)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation.withStaticFields(UtExecutionInstrumentation.kt:269)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:153)\r\n \t\tat org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107)\r\n \t\tat org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)\r\n \t\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)\r\n \t\tat org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)\r\n \t */\r\n\r\n }\r\n~~~\r\n\r\n\r\n\r\n**Environment**\r\n\r\nWindows 10 Pro\r\nIntelliJ IDEA 2022.1.3\r\nJDK 8, 11\r\nOne of the latest plugin build: https://github.com/UnitTestBot/UTBotJava/actions/runs/2621106151\r\n\r\n","author":{"url":"https://github.com/alisevych","@type":"Person","name":"alisevych"},"datePublished":"2022-07-07T06:58:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/448/UTBotJava/issues/448"}
| 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:55a7d105-806d-d29c-b691-498bfdb95040 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAFE:24677D:382E11:4794F7:69909EF3 |
| html-safe-nonce | 2967ffdfde4bb051dd787f9c245a6c1d602ffb11284a1151cb136e06d2fd03d7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUZFOjI0Njc3RDozODJFMTE6NDc5NEY3OjY5OTA5RUYzIiwidmlzaXRvcl9pZCI6IjM4NDU0MzY0Njk4ODA1OTQxNjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7bad666b9ed54db92126a88b7af551913abbe1dd799fbfa5e31a34cde0b6441e |
| hovercard-subject-tag | issue:1296925212 |
| 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/448/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3da575d96c9a5a13118ffefe073b7e5613db139fe04bc304a71b8da1c0030df5/UnitTestBot/UTBotJava/issues/448 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3da575d96c9a5a13118ffefe073b7e5613db139fe04bc304a71b8da1c0030df5/UnitTestBot/UTBotJava/issues/448 |
| og:image:alt | Description Test generation for Functional interfaces defined as class members - fails with InaccessibleObjectException from constructCompositeModel To Reproduce Steps to reproduce the behavior: Op... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | alisevych |
| 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