计算机科学 ›› 2024, Vol. 51 ›› Issue (11A): 230900121-10.doi: 10.11896/jsjkx.230900121
钟林辉1, 祝艳霞1,2, 黄琪轩1, 屈乔乔1, 夏子豪1, 郑燚1
ZHONG Linhui1, ZHU Yanxia1,2, HUANG Qixuan1, QU Qiaoqiao1, XIA Zihao1, ZHENG Yi1
摘要: 针对API调用模式缺乏结构信息及结果高冗余等问题,提出了基于扩展的分支保留调用图(the Extended Branch-Reserving Call Graph,EBRCG)的API结构模式信息增强方法。以Java开源项目源代码为研究对象,使用EBRCG来表示Java类的方法的结构信息,在EBRCG中,同时考虑了API调用语句、分支语句(将if语句和所有循环语句视为分支语句)、switch-case多分支语句、异常语句等,并提出了EBRCG裁剪算法来获取特定API调用模式的代码结构。同时,采用聚类和排序的方法对API调用模式的多个代码结构信息进行筛选,最终选择具有代表性的API调用模式的代码结构。为验证该方法的效果,将该方法与TextRank方法进行了3组实验比较。结果显示,该方法能有效地获取API调用模式的代码结构,相比TextRank方法能更准确地描述API的使用,有一定的研究意义,并为软件开发人员提供了参考。
中图分类号:
[1]DE ROOVER C,LÄMMEL R,PEK E.Multi-dimensional ex-ploration of api usage[C]//2013 21st International Conference on Program Comprehension(ICPC).IEEE,2013:152-161. [2]LIZ,WU J Z,LI M S.Study on Key Issues in API Usage[J].Journal of Software,2018,29(6):1716-1738. [3]KO A J,MYERS B A,AUNG H H.Six learning barriers in end-user programming systems[C]//2004 IEEE Symposium on Vi-sual Languages-Human Centric Computing.IEEE,2004:199-206. [4]PARNAS D L,MADEY J,IGLEWSKIM.Precise documentation of well-structured programs[J].IEEE Transactions on Software Engineering,1994,20(12):948-976. [5]ROBILLARD M P,DELINE R.A field study of API learning obstacles[J].Empirical Software Engineering,2011,16:703-732. [6]LAZAR D,CHEN H,WANG X,et al.Why does cryptographic software fail? A case study and open problems[C]//Proceedings of 5th Asia-Pacific Workshop on Systems.2014:1-7. [7]EGELE M,BRUMLEY D,FRATANTONIO Y,et al.An em-pirical study of cryptographic misuse in android applications[C]//Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security.2013:73-84. [8]GEORGIEV M,IYENGAR S,JANA S,et al.The most dangerous code in the world:validating SSL certificates in non-browser software[C]//Proceedings of the 2012 ACM Conference on Computer and Communications Security.2012:38-49. [9]FAHL S,HARBACH M,PERLH,et al.Rethinking SSL development in an appified world[C]//Proceedings of the 2013 ACM SIGSAC Conference on Computer & Communications Security.2013:49-60. [10]ROBILLARD M P,BODDEN E,KAWRYKOWD,et al.Auto-mated API property inference techniques[J].IEEE Transactions on Software Engineering,2012,39(5):613-637. [11]NIU H,KEIVANLOO I,ZOU Y.API usage pattern recommendation for software development[J].Journal of Systems and Software,2017,129:127-139. [12]WANG J,DANG Y,ZHANG H,et al.Mining succinct andhigh-coverage API usage patterns from source code[C]//2013 10th Working Conference on Mining Software Repositories(MSR).IEEE,2013:319-328. [13]ZHONG H,XIE T,ZHANG L,et al.MAPO:Mining and recommending API usage patterns[C]//23rd European Conference(ECOOP 2009).Genoa,Italy,Springer Berlin Heidelberg,2009:318-343. [14]FOWKES J,SUTTON C.Parameter-free probabilistic API mi-ning across GitHub[C]//Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering.2016:254-265. [15]ACHARYA M,XIE T,PEI J,et al.Mining API patterns as partial orders from source code:from usage scenarios to specifications[C]//Proceedings of the the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering.2007:25-34. [16]ZHAO W,ZHANG L,LIU Y,et al.SNIAFL:towards a static non-interactive approach to feature location[C]//International Conference of Software Engineering.ICSE,2004. [17]TREUDE C,ROBILLARD M P.Augmenting API documenta-tion with insights from stack overflow[C]//Proceedings of the 38th International Conference on Software Engineering.2016:392-403. [18]WU Y C,MAR L W,JIAUH C.Codocent:Support API usage with code example and API documentation[C]//2010 Fifth International Conference on Software Engineering Advances.IEEE,2010:135-140. [19]HOFFMAN D,STROOPER P.API documentation with execut-able examples[J].Journal of Systems and Software,2003,66(2):143-156. [20]STYLOS J,FAULRING A,YANG Z,et al.Improving API do-cumentation using API usage information[C]//2009 IEEE Symposium on Visual Languages and Human-Centric Computing(VL/HCC).IEEE,2009:119-126. [21]SUBRAMANIAN S,INOZEMTSEVA L,HOLMES R.LiveAPI documentation[C]//Proceedings of the 36th International Conference on Software Engineering.2014:643-652. [22]CHEN C,ZHANG K.Who asked what:Integrating crowd-sourced faqs into api documentation[C]//Companion Proceedings of the 36th International Conference on Software Engineering.2014:456-459. [23]KIM J,LEE S,HWANGS W,et al.Enriching documents with examples:A corpus mining approach[J].ACM Transactions on Information Systems(TOIS),2013,31(1):1-27. [24]MOVER S,SANKARANARAYANAN S,OLSENR B P,et al.Mining framework usage graphs from app corpora[C]//2018 IEEE 25th International Conference on Software Analysis,Evolution and Reengineering(SANER).IEEE,2018:277-289. [25]ZHANG J,JIANG H,REN Z,et al.Enriching API documentation with code samples and usage scenarios from crowd know-ledge[J].IEEE Transactions on Software Engineering,2019,47(6):1299-1314. [26]FENG X,YANG Q H.The Collaborative Filtering Algorithmfor Information Enhancement Combined with Knowledge Graph[J].Journal of Jiangxi Normal University:Natural Science Edition,2022,46(4):386-393.(in Chinese) 冯祥,杨庆红.结合知识图谱进行信息强化的协同过滤算法[J].江西师范大学学报(自然科学版) ,2022,46(4):386-393. [27]HARTIGAN J A,WONGM A.Algorithm AS 136:A k-meansclustering algorithm[J].Journal of the Royal Statistical Society.Series C(Applied Statistics),1979,28(1):100-108. [28]SALVADOR S,CHAN P.Determining the number of clusters/segments in hierarchical clustering/segmentation algorithms[C]//16th IEEE International Conference on Tools with Artificial Intelligence.IEEE,2004:576-584. [29]ROUSSEEUW P J.Silhouettes:a graphical aid to the interpretation and validation of cluster analysis[J].Journal of Computational and Applied Mathematics,1987,20:53-65. [30]KIM J,LEE S,HWANGS W,et al.Enriching documents with examples:A corpus mining approach[J].ACM Transactions on Information Systems(TOIS),2013,31(1):1-27. [31]ZHONG L H,QI J,YE H T,et al.The Study on the Method for Matching the Software Evolutionary Style Based on Multi-Dimensional Evolutionary Tree[J].Journal of Jiangxi Normal University:Natural Science Edition,2021,45(1):55-59.(in Chinese) 钟林辉,齐杰,叶海涛,等.基于多维属性演化树的软件演化风格匹配方法研究[J].江西师范大学学报(自然科学版),2021,45(1):55-59. |
|