CC BY-SA licensed code snippet in openjdk9 repository?

Claes Redestad claes.redestad at oracle.com
Sat Dec 3 13:50:20 UTC 2016


Hi,

why not ask the author of this SO post (aioobe) directly? He is an 
OpenJDK contributor and
was employed by Oracle at the time this code appeared in the OpenJDK 
source repos.

/Claes

On 12/03/2016 04:30 AM, Sebastian Baltes wrote:
> Hi,
>
> As you may know, the licensing of code snippets on Stack Overflow is a controversially discussed topic (see references below [2]).
> Currently, all content on Stack Overflow, including source code, is licensed under Creative Commons Attribution-ShareAlike 3.0 (CC BY-SA 3.0 [1]).
> This license demands attribution and demands derived work to be published under a compatible license.
> I found a match of a (non-trivial) Stack Overflow code snippet in the openjdk9 repository (see below).
> Now, I would like to find out if the author on Stack Overflow copied from your repo or if it was the other way around.
> I do not want to judge or blame developers copying code from Stack Overflow, I'm just interested in the reasons why (or why not) the origin of the code snippets is indicated and if developers are aware of the licensing of these snippets (it's part of my PhD research).
>
> Best regards,
> Sebastian
>
>
> // *********************************************
> // * Snippet on Stack Overflow
> // * Link: https://stackoverflow.com/a/3758880
> // *********************************************
>
> public static String humanReadableByteCount(long bytes, boolean si) {
>      int unit = si ? 1000 : 1024;
>      if (bytes < unit) return bytes + " B";
>      int exp = (int) (Math.log(bytes) / Math.log(unit));
>      String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");
>      return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
> }
>
> // *********************************************
> // * Match in openjdk9
> // * File:   openjdk9/hotspot/test/gc/parallel/TestDynShrinkHeap.java
> // *********************************************
>
> String humanReadableByteCount(long bytes, boolean si) {
>          int unit = si ? 1000 : 1024;
>          if (bytes < unit) {
>              return bytes + " B";
>          }
>          int exp = (int) (Math.log(bytes) / Math.log(unit));
>          String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
>          return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
>      }
>
>
> References:
>
> [1] https://creativecommons.org/licenses/by-sa/3.0/
> [2] Discussions about license of Stack Overflow code snippets:
>
>      "Do I have to worry about copyright issues for code posted on Stack Overflow?"
>      http://meta.stackexchange.com/q/12527
>
>      "Can we get some explicit clarification on the *intended* legal usage of code from SO answers?"
>      http://meta.stackoverflow.com/q/286582
>
>      "What is up with the source code license on Stack Overflow?"
>      http://meta.stackexchange.com/q/25956
>
>      "What is the license status of StackOverflow code snippets?"
>      https://legalict.com/software/what-is-the-license-status-of-stackoverflow-code-snippets
>
>      "The MIT license - clarity on using code on Stack Overflow and Stack Exchange"
>      http://meta.stackexchange.com/q/271080
>
>      "A new code license: The MIT, this time with attribution required"
>      http://meta.stackexchange.com/q/272956



More information about the jdk9-dev mailing list