was setting the custom state too late. nice catch Babbaj
@@ -70,13 +70,14 @@ public abstract class ClassTransformer implements ASMCommon, TypesMc {
}
public final void transform(final ClassNode node) {
- for(final MethodNode methodNode : node.methods) methodTransformers.stream()
+ RuntimeState.setState(getClassObfuscationState());
+ try {
+ for (final MethodNode methodNode : node.methods)
+ methodTransformers.stream()
.filter(t -> Objects.equals(t.getMethod().getRuntimeName(), methodNode.name)
&& Objects.equals(t.getMethod().getRuntimeDescriptor(), methodNode.desc)
)
.forEach(t -> t.getTasks().forEach(task -> {
- // set obfuscation state
- RuntimeState.setState(getClassObfuscationState());
try {
task.getMethod().invoke(t, methodNode);
// if we have gotten this far the transformation should have been successful
@@ -102,9 +103,10 @@ public abstract class ClassTransformer implements ASMCommon, TypesMc {
builder.append(e.getMessage());
LOGGER.error(builder.toString());
printStackTrace(e);
+ }
+ }));
} finally {
RuntimeState.releaseState();
}
- }));
}
}
