A method and computer readable medium for automatic replacement of object
classes in a library with custom classes to improve program efficiency.
The method begins with static analysis preformed on a program containing
a plurality of objects in order to determine type-correctness constraints
and to detect unused functionality in one or more of the objects to be
replaced. The plurality of objects is instrumented to detect usage
patterns of functionality in one or more objects. Customized classes are
generated based upon the static analysis and usage patterns detected.
Bytecode is rewritten which is used for generating classes. The present
invention provides transparency in the replacement of the objects.