Title: Add more correct type resolving for collections and maps by Markoutte · Pull Request #2610 · UnitTestBot/UTBotJava · GitHub
Open Graph Title: Add more correct type resolving for collections and maps by Markoutte · Pull Request #2610 · UnitTestBot/UTBotJava
X Title: Add more correct type resolving for collections and maps by Markoutte · Pull Request #2610 · UnitTestBot/UTBotJava
Description: Description Fixes #2571 The generic retrieving logic for collections and maps was naive. This PR improves that logic using guava type resolving to find out correct types. For every type it tries to resolve a type of returned values when calling such methods as Map.keySet, Map.values and Collection.iterator. A generic used in the returned type of those methods is a target type used for building a collection or a map. Note, that the fix reveals another problem in the code generator. Because it uses untyped model it fails to generate a compilable test. For example, the result of fuzzing getAnyString method from the issue is follow: @Test @DisplayName("getAnyString: ") public void testGetAnyString() { Issue2571 issue2571 = new Issue2571(); issue2571.put(((Object) "XZ"), ((Object) "abc")); String actual = issue2571.getAnyString(); String expected = "XZ"; assertEquals(expected, actual); } This line issue2571.put(((Object) "XZ"), ((Object) "abc")); has syntax error because the map expects a string, not an object. @EgorkaKulikov , please, check this one. How to test Automated tests New tests added: The proposed changes are verified with tests: utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/JavaValueProviderTest.kt` Manual tests All manual tests from collections samples should pass. Self-check list I've set the proper labels for my PR (at least, for category and component). PR title and description are clear and intelligible. I've added enough comments to my code, particularly in hard-to-understand areas. The functionality I've repaired, changed or added is covered with automated tests. Manual tests have been provided optionally. The documentation for the functionality I've been working on is up-to-date.
Open Graph Description: Description Fixes #2571 The generic retrieving logic for collections and maps was naive. This PR improves that logic using guava type resolving to find out correct types. For every type it tries to...
X Description: Description Fixes #2571 The generic retrieving logic for collections and maps was naive. This PR improves that logic using guava type resolving to find out correct types. For every type it tries to...
Opengraph URL: https://github.com/UnitTestBot/UTBotJava/pull/2610
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d263f966-fb06-500f-f06e-398740723ee1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B544:C2496:AB27FA:E7F71E:698E3DD9 |
| html-safe-nonce | 1ee1993d363464566775c429b75fc36c663212896ee1bbeedfed8a96e463d6c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTQ0OkMyNDk2OkFCMjdGQTpFN0Y3MUU6Njk4RTNERDkiLCJ2aXNpdG9yX2lkIjoiMzY0MTU3ODE5NjUyMjkwOTE0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 84121ab97b2ab8e97d2047d90d9028384326064a8b6038d93ecfd38cade4bd34 |
| hovercard-subject-tag | pull_request:1522485712 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/2610/files |
| twitter:image | https://avatars.githubusercontent.com/u/720952?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/720952?s=400&v=4 |
| og:image:alt | Description Fixes #2571 The generic retrieving logic for collections and maps was naive. This PR improves that logic using guava type resolving to find out correct types. For every type it tries to... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a5632af64f7fed7bff1d6a428d1aca1b94fa7a48f760de2d39d9b1effdbf0082 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | aa1fa9100f85cd8b602c63c7e337f9151e70024f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width