While abstracts don’t exist at runtime, their @:from
and @:to
functions still need to exist. I’m writing a library that needs to access those functions through reflection.
It seems that most targets can access an abstract’s implementation class at run-time by passing the appropriate string to Type.resolveClass()
, like this:
var c = Type.resolveClass("com.example._MyAbstract.MyAbstract_Impl_");
This seems to work for most targets without any special flags or defines. I’ve tried in Neko, HashLink, and Flash so far with success. However, for JavaScript, it does not resolve. Looking at the generated code, it appears that the abstract implementation class is created, but it is never added to $hxClasses
where Type.resolveClass()
searches. I also tried -D js-es=6
, but the generated ES6 code doesn’t make the class available to reflection either.
Is there another API that I can use instead of Type.resolveClass()
? Or is there an optional define available that will enable Type.resolveClass()
to work on the js target to find abstract implementation classes the same as it does other targets?