File tree 2 files changed +18
-1
lines changed
dev.skidfuscator.obfuscator/src/main/java/dev/skidfuscator/obfuscator/transform/impl/misc
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ allprojects {
23
23
testImplementation ' org.junit.jupiter:junit-jupiter-api:5.9.0'
24
24
testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.9.0'
25
25
}
26
+
27
+ compileJava {
28
+ options. encoding = " UTF-8" // Will fail on the non-ascii comments if not set
29
+ }
26
30
}
27
31
28
32
group ' dev.skidfuscator.community'
Original file line number Diff line number Diff line change 26
26
import java .util .Arrays ;
27
27
import java .util .List ;
28
28
import java .util .Stack ;
29
+ import java .util .concurrent .ThreadLocalRandom ;
30
+ import java .util .stream .Collectors ;
29
31
30
32
public class AhegaoTransformer extends AbstractTransformer {
33
+
34
+ private static final String DEFAULT_AHEGAO_FIELD_NAME = "nothing_to_see_here" ;
35
+
31
36
public AhegaoTransformer (Skidfuscator skidfuscator ) {
32
37
super (skidfuscator , "Ahegao" );
33
38
}
@@ -43,9 +48,17 @@ void handle(final FinalClassTransformEvent event) {
43
48
return ;
44
49
}
45
50
51
+ List <String > fieldNames = classNode .getFields ().stream ()
52
+ .map (FieldNode ::getName )
53
+ .collect (Collectors .toList ());
54
+
55
+ String ahegaoName = DEFAULT_AHEGAO_FIELD_NAME ;
56
+ while (fieldNames .contains (ahegaoName ))
57
+ ahegaoName += (char ) ThreadLocalRandom .current ().nextInt (Character .MAX_CODE_POINT );
58
+
46
59
final FieldNode mapleNode = new SkidFieldNodeBuilder (skidfuscator , classNode )
47
60
.access (Opcodes .ACC_PRIVATE | Opcodes .ACC_STATIC )
48
- .name ("nothing_to_see_here" )
61
+ .name (ahegaoName )
49
62
.desc ("[Ljava/lang/String;" )
50
63
.signature (null )
51
64
.value (null )
You can’t perform that action at this time.
0 commit comments