Skip to content

ToString support for abstract collection using makeSymbolic #391 #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2022

Conversation

CaelmBleidd
Copy link
Member

@CaelmBleidd CaelmBleidd commented Jul 4, 2022

Description

ToString for lists (as well as for other inheritors of AbstractCollection didn't work since it's too complicated for the engine because of StringBuilder usage somewhere inside of it. I've decided to make a temporary solution, implementing this method with makeSymbolic mechanism -- the method should return an unbounded symbolic variable, that will allow us to continue the analysis (in contrast to the executeConcretely). Later, the concrete execution will find the right result for such execution, if it's required.

My suggestion is based on thoughts that people usually use toString on collections just for logging, showing or something like that, and the resulting line won't present in the path constraints. It's not 100% true, but in many cases, it will work.

Fixes #391

Type of Change

  • Breaking change. toString without concrete executor works differently now for the inheritors of the AbstractCollection and HashSet

How Has This Been Tested?

Automated Testing

Added test in the corresponding package.

Manual Scenario

Same test, since it is only about toString method on any collection.

Checklist:

  • 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
  • No new warnings
  • Tests that prove my change is effective
  • All tests pass locally with my changes

@CaelmBleidd CaelmBleidd requested review from dtim and Damtev July 4, 2022 15:40
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/tostring-for-lists branch from ca9154e to 0f2779d Compare July 4, 2022 15:41
@CaelmBleidd CaelmBleidd enabled auto-merge (rebase) July 4, 2022 16:00
Copy link
Collaborator

@dtim dtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/tostring-for-lists branch from 0f2779d to dbbdced Compare July 4, 2022 17:32
@CaelmBleidd CaelmBleidd disabled auto-merge July 4, 2022 17:36
@CaelmBleidd CaelmBleidd enabled auto-merge (squash) July 4, 2022 17:36
@CaelmBleidd CaelmBleidd disabled auto-merge July 4, 2022 17:38
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/tostring-for-lists branch from 6fc5f04 to b381486 Compare July 4, 2022 18:14
@CaelmBleidd CaelmBleidd force-pushed the caelmbleidd/tostring-for-lists branch from b381486 to 9202b80 Compare July 4, 2022 18:17
@CaelmBleidd CaelmBleidd enabled auto-merge (rebase) July 4, 2022 18:17
@CaelmBleidd CaelmBleidd merged commit 3b21112 into main Jul 4, 2022
@CaelmBleidd CaelmBleidd deleted the caelmbleidd/tostring-for-lists branch July 4, 2022 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

ArrayList.toString() - fails to generate tests
3 participants