This is needed for JSB.
Since `dynamic_cast` will not work if a class has no virtual function.