一种结构信息增强的代码修改自动转换方法
作者:
作者单位:

作者简介:

曹英魁(1993-),男,博士,主要研究领域为软件工程,软件复用,程序生成.
孙泽宇(1995-),男,博士,CCF学生会员,主要研究领域为软件工程,软件分析与测试,程序生成.
邹艳珍(1973-),女,博士,副教授,CCF专业会员,主要研究领域为软件工程,软件复用,知识图谱,智能软件开发.
谢冰(1970-),男,博士,教授,博士生导师,CCF高级会员,主要研究领域为软件工程,形式化方法,软件复用与智能软件开发.

通讯作者:

谢冰,E-mail:xiebing@sei.pku.edu.cn

中图分类号:

TP311

基金项目:

国家杰出青年科学基金(61525201);国家自然科学基金(61972006)


Structurally-enhanced Approach for Automatic Code Change Transformation
Author:
Affiliation:

Fund Project:

National Natural Science Fund for Distinguished Young Scholars (61525201); National Natural Science Foundation of China (61972006)

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    在开发过程中,开发人员在进行缺陷修复、版本更新时,常常需要修改多处相似的代码.如何进行自动代码修改已成为软件工程领域的热点研究问题.一种行之有效的方式是:给定一组代码修改示例,通过抽取其中的代码修改模式,辅助相似代码进行自动转换.在现有工作中,基于深度学习的方法取得了一定进展,但在捕获代码间的长程信息依赖关系时,效果不佳.为此,提出了一种结构信息增强的代码修改自动转换方法ExpTrans.ExpTrans在解析代码时采用图的形式来表示修改示例,显式地指出了代码中变量之间的依赖关系,同时结合图卷积网络和Transformer架构,增强了模型对代码的结构信息和依赖信息的捕获能力,从而提升了代码修改自动转换的准确性.实验结果表明,对比同类型基于深度学习的方法,ExpTrans在准确率上提升了11.8%~30.8%;对比基于人工规则的方法,ExpTrans在修改实例的数量和准确率上均有显著提升.

    Abstract:

    In software development, developers often need to change or update lots of similar codes. How to perform code transformation automatically has become a research hotspot in software engineering. An effective way is:Extracting the change pattern from a set of similar code changes and apply it to automatic code change transformation. In the related work, deep-learning-based approaches have achieved much progress, but they suffer from the problem of significant long-dependency among code. To address this challenge, an automatic code change transformation method is proposed, namely ExpTrans, enhanced by code structure information. Based on graph-based representations of code changes, ExpTrans is enhanced with structural information of code. ExpTrans labels the dependency among variables in code parsing, adopts the graph-convolution network and transformer structure, so as to capture the long-dependency among code. To evaluate ExpTrans's effectiveness, it is compared with existing learning-based approaches first, the results show that ExpTrans gains 11.8%~30.8% precision increment. Then, ExpTrans is compared with rule-based the approaches, the results show that ExpTrans significantly improves the correct rate of the modified instances.

    参考文献
    相似文献
    引证文献
引用本文

曹英魁,孙泽宇,邹艳珍,谢冰.一种结构信息增强的代码修改自动转换方法.软件学报,2021,32(4):1006-1022

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2020-09-13
  • 最后修改日期:2020-10-26
  • 录用日期:
  • 在线发布日期: 2021-01-22
  • 出版日期: 2021-04-06
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号