Title: var with JDK 13 - CLI throws "NoSuchFieldException: modifiers" · Issue #374 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: var with JDK 13 - CLI throws "NoSuchFieldException: modifiers" · Issue #374 · UnitTestBot/UTBotJava
X Title: var with JDK 13 - CLI throws "NoSuchFieldException: modifiers" · Issue #374 · UnitTestBot/UTBotJava
Description: Description CLI with JDK 13 Class using var field definition CLI throws "NoSuchFieldException: modifiers" To Reproduce Steps to reproduce the behavior: Define JDK-13 as primary (Path, JAVA_HOME) Download one of the latest CLI from master...
Open Graph Description: Description CLI with JDK 13 Class using var field definition CLI throws "NoSuchFieldException: modifiers" To Reproduce Steps to reproduce the behavior: Define JDK-13 as primary (Path, JAVA_HOME) Do...
X Description: Description CLI with JDK 13 Class using var field definition CLI throws "NoSuchFieldException: modifiers" To Reproduce Steps to reproduce the behavior: Define JDK-13 as primary (Path, JAV...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/374
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"var with JDK 13 - CLI throws \"NoSuchFieldException: modifiers\"","articleBody":"**Description**\r\n\r\nCLI with JDK 13\r\nClass using var field definition\r\nCLI throws \"NoSuchFieldException: modifiers\"\r\n\r\n**To Reproduce**\r\n\r\nSteps to reproduce the behavior:\r\n\r\n1. Define JDK-13 as primary (Path, JAVA_HOME)\r\n2. Download one of the latest [CLI from master](https://github.com/UnitTestBot/UTBotJava/actions/runs/2596727243)\r\n3. For simplicity in the folder where utbot-cli*.jar is located :\r\nCreate ExampleString.java using var (feature introduced in Java 9)\r\n\r\n```\r\npublic class ExampleString {\r\n\r\n public void stringNewMethod() {\r\n var text = \"Hello!\\n This is String defined with var\";\r\n\r\n text = text.toLowerCase();\r\n System.out.println(text);\r\n\r\n text = text.toUpperCase();\r\n System.out.println(text);\r\n }\r\n}\r\n```\r\n\r\n4. Compile your files with JDK-13\r\n\r\n`javac -version`\r\n\r\n`javac ExampleString.class`\r\n\r\n5. Run utbot-cli to generate tests for it, like that:\r\n\r\n`java -jar utbot-cli-2022.7.jar generate --source ExampleString.java --classpath \"D:\\Current\\Java\" -o ExampleStringTest.java ExampleString\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\nThere is the following output in console:\r\n\r\n```\r\nvar used, compiled and executed with JDK-13\r\n\r\n\r\nWARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.\r\n16:05:00.257 | INFO | AllInMemoryClassProvider | Loaded: 2 path entries, 46 classes, 194946 bytes\r\n16:05:01.443 | INFO | UtBotTestCaseGenerator | |\u003e Resuming method ExampleString.stringNewMethod()\r\nWARNING: An illegal reflective access operation has occurred\r\nWARNING: Illegal reflective access by com.esotericsoftware.kryo.unsafe.UnsafeUtil (file:/D:/Current/Java/utbot-cli-2022.7.jar) to constructor java.nio.DirectByteBuffer(long,int)\r\nWARNING: Please consider reporting this to the maintainers of com.esotericsoftware.kryo.unsafe.UnsafeUtil\r\nWARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations\r\nWARNING: All illegal access operations will be denied in a future release\r\n16:05:05.078 | ERROR | UtBotSymbolicEngine | Test generation failed on stmt return, symbolic stack trace:\r\n\u003cExampleString: void stringNewMethod()\u003e\r\norg.utbot.instrumentation.util.ChildProcessError: Error in the child process |\u003e java.lang.ExceptionInInitializerError\r\n at org.utbot.framework.util.EngineUtilsKt.getAnyInstance(EngineUtils.kt:35)\r\n at org.utbot.framework.concrete.MockValueConstructor.constructObject(MockValueConstructor.kt:161)\r\n at org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:127)\r\n at org.utbot.framework.concrete.MockValueConstructor.constructStatics(MockValueConstructor.kt:110)\r\n at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:146)\r\n at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107)\r\n at org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133)\r\n at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77)\r\n at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt)\r\nCaused by: java.lang.NoSuchFieldException: modifiers\r\n at java.base/java.lang.Class.getDeclaredField(Class.java:2412)\r\n at org.utbot.common.Reflection.\u003cclinit\u003e(ReflectionUtil.kt:18)\r\n ... 9 more\r\n\r\n at org.utbot.instrumentation.ConcreteExecutor.executeAsync(ConcreteExecutor.kt:415) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.ConcreteExecutor$executeAsync$1.invokeSuspend(ConcreteExecutor.kt) ~[utbot-cli-2022.7.jar:?]\r\n at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) [utbot-cli-2022.7.jar:?]\r\n at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:279) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.plugin.api.UtBotTestCaseGenerator$generateForSeveralMethods$4.invoke(UtBotTestCaseGenerator.kt:56) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods(UtBotTestCaseGenerator.kt:278) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.generateForSeveralMethods$default(UtBotTestCaseGenerator.kt:265) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.cli.GenerateTestsAbstractCommand.generateTestCases(GenerateTestsAbstractCommand.kt:163) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.cli.GenerateTestsCommand.run(GenerateTestsCommand.kt:102) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:204) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:213) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:17) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:396) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:393) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:411) [utbot-cli-2022.7.jar:?]\r\n at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:436) [utbot-cli-2022.7.jar:?]\r\n at org.utbot.cli.ApplicationKt.main(Application.kt:31) [utbot-cli-2022.7.jar:?]\r\nCaused by: java.lang.ExceptionInInitializerError\r\n at org.utbot.framework.util.EngineUtilsKt.getAnyInstance(EngineUtils.kt:35) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.MockValueConstructor.constructObject(MockValueConstructor.kt:161) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:127) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.MockValueConstructor.constructStatics(MockValueConstructor.kt:110) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:146) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt) ~[utbot-cli-2022.7.jar:?]\r\nCaused by: java.lang.NoSuchFieldException: modifiers\r\n at java.lang.Class.getDeclaredField(Class.java:2412) ~[?:?]\r\n at org.utbot.common.Reflection.\u003cclinit\u003e(ReflectionUtil.kt:18) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.util.EngineUtilsKt.getAnyInstance(EngineUtils.kt:35) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.MockValueConstructor.constructObject(MockValueConstructor.kt:161) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.MockValueConstructor.construct(MockValueConstructor.kt:127) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.MockValueConstructor.constructStatics(MockValueConstructor.kt:110) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:146) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:107) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.process.ChildProcessKt.loop(ChildProcess.kt:133) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt:77) ~[utbot-cli-2022.7.jar:?]\r\n at org.utbot.instrumentation.process.ChildProcessKt.main(ChildProcess.kt) ~[utbot-cli-2022.7.jar:?]\r\n16:05:05.147 | INFO | Summarization | Diversity execution path percentage: 100\r\n16:05:05.147 | INFO | Summarization | No execution traces found in test case for method ExampleString, public void stringNewMethod()\r\n {\r\n java.io.PrintStream $r0, $r1;\r\n ExampleString r2;\r\n java.lang.String r3, r4, r5;\r\n\r\n r2 := @this: ExampleString;\r\n\r\n r3 = \"Hello Baeldung!\\nThis is Java 12 article.\";\r\n\r\n r4 = virtualinvoke r3.\u003cjava.lang.String: java.lang.String toLowerCase()\u003e();\r\n\r\n $r0 = \u003cjava.lang.System: java.io.PrintStream out\u003e;\r\n\r\n virtualinvoke $r0.\u003cjava.io.PrintStream: void println(java.lang.String)\u003e(r4);\r\n\r\n r5 = virtualinvoke r4.\u003cjava.lang.String: java.lang.String toUpperCase()\u003e();\r\n\r\n $r1 = \u003cjava.lang.System: java.io.PrintStream out\u003e;\r\n\r\n virtualinvoke $r1.\u003cjava.io.PrintStream: void println(java.lang.String)\u003e(r5);\r\n\r\n return;\r\n }\r\n```\r\n","author":{"url":"https://github.com/alisevych","@type":"Person","name":"alisevych"},"datePublished":"2022-07-01T14:50:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/374/UTBotJava/issues/374"}
| 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:fc9f0e82-d31b-1383-5cee-6a19ceda78e1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7A4:1837F3:29A11E8:3596530:69902D49 |
| html-safe-nonce | 035ac69b1aace497b704024e6c924f120d0e9be9fa33c6938def735fb015259e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0E0OjE4MzdGMzoyOUExMUU4OjM1OTY1MzA6Njk5MDJENDkiLCJ2aXNpdG9yX2lkIjoiODkwNzUwMzk5ODg5NTkyNjYwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 502c71087490290e4841e5cd3b06e0ae479f88b2c80044462cd4e86e954c799f |
| hovercard-subject-tag | issue:1291506050 |
| 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/374/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c56464909d68482f4006b129ab693dae1ab18bb603a80f7fc5579233db59af15/UnitTestBot/UTBotJava/issues/374 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c56464909d68482f4006b129ab693dae1ab18bb603a80f7fc5579233db59af15/UnitTestBot/UTBotJava/issues/374 |
| og:image:alt | Description CLI with JDK 13 Class using var field definition CLI throws "NoSuchFieldException: modifiers" To Reproduce Steps to reproduce the behavior: Define JDK-13 as primary (Path, JAVA_HOME) Do... |
| 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