I am trying to use a simple pattern matching analysis to find all Factory Methods in a program? Currently, I just set some simple conditions for a method m: 1. the return type of m is not null, and also not a primary type; 2. the return statement of m gives a value which gets a new expression in this method.
Using above conditions, I could get many candidate methods for Factory Method. But obviously, the conditions are not enough. Any other condition can be added to get more accurate factory methods.
Thanks.