Title: Replace Kotlin getters/setters with property access in codegen #496 by volivan239 · Pull Request #1002 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Replace Kotlin getters/setters with property access in codegen #496 by volivan239 · Pull Request #1002 · UnitTestBot/UTBotJava
X Title: Replace Kotlin getters/setters with property access in codegen #496 by volivan239 · Pull Request #1002 · UnitTestBot/UTBotJava
Description: Description Now codegen properly treats Kotlin's autogenerated getters/setters and uses direct property access instead of them. Kotlin properties are treated as fields. However, instead of FieldId.isAccessibleFrom which is now private, methods FieldId.canBeReadFrom and FieldId.canBeSetFrom should be used. First one behaves for Java code in the same way as isAccessibleFrom did before, but for Kotlin it also returns true if there is an accessible getter. Behavior of FieldId.canBeSetFrom hasn't been changed for Java, but for Kotlin it now also returns true if there is accessible setter/getter pair. See docs for more details. These two methods guarantee that codegen produces code with field access where it is possible. However, some calls to getters/setters may be produced by AssembleModelGenerator, so this PR also adds replaceCgExecutableCallWithFieldAccessIfNeeded to replace such calls with direct accesses. Fixes #496 Type of Change Please delete options that are not relevant. Bug fix (non-breaking change which fixes an issue) How Has This Been Tested? Manual Scenario Works correctly on examples from #496 and #948 Checklist (remove irrelevant options): This is the author self-check list The change followed the style guidelines of the UTBot project Self-review of the code is passed The change contains enough commentaries, particularly in hard-to-understand areas New documentation is provided or existed one is altered No new warnings New tests have been added All tests pass locally with my changes
Open Graph Description: Description Now codegen properly treats Kotlin's autogenerated getters/setters and uses direct property access instead of them. Kotlin properties are treated as fields. However, instead of Fiel...
X Description: Description Now codegen properly treats Kotlin's autogenerated getters/setters and uses direct property access instead of them. Kotlin properties are treated as fields. However, instead of ...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/pull/1002
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:4edc17ec-e671-b209-99a0-f7a626adf7ad |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | E3DC:AF4DA:21114D1:2D6F136:698DCE07 |
| html-safe-nonce | c4a6847b1eaaef51df69f63a5bc6ec434187e8317ea361c38f2299327cb4322d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFM0RDOkFGNERBOjIxMTE0RDE6MkQ2RjEzNjo2OThEQ0UwNyIsInZpc2l0b3JfaWQiOiIyNjQyMzAyNzkwMzc4ODM1NDY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fcfb6b3b0e78b156575276a1fa5f955ea848045f31c4b7e9a4c3862c50f2996b |
| hovercard-subject-tag | pull_request:1065345943 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/UnitTestBot/UTBotJava/pull/1002/checks |
| twitter:image | https://avatars.githubusercontent.com/u/65076429?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/65076429?s=400&v=4 |
| og:image:alt | Description Now codegen properly treats Kotlin's autogenerated getters/setters and uses direct property access instead of them. Kotlin properties are treated as fields. However, instead of Fiel... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d9c5a945db9d79f5476dbe75d3700f24739ef28ab02037163bdeac4050cd4ded |
| 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 full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 650e13e6e6d3957db6415d62f055e6a5fd0037db |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width