Java 8 has introduced lambda expressions, a core feature of functional programming. Since its introduction, there is an increasing trend of lambda adoptions in Java projects. Developers often adopt lambda expressions to simplify code, avoid code duplication or simulate other functional features. However, we observe that lambda expressions can incur different types of side effects (e.g., performance issues and memory leakages) or even severe bugs, and developers also frequently remove lambda expressions in their implementations. However, there is no systematic study to characterize and understand such inappropriate usages of lambda expressions in Java. Without such knowledge, it is hard to guarantee the correct and appropriate usages of lambda expressions for Java developers. Consequently, the advantages of utilizing lambda expressions can be significantly compromised by the collatoral side effects. To bridge this gap, in this study, we present the first large-scale, quantitative and qualitative empirical study to characterize and understand inappropriate usages of lambda expressions. Particularly, we first extracted 3,662 instances of lambda expressions that were removed by developers due to inappropriate usages from 103 large-scale open-source projects, and compared their characteristics with those of 31,228 correct usages of lambdas. For instance, we observe that lambdas using customized functional interfaces are more likely to be removed by developers. To obtain a comprehensive understanding, we further collected over 100 real issues caused by abusing lambdas. We manually analyzed the reasons, impacts and migration patterns of those lambdas, and summarized 7 main reasons for the removal of lambdas. For example, performance degradation, poor readability, hard to debug and eliminating lazy evaluations are the most common reasons. Our study also reveals strong associations between the reasons to remove lambdas and the associated migration patterns. Moreover, from a complementary perspective, we performed an user study over 30 developers to seek for the underlying reasons on why do they remove lambda expressions in practice and confirmed 8 of the 9 reasons we summarized. Finally, based on our empirical results, we developed suggestions on scenarios to avoid lambda usages for Java developers and also pointed out future directions for researchers.
Tue 16 NovDisplayed time zone: Hobart change
12:00 - 13:00 | ProgrammingJournal-first Papers / Research Papers / NIER track at Kangaroo Chair(s): Amiangshu Bosu Wayne State University | ||
12:00 20mTalk | Detecting TensorFlow Program Bugs in Real-World Industrial Environment Research Papers Chen Liu , Jie Lu SKL Computer Architecture, ICT, CAS, Guangwei Li Institute of Computing Technology, Ting Yuan SKL Computer Architecture, ICT, CAS University of Chinese Academy of Sciences, China, Lian Li Institute of Computing Technology at Chinese Academy of Sciences, China, Feng Tan Alibaba Group, Jun Yang Alibaba Group, Liang You Alibaba Group, Jingling Xue UNSW Sydney Pre-print | ||
12:20 20mTalk | Why Do Developers Remove Lambda Expressions in Java? Research Papers Mingwei Zheng Huazhong University of Science and Technology, Jun Yang Huazhong University of Science and Technology, Ming Wen Huazhong University of Science and Technology, Hengcheng Zhu The Hong Kong University of Science and Technology, Yepang Liu Southern University of Science and Technology, Hai Jin Huazhong University of Science and Technology | ||
12:40 10mTalk | A Mocktail of Source Code Representations NIER track Dheeraj Vagavolu RISHA Lab, Indian Institute of Technology, Tirupati, Karthik Chandra Swarna RISHA Lab, Indian Institute of Technology Tirupati, Sridhar Chimalakonda RISHA Lab, Indian Institute of Technology, Tirupati | ||
12:50 10mTalk | On Tracking Java Methods with Git Mechanisms Journal-first Papers Yoshiki Higo Osaka University, Shinpei Hayashi Tokyo Institute of Technology, Shinji Kusumoto Osaka University |