Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion quark/core/apkinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def superclass_relationships(self) -> Dict[str, Set[str]]:

for _class in self.analysis.get_classes():
hierarchy_dict[str(_class.name)].add(str(_class.extends))
hierarchy_dict[str(_class.name)].union(
hierarchy_dict[str(_class.name)].update(
str(implements) for implements in _class.implements
)

Expand Down
19 changes: 19 additions & 0 deletions tests/core/test_apkinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from types import SimpleNamespace
from typing import Literal, Tuple
import zipfile

Expand Down Expand Up @@ -689,6 +690,24 @@ def test_superclass_relationships_with_expected_class(self, apkinfo):

assert expected_upper_class == upper_set

def test_superclass_relationships_include_implemented_interfaces(self):
apkinfo = AndroguardImp.__new__(AndroguardImp)
apkinfo.analysis = SimpleNamespace(
get_classes=lambda: [
SimpleNamespace(
name="Lexample/Child;",
extends="Lexample/Parent;",
implements=["Lexample/FirstInterface;", "Lexample/SecondInterface;"],
)
]
)

assert apkinfo.superclass_relationships["Lexample/Child;"] == {
"Lexample/Parent;",
"Lexample/FirstInterface;",
"Lexample/SecondInterface;",
}

@staticmethod
@pytest.mark.parametrize(
"test_input, expected",
Expand Down
Loading