Skip to content

Fix object creation tracking #426

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 3 commits into from
Nov 27, 2024
Merged

Fix object creation tracking #426

merged 3 commits into from
Nov 27, 2024

Conversation

eupp
Copy link
Collaborator

@eupp eupp commented Nov 26, 2024

Before this PR, ObjectCreationTransformer injected Injections::afterNewObjectCreation only on the objects on which Object::<init> constructor was called. However, if the instrumented code created a new instance of some Derived class, such that its Base class is not instrumented, then no Object::<init> constructor call would be tracked by the current algorithm (since only Derived::<init> will be called from the instrumented code).

To fix this issue, we now track any ::<init> constructor call, and keep a counter of uninitialized objects to distinguish between actual constructor calls, and the calls of the base class constructor from the derived class constructor.

@eupp eupp mentioned this pull request Nov 26, 2024
Before this commit, `ObjectCreationTransformer` tracked only the objects on which `Object::<init>` constructor was called. However, if the instrumented code created a new instance of some `Derived` class, such that its `Base` class is not instrumented, then no `Object::<init>` constructor call would have been tracked.

To fix this issue, we now track any `::<init>` constructor call, and keep a counter of uninitialized objects to distringuish between actual constructor calls, and the calls of the base class constructor from the derived class constructor.

Signed-off-by: Evgeniy Moiseenko <[email protected]>
@eupp eupp force-pushed the obj-creation-tracking-fix branch from 719add0 to 3cbce9b Compare November 26, 2024 19:01
@eupp eupp requested a review from ndkoval November 26, 2024 20:47
@ndkoval ndkoval merged commit 91b72ad into develop Nov 27, 2024
16 checks passed
@ndkoval ndkoval deleted the obj-creation-tracking-fix branch November 27, 2024 14:20
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.

2 participants