摘要: 为满足日益复杂的软件需求,开发人员需要通过代码提示工具来辅助完成开发任务,但现有代码提示工具在推荐包含静态方法的代码片段时存在空间爆炸问题。为此,提出一种基于程序环境信息的代码片段推荐方法。结合可达性分析进行推荐能够有效削减静态方法入口点,在避免空间爆炸的同时,还可以准确、有效地描述程序环境信息。基于该方法实现在Eclipse 中的代码推荐插件,并对Tomcat 源码进行实验验证。实验结果表明,该方法可实现静态方法的代码片段推荐,与Eclipse Code Recommenders 插件中的推荐方法相比,能获得更准确的推荐结果。
关键词:
静态方法,
代码片段,
语义网规则语言,
可达性分析,
代码推荐,
排序
Abstract: As the software requirement becoming more and more complicated, developers have an increasing
dependency on the code recommendation tools to assist their development tasks,while current code recommendation tools can not provide efficient recommendation for static methods. In order to recommend code snippet including static methods in a faster and more accurate mean,this paper proposes code snippet recommendation method based on program context combing with the reachability analysis, which solves the space explosion problem during the static method recommendation well,and it can also describe the program context accurately and effectively. Based on the proposed method,a code recommendation Eclipse plugin is implemented,and a corresponding experiment on Tomcat source code is conducted. Experimental results show that,the proposed method not only owns the capability of recommending code snippet with static method,but also has a higher accuracy compared with the recommendation method of Eclipse Code Recommenders.
Key words:
static method,
code snippet,
Semantic Web Rule Language ( SWRL ),
reachability analysis,
code
recommendation,
ranking
中图分类号:
贾翕,于海波,方璐. 结合可达性分析的代码片段推荐[J]. 计算机工程.
JIA Xi,YU Haibo,FANG Lu. Code Snippet Recommendation Combining with Reachability Analysis[J]. Computer Engineering.