Skip to content

Support super calls in inherited wrappers #819

@sergeypospelov

Description

@sergeypospelov

Description

Suppose, we want to create wrapper for some class by extending existing wrapper, e.g. wrapper for ArrayDeque based on UtLinkedList. The problem is that we can't call functions with super syntax like super.add, so it increases copy-paste. It happens because our method overriding mechanism resolves the call of a super method to the current method itself, so infinite recursion occurs.

public class InheritedWrapper extends BaseWrapper {
    public void add(Object o) {
        // some stuff
        super.add(o); // this resolves to InheritedWrapper::add instead of BaseWrapper::add
    }
}

Expected behavior

It's possible to extend an existing wrapper and call methods of ancestor with super. This wrapper works as expected.

Context

Wrappers are our own easy-to-analyze implementations of existing classes with the same functionality. See UtLinkedList, ListWrapper, etc.
Related functions: Traverser::overrideInvocation, Traverser::invokeSpecial, Traverser::commonInvokePart.

Metadata

Metadata

Assignees

Labels

comp-symbolic-engineIssue is related to the symbolic execution engine

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions