An Empirical Study on the Use and Misuse of Java 8 Streams
Open Access
- 17 April 2020
- book chapter
- Published by Springer Nature
- Vol. 12076, 97-118
Abstract
Streaming APIs allow for big data processing of native data structures by providing MapReduce-like operations over these structures. However, unlike traditional big data systems, these data structures typically reside in shared memory accessed by multiple cores. Although popular, this emerging hybrid paradigm opens the door to possibly detrimental behavior, such as thread contention and bugs related to non-execution and non-determinism. This study explores the use and misuse of a popular streaming API, namely, Java 8 Streams. The focus is on how developers decide whether or not to run these operations sequentially or in parallel and bugs both specific and tangential to this paradigm. Our study involved analyzing 34 Java projects and 5:53 million lines of code, along with 719 manually examined code patches. Various automated, including interprocedural static analysis, and manual methodologies were employed. The results indicate that streams are pervasive, parallelization is not widely used, and performance is a crosscutting concern that accounted for the majority of fixes. We also present coincidences that both confirm and contradict the results of related studies. The study advances our understanding of streams, as well as benefits practitioners, programming language and API designers, tool developers, and educators alike.Keywords
This publication has 31 references indexed in Scilit:
- GitcProc: a tool for processing and classifying GitHub commits2017
- Revisiting Assert Use in GitHub Projects2017
- An Empirical Study on Quality Issues of Production Big Data Platform2015
- Nondeterminism in MapReduce considered harmful? an empirical study on non-commutative aggregators in MapReduce programs2014
- Mining billions of AST nodes to study actual and potential usage of Java language features2014
- Adoption and use of Java genericsEmpirical Software Engineering, 2012
- Effective typestate verification in the presence of aliasingACM Transactions on Software Engineering and Methodology, 2008
- Learning from mistakes2008
- MapReduceCommunications of the ACM, 2008
- Bugs as deviant behavior2001