Class Open Warnings
Some classes cannot be automatically and reliably obfuscated or have any names changed.
Examples are classes that use the Java Reflection API by hardcoding package, class, field or method names in a string and then
at runtime
- test a class, field or method's name against that string
- create Class, Field, Method or Constructor instances using that string
Zelix KlassMaster can automatically handle many simple Reflection API calls. However, if Zelix KlassMaster opens a class that it might not be able to automatically process reliably then
it reports the fact using the "Class Open Warnings" screen.
You may get the "Class Open Warnings" screen if an opened class contains a call
to one or more of the following methods:
- Class.forName(String)
- Class.getName()
- Class.getField(String)
- Class.getMethod(String)
- Class.getDeclaredField(String)
- Class.getDeclaredMethod(String)
- Field.getName()
- Method.getName()
- Constructor.getName()
- ClassLoader.loadClass(String,boolean)
- ClassLoader.defineClass()
- ClassLoader.findSystemClass(String)
- ClassLoader.findLoadedClass(String)
- RMIClassLoader.loadClass(String)
- RMIClassLoader.loadClass(URL, String)
- LoaderHandler.loadClass(String)
- LoaderHandler.loadClass(URL, String)
- EventSetDescriptor(Class, String, Class, String)
- EventSetDescriptor(Class, String, Class, String[], String, String)
- EventSetDescriptor(Class, String, Class, String[], String, String, String)
|
|
Note that the "Class Open Warnings" screen shows:
- the name of the class that contains the Java Reflection API method call and
- the signature of the method that contains the Reflection API method call and
- the signature of the Reflection API method call that was detected.
Note that it does not show the name of the class, field or method that is being accessed by its name.
Of course it cannot do that because the Reflection API call could not be fully analyzed.
Zelix KlassMaster may still be able to automatically process classes that are listed in the Open Warnings.
For example, calls to Class.getName() are often made for debugging purposes and can be ignored. Also, in certain situations,
Zelix KlassMaster can change the contents of a string containing a class name to match the new class name.
Zelix KlassMaster can do this only if:
- the string is stored as an unencrypted string constant within an opened class file
(as opposed, for example, to being read from a file) and
- the fully qualified old class name:
- is at least three characters long
- contains at least one alpha character
- contains the package separator character "."
In any case, the user must look at the way the call is used to determine if the class can be reliably automatically processed. If necessary, you should explicity exclude the name of the
class, field or method, that is being accessed by its name, from being changed. You do this by using either the Obfuscation Name Exclusions dialog or
the ZKM Script exclude statement.
|