We have a global apex interface in a managed package that enables a subscriber org to transform a field value during a calculation in our package.
global interface CustomCallable {
Object execute(String input);
}
We include the Interface in our logic like this:
public Object transform(String value, String className) {
Type rawTransformator = Type.ForName(className);
CustomCallable castedTransformator = (CustomCallable) rawTransformator.newInstance();
return castedTransformator.execute(value);
}
Since the latest critical update we receive the error message:
{"errorMessage":"Interface Run Initialization has failed, Interface Type not correctly configured, Could not instantiate class: System.TypeException: MyCustomClassName does not have a no-arg constructor\n(System Code)\n\n\n\n\n\n\n\n\n\n"}
The critical update information states:
Also, regardless of API version, construction of abstract classes or interfaces is no longer allowed even when the type is visible and can be referenced using Type.forName.
- Is my interpretation correct that indeed the logic we used to include custom apex into our package should be prevented by this update?
- Do you have any suggestion for a workaround that can be used?