Reflection – is the ability of a computer program to examine, introspect, and modify its own structure and behavior at runtime.
Reflection can be used for observing and modifying program execution at runtime.
ProGuard will already detect and handle the following cases.
Class.forName("SomeClass") SomeClass.class SomeClass.class.getField("someField") SomeClass.class.getDeclaredField("someField") SomeClass.class.getMethod("someMethod", new Class[] {}) SomeClass.class.getMethod("someMethod", new Class[] { A.class }) SomeClass.class.getMethod("someMethod", new Class[] { A.class, B.class }) SomeClass.class.getDeclaredMethod("someMethod", new Class[] {}) SomeClass.class.getDeclaredMethod("someMethod", new Class[] { A.class }) SomeClass.class.getDeclaredMethod("someMethod", new Class[] { A.class, B.class }) AtomicIntegerFieldUpdater.newUpdater(SomeClass.class, "someField") AtomicLongFieldUpdater.newUpdater(SomeClass.class, "someField") AtomicReferenceFieldUpdater.newUpdater(SomeClass.class, SomeType.class, "someField")
Constructs should be literally the same for ProGuard to recognize them.
For example ProGuard will note constructs:
(SomeClass)Class.forName(variable).newInstance()