Abstract:
Internal getter or setter method is a type of Android-specific code smell. It decreases the performance and increases the energy consumption of Android applications. In this paper, a detection method based on traditional machine learning is proposed to identify this type of code smell. Program text information was used as the feature set for smell detection purpose, and five traditional machine learning models were used to identify this type of smell. A new feature selection algorithm called LGM_SU was provided to improve the detection accuracy by removing the irrelevant features. In addition, to provide the massive labeled data required for the traditional machine learning models automatically, an approach was proposed to construct positive and negative samples based on Android projects, and ASSD tool was realized. The proposed approach was evaluated on real-world Android datasets. The results show that the proposed approach outperforms the current methods based on program static analysis, especially the F1 value was greatly improved by 16.9%. In addition, the detection effects are different on Android-specific smells and object-oriented smells by traditional machine learning algorithms.