Skip to content

Commit 2243a03

Browse files
committed
fix: Reduce redundant remap output
1 parent 6e2394b commit 2243a03

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

src/main/java/rs/lostcity/deob/ast/transform/ProduceMapTransformer.java

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ public void transformUnit(CompilationUnit unit) {
6464

6565
// todo: detect inner classes
6666
walk(unit, ClassOrInterfaceDeclaration.class, clazz -> {
67-
/*if (clazz.getNameAsString().startsWith("class")) {
67+
if (
68+
clazz.getNameAsString().toLowerCase().startsWith("class")
69+
) {
6870
return;
69-
}*/
71+
}
7072

7173
String foundClass = getOriginalName(clazz.getAnnotations(), true);
7274
if (foundClass != null) {
@@ -87,15 +89,35 @@ public void transformUnit(CompilationUnit unit) {
8789
} */
8890

8991
final String originalClass = foundClass;
92+
if (originalClass == null) {
93+
return;
94+
}
9095

9196
clazz.getFields().forEach(field -> {
9297
String fieldName = field.getVariables().get(0).getNameAsString();
93-
/*if (fieldName.startsWith("field")) {
98+
if (
99+
fieldName.startsWith("field") ||
100+
fieldName.startsWith("aFloat") ||
101+
fieldName.startsWith("aDouble") ||
102+
fieldName.startsWith("aLong") ||
103+
fieldName.startsWith("anInt") ||
104+
fieldName.startsWith("aShort") ||
105+
fieldName.startsWith("aByte") ||
106+
fieldName.startsWith("aBoolean") ||
107+
fieldName.startsWith("aClass") ||
108+
fieldName.startsWith("anObject") ||
109+
fieldName.startsWith("aFrame") ||
110+
fieldName.startsWith("anImage") ||
111+
fieldName.startsWith("aColor")
112+
) {
94113
return;
95-
}*/
114+
}
96115

97116
String originalName = getOriginalName(field.getAnnotations(), false);
98-
if (originalName == null) {
117+
if (
118+
originalName == null ||
119+
fieldName.equals(originalName)
120+
) {
99121
return;
100122
}
101123

@@ -108,12 +130,15 @@ public void transformUnit(CompilationUnit unit) {
108130

109131
clazz.getMethods().forEach(method -> {
110132
String memberName = method.getNameAsString();
111-
/*if (memberName.startsWith("method")) {
133+
if (memberName.startsWith("method")) {
112134
return;
113-
}*/
135+
}
114136

115137
String originalName = getOriginalName(method.getAnnotations(), true);
116-
if (originalName == null) {
138+
if (
139+
originalName == null ||
140+
(originalClass + "." + memberName).equals(getOriginalName(method.getAnnotations(), false))
141+
) {
117142
return;
118143
}
119144

0 commit comments

Comments
 (0)