CC BY-SA licensed code snippet in openjdk9 repository?

Sebastian Baltes s.baltes at uni-trier.de
Mon Dec 5 10:23:26 UTC 2016


Thanks!

So, let me summarize:

aioobe posted the snippet on Stack Overflow in 2010 when he did not work
for Oracle (yet). Then in 2014, the snippet was copied from Stack
Overflow into the openjdk repo without attribution.

Another issue is that the files in the openjdk repo are licensed under
the GNU GPL 2, but the license for Stack Overflow content (CC BY-SA 3.0)
requires a compatible license to be used in case "you remix, transform,
or build upon the material" [1]. According to Creative Commons,
"currently, no non-CC licenses have been designated as compatible with
BY-SA 3.0." [2].

I'm not a lawyer, but maybe it would be a good idea to replace the
method humanReadableByteCount with a re-implementation. We are working
on a tool to search for duplicates of non-trivial code snippets from
Stack Overflow on a larger scale, because we currently only search for
ten popular Java snippets. If you are interested, I can have a closer
look at the openjdk repo and report the result here.

Best regards,
Sebastian

[1] https://creativecommons.org/licenses/by-sa/3.0/
[2]
https://creativecommons.org/share-your-work/licensing-considerations/compatible-licenses/


On 05.12.2016 08:03, dean.long at oracle.com wrote:
> Does this help?
> 
> http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/f665fa6f2aa4
> 
> It appears that SO post was from 2010 and Oracle change was from 2014.
> 
> dl
> 
> On 12/4/16 3:12 AM, Sebastian Baltes wrote:
>> Hi,
>>
>> I contacted aioobe yesterday and he answered that he did not write the
>> code in the openjdk9 repo. I also found copies of the same snippet from
>> Stack Overflow in these files:
>>
>> openjdk9/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
>> openjdk9/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
>>
>> Best regards,
>> Sebastian
>>
>>
>> On 03.12.2016 14:50, Claes Redestad wrote:
>>> 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