Skip to content

Stabilize the behavior of ConstructorAnalyzer #1293

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

Closed
wants to merge 1 commit into from

Conversation

volivan239
Copy link
Collaborator

@volivan239 volivan239 commented Nov 2, 2022

Description

Removed vistiedConstructors from ConstructorAnalyzer.analyze() method. The intention of that container was to prevent from infinite recursion and to increase performance when analyzing chain of constructors. However, it lead to possible errors if the outer method was called more then once. Also, infinite recursion isn't actually possible since recursive constructor calls are forbidden both in Java and Kotlin. Performance changes seems to be miserable.

Type of Change

  • Minor bug fix (non-breaking small changes)

How Has This Been Tested?

Manual Scenario

Tested on the following class -- previously incorrect behavior of ConstructAnalyzer lead to unnecessary reflection used for expected models, after these changes no reflection is used.

class NullabilityIssuesExample(val x: Int) {
    fun copyWithX(new_x: Int?): NullabilityIssuesExample? {
        if (new_x == null)
            return null
        return NullabilityIssuesExample(x + new_x)
    }
}

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

@volivan239 volivan239 marked this pull request as ready for review November 2, 2022 13:50
@volivan239 volivan239 enabled auto-merge (squash) November 2, 2022 13:50
@volivan239 volivan239 disabled auto-merge November 2, 2022 14:56
@volivan239 volivan239 marked this pull request as draft November 2, 2022 14:56
@volivan239
Copy link
Collaborator Author

Doesn't work and needs smarter approach -- see #1353

@volivan239 volivan239 closed this Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant