Sign In

Communications of the ACM

ACM Careers

The Most Copied StackOverflow Java Code Snippet Contains a Bug

View as: Print Mobile App Share: Send by email Share on reddit Share on StumbleUpon Share on Hacker News Share on Tweeter Share on Facebook
screenshot of code snippet

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

The admission comes from the author of the snippet, Andreas Lundblad, a Java developer at Palantir, and one of the highest-ranked contributors to StackOverflow.

A research paper published in 2018, "Usage and Attribution of Stack Overflow Code Snippets in GitHub Projects," 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. Academics found that this code had been copied and embedded in more than 6,000 GitHub Java projects.

The code snippet printed byte counts in a human-readable format.

In a blog post published last week, Lundblad said that the code was flawed and that it converted byte counts into human-readable formats incorrectly.

From ZDNet
View Full Article


No entries found

Sign In for Full Access
» Forgot Password? » Create an ACM Web Account