作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程

• 体系结构与软件技术 • 上一篇    下一篇

结合可达性分析的代码片段推荐

贾 翕,于海波,方 璐   

  1. (上海交通大学软件学院,上海200240)
  • 收稿日期:2013-12-01 出版日期:2014-11-15 发布日期:2014-11-13
  • 作者简介:贾 翕(1991 - ),男,硕士研究生,主研方向:语义网;于海波,讲师;方 璐,硕士研究生。

Code Snippet Recommendation Combining with Reachability Analysis

JIA Xi,YU Haibo,FANG Lu   

  1. (School of Software,Shanghai Jiaotong University,Shanghai 200240,China)
  • Received:2013-12-01 Online:2014-11-15 Published:2014-11-13

摘要: 为满足日益复杂的软件需求,开发人员需要通过代码提示工具来辅助完成开发任务,但现有代码提示工具在推荐包含静态方法的代码片段时存在空间爆炸问题。为此,提出一种基于程序环境信息的代码片段推荐方法。结合可达性分析进行推荐能够有效削减静态方法入口点,在避免空间爆炸的同时,还可以准确、有效地描述程序环境信息。基于该方法实现在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

中图分类号: