Patent ID: 8352925

Claim:
A machine implemented method for enabling a set of code intended to be executed on a first platform to be executed on a second and different platform, comprising: determining that a first portion of the set of code comprises an invocation of a first functionality that is provided by both the first and the second platforms, wherein invocation of the first functionality on the first platform results in a first behavior, and wherein invocation of the first functionality on the second platform results in a second behavior; in response to a determination that the first portion of the set of code comprises the invocation of the first functionality, altering the first portion of the set of code by: identifying a first helper functionality which, when invoked on the second platform, is configured to result in the first behavior, altering the invocation of the first functionality with an invocation of the first helper functionality to obtain a first altered portion of the set of code by: inserting the invocation of the first helper functionality into the first portion of the set of code at a position that is after the invocation of the first functionality, wherein the first functionality is configured to produce a result, and wherein the first helper functionality, when invoked, processes the result produced by the first functionality, wherein the first altered portion of the set of code, when executed on the second platform, produces the same result as the first portion of the set of code when executed unaltered on the first platform; determining that a second portion of the set of code comprises a reference to a class, wherein the class is replaced with a substitute class; and in response to a determination that the second portion of the set of code comprises the reference, altering the second portion of the set of code to replace the reference to the class with a reference to the substitute class.