Skip to content

Commit

Permalink
fix: more works on new exclusion system
Browse files Browse the repository at this point in the history
  • Loading branch information
terminalsin committed Dec 18, 2024
1 parent de51ce1 commit ab5c4bf
Show file tree
Hide file tree
Showing 7 changed files with 420 additions and 80 deletions.
8 changes: 4 additions & 4 deletions dev.skidfuscator.obfuscator.pureanalysis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ repositories {

dependencies {
api project(':modasm')
//api 'io.github.terminalsin:SSVM:dev-SNAPSHOT'
api 'dev.xdark:ssvm-core:2.0.2'
api 'dev.xdark:ssvm-invoke:2.0.2'
api 'dev.xdark:ssvm-io:2.0.2'
api 'io.github.terminalsin:SSVM:1.0.0-SNAPSHOT'
//api 'dev.xdark:ssvm-core:2.0.2'
//api 'dev.xdark:ssvm-invoke:2.0.2'
//api 'dev.xdark:ssvm-io:2.0.2'

testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
@Data
@Builder
public class Exclusion {
private ExclusionMap testers;
private final ExclusionMap testers;
private final boolean include;

/**
* Test if a class is to be excluded
Expand All @@ -24,7 +25,8 @@ public class Exclusion {
public boolean test(final ClassNode classNode) {
assert testers.containsKey(ExclusionType.CLASS) : "Trying to test with null class tester";

return testers.poll(ExclusionType.CLASS).test(classNode);
boolean result = testers.poll(ExclusionType.CLASS).test(classNode);
return include ? !result : result;
}

/**
Expand All @@ -34,11 +36,12 @@ public boolean test(final ClassNode classNode) {
* @return the boolean
*/
public boolean test(final MethodNode methodNode) {
if (test(methodNode.getOwnerClass()))
if (test(methodNode.getOwnerClass()) != include)
return true;

assert testers.containsKey(ExclusionType.METHOD) : "Trying to test with null method tester";
return testers.poll(ExclusionType.METHOD).test(methodNode);
boolean result = testers.poll(ExclusionType.METHOD).test(methodNode);
return include != result;
}

/**
Expand All @@ -48,11 +51,12 @@ public boolean test(final MethodNode methodNode) {
* @return the boolean
*/
public boolean test(final FieldNode fieldNode) {
if (test(fieldNode.getOwnerClass()))
if (test(fieldNode.getOwnerClass()) != include)
return true;

assert testers.containsKey(ExclusionType.FIELD) : "Trying to test with null field tester";
return testers.poll(ExclusionType.FIELD).test(fieldNode);
boolean result = testers.poll(ExclusionType.FIELD).test(fieldNode);
return include != result;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,6 @@ public String toString() {
});
}

return new Exclusion(map);
return new Exclusion(map, false);
}
}
Loading

0 comments on commit ab5c4bf

Please sign in to comment.