Skip to content

Commit

Permalink
feat(objectionary#344): fix all qulice suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Aug 2, 2024
1 parent c3f664f commit cc85561
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public void handle(final DecompilerState state) {
);
Collections.reverse(args);
final AstNode target = state.stack().pop();
final boolean istarget = InvokespecialHandler.isThis(target);
if (istarget) {
if (InvokespecialHandler.isThis(target)) {
state.stack().push(
new Super(target, args, descriptor, type, name)
);
Expand All @@ -97,28 +96,33 @@ public void handle(final DecompilerState state) {
args
)
);

} else {
state.stack().push(
new Super(target, args, descriptor, type, name)
);
// state.stack().push(
// new Super(target, args, descriptor, type, name)
// );
}
}

//todo wtf?
/**
* Check if the target is a new address.
* @param target Where to check if it is a new address.
* @return True if the target is a new address.
* @todo #344:90min Remove ugly {{@link #isNewAddress(AstNode)}} method.
* We need to find a better algorithm to decompile Constructors and Super calls.
* The usage of 'instanceof' tells us about pure design decisions made before.
*/
private boolean isNewAddress(final AstNode target) {
final boolean result;
if (target instanceof NewAddress) {
return true;
result = true;
} else if (target instanceof Duplicate) {
return this.isNewAddress(((Duplicate) target).origin());
result = this.isNewAddress(((Duplicate) target).origin());
} else if (target instanceof Labeled) {
return this.isNewAddress(((Labeled) target).origin());
result = this.isNewAddress(((Labeled) target).origin());
} else {
return false;
result = false;
}
return result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/it/JeoAndOpeoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void compilesDecompiled(final String path) {
"xmir/disassembled/WebProperties$Resources$Chain$Strategy$Content.xmir",
"xmir/disassembled/OAuth2ClientRegistrationRepositoryConfiguration.xmir",
"xmir/disassembled/DefaultRouterFunctionSpec.xmir",
"xmir/disassembled/SpringBootExceptionHandler$LoggedExceptionHandlerThreadLocal.xmir",
"xmir/disassembled/SpringBootExceptionHandler$LoggedExceptionHandlerThreadLocal.xmir"
})
void decompilesCompilesAndKeepsTheSameInstructions(final String path) throws Exception {
final XMLDocument original = new XMLDocument(new BytesOf(new ResourceOf(path)).asBytes());
Expand Down

0 comments on commit cc85561

Please sign in to comment.