Computer Science ›› 2025, Vol. 52 ›› Issue (12): 32-39.doi: 10.11896/jsjkx.241200007

• Computer Software & Architecture • Previous Articles     Next Articles

Cross-procedure Feature Envy Detection Supporting Type-sensitive Scenarios

LI Jianhao, BAI Yaoyao, MI Jie, ZHANG Yingzhou, CAO Wenlong, WANG Dong, WANG Gang   

  1. School of Computer Science, Nanjing University of Posts and Telecommunications, Nanjing 210023, China
  • Received:2024-12-02 Revised:2025-03-28 Online:2025-12-15 Published:2025-12-09
  • About author:LI Jianhao,born in 2001,postgraduate,is a member of CCF(No.E4926G).His main research interest is program ana-lysis.
    ZHANG Yingzhou,born in 1978,professor,is a member of CCF(No.16845S).His main research interests include software formal analysis,program slicing,service computing and functional programming.
  • Supported by:
    This work was supported by the National Natural Science Foundation of China(62272214).

Abstract: The existence of feature envy phenomena can affect the stability and maintainability of the system.Current feature envy detection methods fail to consider the sensitivity of object types,leading to low detection accuracy.To address this issue,an inter-procedure feature envy detection method based on higher-order function is proposed.The method stores the computation process of the local reference ratios within a procedure with parameters as a summary in the form of higher-order function,according to predefined feature envy measurement rules.During inter-procedure detection,it retrieves the higher-order feature envy detection summary of the target method at the method call site.Based on the correlation between formal and actual parameters,the actual types of the formal parameters are substituted into the summary to compute the final local reference ratios set,which is used to detect the presence of feature envy and corresponding envy sets.The paper integrates several Java projects as a benchmark test set and selects the IntelliJDeodorant and IDE Inspection tools for comparison experiments.Results show that the proposed methodimproves detection accuracy for envy instances by 16.6% over IDE Inspection and by 1.3 times over IntelliJDeodorant.In terms of envy sets detection accuracy,it improves by 37.2% over IDE Inspection and by 1.6 times over IntelliJDeodorant.

Key words: Feature envy detection, Type-sensitive, Inter-procedure, High-order function, Function summary, Java

CLC Number: 

  • TP311
[1]FOWLER M,BECK K,BRANT J,et al.Refactoring:improving the design of existing code [M].Massachusetts:Addison-Wesley,1999.
[2]TAN T,MA X X,XU C,et al.Overview of Java Pointer Analysis[J].Journal of Computer Research and Development,2023,60(2):274-293.
[3]HU Z,HUGHES J,WANG M.How functional programming mattered[J].National Science Review,2015,2(3):349-370.
[4]ZHANG Y Z,ZHANG W F.Haskell:A Modern Purely Functional Programming Language[J].Journal of Nanjing University of Posts and Telecommunications(Natural Science),2007(4):13-18,23.
[5]FOKAEFS M,TSANTAILS N,CHATZIGEORGIOU A.JDe-odorant:Identication and Removal of Feature Envy Bad Smells[C]//Proceedings of the 23rd IEEE International Conference on Software Maintenance.IEEE,2007:519-520.
[6]SALES V,TERRA R,MIRANDA L F,et al.Recommending Move MethodRefactorings Using Dependency Sets[C]//Proceedings of the 20th Working Conference on Reverse Engineering.IEEE,2013:232-241.
[7]LIU D D,ZHAO F Y.Research on feature envy detection and refactoring[J].Electronic Science and Technology,2016,29(11):70-73.
[8]CHEN W K,LIU C H,LI B H.A feature envy detection method based on dataflow analysis[C]//IEEE 42nd Annual Computer Software and Applications Conference.IEEE,2018:14-19.
[9]SKIPINA M,SLIVKA J,LUBURIC N,et al.Automaticdetection of Feature Envy and Data Class code smells using machine learning[J].Expert Systems With Applications,2024,243:122855.
[10]PRIYAMBADHA B,KATAYAMA T,KITA Y,et al.Detection of Blob and Feature Envy Smells in a Class Diagram using Class’s Features[J].Journal of Robotics,Networking and Artificial Life,2022,9(1):43-48.
[11]LIU B,LIU H,LI G J,et al.Deep Learning Based Feature Envy Detection Boosted by Real-World Examples[C]//Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering.ACM,2023:908-920.
[12]AL-FRAIHAT D,SHARRAB Y,AL-GHUWAIRI A R,et al.Detecting and resolving feature envy throughautomatedmachine learning and move method refactoring[J].International Journal of Electrical & Computer Engineering,2024,4(2):2330-2343.
[13]YU D J,XU Y H,WENG L H,et al.Efficient feature envy detection and refactoring based ongraphneural network[J].Automated Software Engineering,2025,32(1).
[14]GRUJIC K G,PROKIC S,KOVACEVIC A,et al.MachineLearning Approaches for Code Smell Detection:A Systematic Literature Review[J/OL].Social Science Research Network,2022.https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4299859.
[15]LEWOWSKI T,MADEYSKI L.Code smells detection using artificial intelligence techniques:A business-driven systematic review[M]//Studies in Systems,Decision and Control.2021:285-319.
[16]BLOCH J.Effective Java[M].Beijing:Posts & Telecom Press,2024.
[1] SONG Enzhou, HU Tao, YI Peng, WANG Wenbo. PDF Malicious Indicators Extraction Technique Based on Improved Symbolic Execution [J]. Computer Science, 2024, 51(7): 389-396.
[2] LU Ling, ZHOU Zhide, REN Zhilei, JIANG He. Category-directed Fuzzing Test Method for Error Reporting Mechanism in JavaScript Engines [J]. Computer Science, 2023, 50(12): 49-57.
[3] SUN Zhi-gang, WANG Guo-tao, JIANG Ai-ping, GAO Meng-meng, LIU Jin-gang. Monitoring System of Traffic Safety Based on Information Fusion Technology [J]. Computer Science, 2020, 47(11A): 642-650.
[4] QIN Meng-na, CHEN Jun-jie, GUO Hao. Multi-feature Fusion Classification Method Based on High-order Minimum Spanning Tree Brain Network [J]. Computer Science, 2018, 45(7): 293-298.
[5] WANG Pan-zao. Research on Intelligent Maps Navigation System Based on Location Service [J]. Computer Science, 2017, 44(Z6): 575-576.
[6] SUN Ya-jing, ZHAO Xu, YAN Xue-xiong and WANG Qing-xian. Data Leakage Oriented Testing Method for Web Sandbox [J]. Computer Science, 2017, 44(Z11): 322-328.
[7] WEI Miao, WU Yi-jian, SHEN Li-wei, PENG Xin and ZHAO Wen-yun. Finding Type Mismatch Defects of JavaScript Based on Static Analysis [J]. Computer Science, 2017, 44(4): 223-228.
[8] GONG Wei-gang, YOU Wei, LI Zan, SHI Wen-chang and LIANG Bin. JavaScript Counterfactual Execution Method Based on Dynamic Instrumentation [J]. Computer Science, 2017, 44(11): 22-26.
[9] WU Wei-min, LIN Shui-ming and LIN Zhi-yi. Chaotic-based Opaque Predicate Control Flow Flatten Algorithm [J]. Computer Science, 2015, 42(5): 178-182.
[10] ZENG Yi, LI Han-yu, LIU Hui-jun, YU Shuang-shuang and ZHOU Bo. Consistency Detection Method between UML Model and Java Source Code [J]. Computer Science, 2015, 42(4): 151-155.
[11] ZHANG Yang, ZHANG Dong-wen and QIU Jing. Automated Refactoring Framework for Java Locks [J]. Computer Science, 2015, 42(11): 84-89.
[12] FU Teng and GAO Jian-hua. Metadata Checking and Testing of Web Application Based on Invariance [J]. Computer Science, 2014, 41(8): 224-228.
[13] CHEN Xiao-yu,HUANG Zhen,LIU Xuan-zhe,HUANG Gang and ZHANG Ying. Scratch:Tooling Support for Capture-and-replay of User Actions in Chrome Browser [J]. Computer Science, 2014, 41(11): 112-117.
[14] CUI Li-qun and ZHANG Ming-jie. Design and Research of Embedded Thin Web Server [J]. Computer Science, 2013, 40(Z6): 236-238.
[15] SI Biao. Exam System Modelling Research Based on MVC [J]. Computer Science, 2013, 40(Z6): 403-406.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!