Patent ID: 7415021

Claim:
A method for moving an original programmatic-method from a source class to a destination class and for constructing a corresponding forwarding programmatic-method in the source class that preserves null semantics, the method comprising: translating the original programmatic-method from the source class into a corresponding moved programmatic-method; incorporating the moved programmatic-method into the destination class; constructing a forwarding programmatic-method that invokes the moved programmatic-method in the destination class; and replacing the original programmatic-method in the source class with the forwarding programmatic-method, whereby invoking the forwarding programmatic-method in the source class causes the moved programmatic-method to be invoked in the destination class; wherein constructing the forwarding programmatic-method involves, generating code that checks whether a “source parameter” of the original programmatic-method whose class matches the destination class is null, and if so, executes the body of the original programmatic-method, and otherwise invokes the moved programmatic-method in the destination class, and optimizing the generated code to produce optimized code for the forwarding programmatic-method, whereby portions of the original programmatic-method can possibly be optimized away.