1. A computer program product comprising one or more physical storage devices having thereon computer-executable instructions that are structured such that, when executed by one or more processors of a computing system, cause the computing system to perform a method for identifying open types of an input program that is to be optimized prior to runtime, the method comprising acts of: inputting at an invasion analysis component an input program that is to be optimized prior to runtime the input program including a plurality of functions and a plurality of object types used by one or more of the functions; the invasion analysis component automatically identifying an initial set of open types without using annotations of open types in the input program by identifying an initial set of invading types of objects constructed outside the input program which enter the input program in one or more ways; the invasion analysis component then automatically performing one or more iterations using the initial set of invading to continue identifying further invading types and adding the identified further invading types to the initial set of invading types until no further invading types are found; and sending a final set of open types that correspond to the set of all invading types identified by the iterations performed by the invasion analysis component to an optimizer that uses the identified open types to optimize the input program prior to runtime.