Skip to content

fix bug in removeDefLocalsOf, also lp issue#1118

Merged
stschott merged 8 commits intodevelopfrom
1095-bug-nullpointerexception-cannot-invoke-sootupcorejimplebasiclocalgetname-because-newlocal-is-null
Oct 30, 2024
Merged

fix bug in removeDefLocalsOf, also lp issue#1118
stschott merged 8 commits intodevelopfrom
1095-bug-nullpointerexception-cannot-invoke-sootupcorejimplebasiclocalgetname-because-newlocal-is-null

Conversation

@sahilagichani14
Copy link
Copy Markdown
Collaborator

No description provided.

…cannot-invoke-sootupcorejimplebasiclocalgetname-because-newlocal-is-null
List<Stmt> localOccurrences = new ArrayList<>();
for (Stmt stmt : stmts) {
if (stmt.equivTo(removedStmt)) continue;
List<Value> stmtUses = stmt.getUsesAndDefs().collect(Collectors.toList());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really want stmt.getUsesAndDefs()? Shouldn't it be stmt.getUses()?

Copy link
Copy Markdown
Collaborator Author

@sahilagichani14 sahilagichani14 Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getUses only gives me only the right hand side values like b = virtualinvoke(a) but stmt.getUsesAndDefs() also gives me a = anything i.e definitions of a.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's the uses AND defs that you want then we should rename this method/variables.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

…cannot-invoke-sootupcorejimplebasiclocalgetname-because-newlocal-is-null
@stschott stschott merged commit 1390a6e into develop Oct 30, 2024
@stschott stschott deleted the 1095-bug-nullpointerexception-cannot-invoke-sootupcorejimplebasiclocalgetname-because-newlocal-is-null branch October 30, 2024 11:14
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.

[Bug]: NullPointerException: Cannot invoke "sootup.core.jimple.basic.Local.getName()" because "newLocal" is null

4 participants