The most copied StackOverflow Java code snippet contains a bug

so.png

techrepublic cheat sheet

The most copied StackOverflow Java code snippet of all time contains a bug.

The admission comes from the author of the snippet itself, Andreas Lundblad, a Java developer at Palantir, and one of the highest-ranked contributors to StackOverflow, a Q&A website for programming-related topics.

An academic paper [PDF] published in 2018 identified a code snippet Lundblad posted on the site as the most copied Java code taken from StackOverflow and then re-used in open source projects.

The code snippet was provided as an answer to a StackOverflow question posted in September 2010. The code snippet printed byte counts (123,456,789 bytes) in a human-readable format, like 123.5 MB.

Academics found that this code had been copied and embedded in more than 6,000 GitHub Java projects, more than any other StackOverflow Java snippet.

so-code.png

so-code.png

Image: Baltes et al.

Leave a Reply

Your email address will not be published. Required fields are marked *