Skip to content

Unnecessary Numbering in Anonymous Class Tree Representation #347

Open
@pouryafard75

Description

@pouryafard75

Hello,

I have identified a bug that I believe could be problematic in many cases.

When objects are created from anonymous classes, an additional number appears in their representation. I understand that this number originates from the parser and represents the index of the anonymous class, providing a form of relative ordering. However, this number is included in the tree representation, leading to unexpected behavior in the matching algorithm.

For example, please refer to this commit.

Image

In this commit, I added a statement containing an anonymous class. However, due to the additional anonymous class on the right-hand side, the number causes two identical subtrees to differ:

Image

As a result, the diff algorithm fails to match them correctly and the following editscript gets geneated

update-node
---
Class: 1 [559,1073]
replace 1 by 2

And due to the offsets of the modifed subtree, the resulting diff will be like:

Image

We are in the final stages of our experiments and would greatly appreciate it if you could provide a hotfix for this particular issue. This case was inspired by an actual open-source project commit that we encountered in our benchmark dataset.

Thank you in advance for your assistance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions