Title: Incorrect property access rendering in Kotlin · Issue #948 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Incorrect property access rendering in Kotlin · Issue #948 · UnitTestBot/UTBotJava
X Title: Incorrect property access rendering in Kotlin · Issue #948 · UnitTestBot/UTBotJava
Description: Description By default, Kotlin generates a private field and getter/setter for each property into bytecode. However, you can't use these getters/setters directly from Kotlin code, instead you should direct access syntax (like direct acce...
Open Graph Description: Description By default, Kotlin generates a private field and getter/setter for each property into bytecode. However, you can't use these getters/setters directly from Kotlin code, instead you shoul...
X Description: Description By default, Kotlin generates a private field and getter/setter for each property into bytecode. However, you can't use these getters/setters directly from Kotlin code, instead you s...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/issues/948
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect property access rendering in Kotlin","articleBody":"**Description**\r\n\r\nBy default, Kotlin generates a private field and getter/setter for each property into bytecode. However, you can't use these getters/setters directly from Kotlin code, instead you should direct access syntax (like direct accessing field in Java). However, code produced by UTBot uses these setters/getters which lead to compilation error.\r\n\r\n**To Reproduce**\r\n\r\nLaunch action on the following class:\r\n```Kotlin\r\nclass Sample {\r\n var x: Int = 3;\r\n fun f(): Int {\r\n return x;\r\n }\r\n}\r\n```\r\n\r\n**Expected behavior**\r\n\r\nTests are generated correctly (in particular, access to field is written like `sample.x = ...`)\r\n\r\n**Actual behavior**\r\n\r\nGenerated tests are not compilable.\r\n\r\n\r\n**Visual proofs (screenshots, logs, images)**\r\n\r\nAmong others, the following test is produced:\r\n```Kotlin\r\n@Test\r\nfun testF1() {\r\n val sample = Sample()\r\n sample.setX(-255)\r\n\r\n val actual = sample.f()\r\n\r\n assertEquals(-255, actual)\r\n}\r\n```","author":{"url":"https://github.com/volivan239","@type":"Person","name":"volivan239"},"datePublished":"2022-09-16T15:15:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/948/UTBotJava/issues/948"}
| 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:53342354-7ab3-5d2a-c853-5d99933ccd31 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 80BA:7380D:1D72E0:27427C:698DAFD5 |
| html-safe-nonce | 1f94511539e7c2b72704cb9a37847411b11a41aaa4dad5918ed25e2152b5167c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MEJBOjczODBEOjFENzJFMDoyNzQyN0M6Njk4REFGRDUiLCJ2aXNpdG9yX2lkIjoiNzA4MTk0ODMxNDYwMjQxODEzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f51860e743afe50607bff951bcc7e6015db699f0b7e4fa3817fd135cd66e0db9 |
| hovercard-subject-tag | issue:1376091891 |
| 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/948/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e576427f6b4babaa67283a2e06bfbddacc80b9cac82e6d965ffc9d8b2b02c4da/UnitTestBot/UTBotJava/issues/948 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e576427f6b4babaa67283a2e06bfbddacc80b9cac82e6d965ffc9d8b2b02c4da/UnitTestBot/UTBotJava/issues/948 |
| og:image:alt | Description By default, Kotlin generates a private field and getter/setter for each property into bytecode. However, you can't use these getters/setters directly from Kotlin code, instead you shoul... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | volivan239 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8c7947c0c592efeab6162b9909ad11fa43bff8b0cb5ff43273dc25e41979d43e |
| 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 | b22a9fbf4dea601ec149a9e5362e0558df79b505 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width