What Classghost cannot do
Classghost has its limitations too. Classghosts features are restricted by the target virtual machine's implementation. The standard HotSpot VM for example will not allow you to change method signatures and change static attibutes.Most changes that are acceptable will have to be method local. While this may seem too much of a handicap at first, just think about it. Would it be a good idea if you could unrestrictedly change things ? Would it lead to more confusion rather than being a quick trick ?
Classghost0.9c onwards, you can check the target VM's capabilities, via the 'JVM Info' option.
Classghost will fail to inject new class files when :
- The VM implementation does not support method addition attempting to add a method will fail.
- The VM implementation does not support un-restricted class redefinition, attempting any of the following will fail
- changing the schema (the fields)
- changing the hierarchy (subclasses, interfaces)
- deleting a method
- changing class modifiers
- changing method modifiers
- The bytes don't correspond to the reference type (the names don't match).
- A "verifier" detects that a class, though well formed, contains an internal inconsistency or security problem.
- The bytes do not represent a valid class.
- A circularity has been detected while initializing a class.
- The major and minor version numbers in bytes are not supported by the VM.(like compiling with JSE 5 and injecting to 1.4)
- The VirtualMachine is read-only