In software development, it is common for programmers to copy-paste or port code snippets and then adapt them to their use case. This scenario motivates the code adaptation task – a variant of program repair which aims to adapt variable identifiers in a pasted snippet of code to the surrounding, preexisting context. However, no existing approach has been shown to effectively address this task. In this paper, we introduce AdaptivePaste, a learning-based approach to source code adaptation, based on transformers and a dedicated dataflow-aware deobfuscation pre-training task to learn meaningful representations of variable usage patterns. We demonstrate that AdaptivePaste can learn to adapt Python source code snippets with 67.8% exact match accuracy. We study the impact of confidence thresholds on the model predictions, showing the model precision can be further improved to 85.9% with our parallel-decoder transformer model in a selective code adaptation setting. To assess the practical use of AdaptivePaste we perform a user study among Python software developers on real-world copy-paste instances. The results show that AdaptivePaste reduces dwell time to nearly half the time it takes to port code manually, and helps to avoid bugs. In addition, we utilize the participant feedback to identify potential avenues for improvement.
Wed 6 DecDisplayed time zone: Pacific Time (US & Canada) change
14:00 - 15:30 | Clone and Similarity DetectionResearch Papers / Industry Papers at Golden Gate A Chair(s): Denys Poshyvanyk William & Mary | ||
14:00 15mTalk | AdaptivePaste: Intelligent Copy-Paste in IDE Industry Papers Xiaoyu Liu Microsoft Corporation, Jinu Jang Microsoft, Neel Sundaresan Microsoft, Miltiadis Allamanis Google DeepMind, Alexey Svyatkovskiy Microsoft DOI Media Attached | ||
14:15 15mTalk | Scalable Program Clone Search Through Spectral Analysis Research Papers Tristan Benoit Université de Lorraine, CNRS, LORIA, Jean-Yves Marion LORIA, Université de Lorraine, Sébastien Bardin CEA, Université Paris Saclay DOI Pre-print Media Attached | ||
14:30 15mTalk | [Remote] Tritor: Detecting Semantic Code Clones by Building Social Network-based Triads Model Research Papers Deqing Zou Huazhong University of Science and Technology, Siyue Feng Huazhong University of Science and Technology, Yueming Wu Nanyang Technological University, Wenqi Suo Huazhong University of Science and Technology, Hai Jin Huazhong University of Science and Technology Media Attached | ||
14:45 15mTalk | [Remote] C³: Code Clone-Based Identification of Duplicated Components Industry Papers Yanming Yang Zhejiang University, Ying Zou Queen's University, Kingston, Ontario, Xing Hu Zhejiang University, David Lo School of Computing and Information Systems, Singapore Management University, Chao Ni School of Software Technology, Zhejiang University, John Grundy Monash University, Xin Xia Huawei Technologies DOI Media Attached | ||
15:00 15mTalk | [Remote] Demystifying the Composition and Code Reuse in Solidity Smart Contracts Research Papers Kairan Sun Nanyang Technological University, Zhengzi Xu Nanyang Technological University, Chengwei Liu Nanyang Technological University, Kaixuan Li East China Normal University, Yang Liu Nanyang Technological University Pre-print Media Attached | ||
15:15 15mTalk | [Remote] Gitor: Scalable Code Clone Detection by Building Global Sample Graph Research Papers Junjie shan Westlake University, Shihan Dou Fudan University, Yueming Wu Nanyang Technological University, Hairu wu Fudan University, Yang Liu Nanyang Technological University Media Attached |