Patent ID: 7873592

Claim:
A type inference system for selecting a specific method invocation when a generic method is specified in program code, the system comprising: a processor; and memory storing computer executable instructions which when executed by the processor perform the following: receive program code that invokes a generic method without specifying the type of each of a plurality of input parameters of the generic method; analyze each of the plurality of input parameters to infer a candidate set of types to which the input parameters could be resolved; determine that a first input parameter's type could be resolved to a plurality of different types; after inferring the type of the other one or more input parameters, determine that the first input parameter's type could still be resolved to two or more different types based on the inferred type of the other one or more input parameters; determine a method return type specified in the generic method invocation, infer the first input parameter's type based on the inferred type of one or more of the other input parameters and based on the return type specified in the generic method invocation, wherein the type of the first parameter is inferred such that the set of inferred types for the plurality of parameters is valid for one of the specific method invocations pertaining to the generic method and such that the valid specific method invocation has a return type that matches the return type specified in the generic method; and select the valid specific method invocation to be used in the program code in place of the generic method invocation.