Make NewInstanceTransformer idempotent

master
Graham 5 years ago
parent 320a8a7f8a
commit d5cee1b2f5
  1. 6
      deob-ast/src/main/java/dev/openrs2/deob/ast/transform/NewInstanceTransformer.kt

@ -13,10 +13,14 @@ class NewInstanceTransformer : Transformer() {
}
expr.scope.ifPresent { scope ->
if (!scope.isMethodCallExpr || scope.asMethodCallExpr().nameAsString != "getConstructor") {
if (!scope.isMethodCallExpr || scope.asMethodCallExpr().nameAsString !in CONSTRUCTOR_METHODS) {
expr.setScope(MethodCallExpr(scope.clone(), "getDeclaredConstructor"))
}
}
}
}
companion object {
val CONSTRUCTOR_METHODS = setOf("getConstructor", "getDeclaredConstructor")
}
}

Loading…
Cancel
Save