Skip to content

Commit

Permalink
Small code style improvements in antireleak, zelix string
Browse files Browse the repository at this point in the history
  • Loading branch information
Janmm14 committed May 28, 2022
1 parent 887f058 commit d9b682f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,16 @@ private int inlineInvokeDynamic(int expected) {
@Override
public boolean instanceOf(JavaValue target, Type type, Context context) {
if (type.getDescriptor().equals("Ljava/lang/String;"))
if (!(target.value() instanceof String))
return false;
return target.value() instanceof String;
if (type.getDescriptor().equals("Ljava/lang/Integer;"))
if (!(target.value() instanceof Integer))
return false;
return target.value() instanceof Integer;
return true;
}

@Override
public boolean checkcast(JavaValue target, Type type, Context context) {
if (type.getDescriptor().equals("[C"))
if (!(target.value() instanceof char[]))
return false;
return target.value() instanceof char[];
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class StringEncryptionTransformer extends Transformer<TransformerConfig>
/**
* Contains a map of patched objects and their objects to null
*/
private Map<ClassNode, FieldNode> patched = new HashMap<>();
private final Map<ClassNode, FieldNode> patched = new HashMap<>();

@Override
public boolean transform() {
Expand Down Expand Up @@ -80,8 +80,7 @@ public boolean instanceOf(JavaValue target, Type type, Context context) {
@Override
public boolean checkcast(JavaValue target, Type type, Context context) {
if (type.getDescriptor().equals("[C"))
if (!(target.value() instanceof char[]))
return false;
return target.value() instanceof char[];
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public boolean transform() throws Throwable {
provider.register(new ComparisonProvider() {
@Override
public boolean instanceOf(JavaValue target, Type type, Context context) {
if (target.value() instanceof JavaObject && type.getInternalName().equals(((JavaObject) target.value()).type()))
return true;
if (target.value() instanceof JavaObject)
return type.getInternalName().equals(((JavaObject) target.value()).type());
return false;
}

Expand Down

0 comments on commit d9b682f

Please sign in to comment.