Reflection enables a Java program to analyze and modify itself. In particular, a program can discover the values of field variables and change them [Forman 05], [Sun 02]. The Java reflection API includes a method that enables fields that are normally inaccessible to be accessed under reflection. The following code prints out the names and values of all fields of an object someObject
of class SomeClass
:
...
The following table lists the APIs that should be used with care [SCG 2009].
APIs that mirror language checks |
---|
|
|
|
|
|
|
|
|
...
Reflection can be used on Android so the rule is applicable. Also the use of reflection may allow a developer to access private Android APIs and so requires caution.
Bibliography
|
...