Question

To implement things like canceling calls, clearing missed call notifications ,disabling notification LED and other such complex functionalities I have to rely heavily on Reflection. Will it effect my app in a long run?

Was it helpful?

Solution

The main disadvantages of refelections are

It is Slow

reflection involves types that are dynamically resolved, certain Java virtual machine optimizations can not be performed. Consequently, reflective operations have slower performance than their non-reflective counterparts, and should be avoided in sections of code which are called frequently in performance-sensitive applications.

Fragile

Reflective code is more fragile in the face of API changes.

Security Issues

You can't allow non-trusted code to use reflection.

Testing Problems

More thorough testing and debugging is required because you are replacing compile-time type checking with run-time type checking.

Exposure of Internals

By using reflection you can access private class members which are not permitted to use using non reflection methods. the use of reflection can result in unexpected side-effects, which may render code dysfunctional and may destroy portability.

In your cases I think the problems should be, slow, fragile and testing problems If the above problems don't bother you then you are free to use reflections in your app.

link1,link2,link3

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top