Determines if the given method is a factory method.
Determines if the given method is a factory method. Any native method is considered as factory method, because we have to assume, that it creates an instance of the class. This checks not for effective factory methods, since the return type of the method is ignored. A method is either native or the constructor of the declaring class is invoked.
Possible improvements:
This analysis identifies a project's factory methods.
A method is no factory method if:
This information is relevant in various contexts, e.g., to determine the instantiability of a class.
Usage
Use the FPCFAnalysesManagerKey to query the analysis manager of a project. You can run the analysis afterwards as follows:
val analysisManager = project.get(FPCFAnalysisManagerKey) analysisManager.run(FactoryMethodAnalysis)For detailed information see the documentation of the analysis manager.
The results of this analysis are stored in the property store of the project. You can receive the results as follows:
Native methods are considered as factory methods because they might instantiate the class.