Skip to content

Commit ab5c4bf

Browse files
committed
fix: more works on new exclusion system
1 parent de51ce1 commit ab5c4bf

File tree

7 files changed

+420
-80
lines changed

7 files changed

+420
-80
lines changed

dev.skidfuscator.obfuscator.pureanalysis/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ repositories {
1313

1414
dependencies {
1515
api project(':modasm')
16-
//api 'io.github.terminalsin:SSVM:dev-SNAPSHOT'
17-
api 'dev.xdark:ssvm-core:2.0.2'
18-
api 'dev.xdark:ssvm-invoke:2.0.2'
19-
api 'dev.xdark:ssvm-io:2.0.2'
16+
api 'io.github.terminalsin:SSVM:1.0.0-SNAPSHOT'
17+
//api 'dev.xdark:ssvm-core:2.0.2'
18+
//api 'dev.xdark:ssvm-invoke:2.0.2'
19+
//api 'dev.xdark:ssvm-io:2.0.2'
2020

2121
testImplementation platform('org.junit:junit-bom:5.10.0')
2222
testImplementation 'org.junit.jupiter:junit-jupiter'

dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/exempt/Exclusion.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
@Data
1414
@Builder
1515
public class Exclusion {
16-
private ExclusionMap testers;
16+
private final ExclusionMap testers;
17+
private final boolean include;
1718

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

27-
return testers.poll(ExclusionType.CLASS).test(classNode);
28+
boolean result = testers.poll(ExclusionType.CLASS).test(classNode);
29+
return include ? !result : result;
2830
}
2931

3032
/**
@@ -34,11 +36,12 @@ public boolean test(final ClassNode classNode) {
3436
* @return the boolean
3537
*/
3638
public boolean test(final MethodNode methodNode) {
37-
if (test(methodNode.getOwnerClass()))
39+
if (test(methodNode.getOwnerClass()) != include)
3840
return true;
3941

4042
assert testers.containsKey(ExclusionType.METHOD) : "Trying to test with null method tester";
41-
return testers.poll(ExclusionType.METHOD).test(methodNode);
43+
boolean result = testers.poll(ExclusionType.METHOD).test(methodNode);
44+
return include != result;
4245
}
4346

4447
/**
@@ -48,11 +51,12 @@ public boolean test(final MethodNode methodNode) {
4851
* @return the boolean
4952
*/
5053
public boolean test(final FieldNode fieldNode) {
51-
if (test(fieldNode.getOwnerClass()))
54+
if (test(fieldNode.getOwnerClass()) != include)
5255
return true;
5356

5457
assert testers.containsKey(ExclusionType.FIELD) : "Trying to test with null field tester";
55-
return testers.poll(ExclusionType.FIELD).test(fieldNode);
58+
boolean result = testers.poll(ExclusionType.FIELD).test(fieldNode);
59+
return include != result;
5660
}
5761

5862
@Override

dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/exempt/ExclusionHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,6 @@ public String toString() {
223223
});
224224
}
225225

226-
return new Exclusion(map);
226+
return new Exclusion(map, false);
227227
}
228228
}

0 commit comments

Comments
 (0)