5

I'm using a library that is licensed under a BSD-2 like license and I am wanting to override one of the methods they use and modify it slightly.

My question is, when I copy the code from the method what do I need to include in the comments for said method? Do I have to go all out and include the whole license there or can I input something more simple?

This is the license they have at the top of all the library files:

//  Copyright (c) 2008-9, the Phantom Inker.  All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without
//  modification, are permitted provided that the following conditions
//  are met:
//
//    * Redistributions of source code must retain the above copyright
//       notice, this list of conditions and the following disclaimer.
//
//    * Redistributions in binary form must reproduce the above copyright
//       notice, this list of conditions and the following disclaimer in
//       the documentation and/or other materials provided with the
//       distribution.
//
//  THIS SOFTWARE IS PROVIDED BY THE PHANTOM INKER "AS IS" AND ANY EXPRESS
//  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
//  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
//  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
//  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
//  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
//  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
//  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
//  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
//  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2
  • I'm a little confused by "override one of the methods they use and modify it slightly", because "overriding" a method is very different from "modifying" a method's implementation. So, are you saying there's a BSD-licensed class with a method you want to override from your code? Or are you saying you want to copy-paste a slightly modified version of some BSD-licensed code into one of your files? – Ixrec Aug 15 '15 at 18:20
  • @Ixrec Sorry. What I mean is that in one of the files of the library it contains a class, with a method which I need to make some changes to. So essentially I will be copying this method, pasting it into my own class and making said changes. – Brett Aug 15 '15 at 18:25
4

Short answer: Yes. You do need to include the entire BSD "license comment" in any and all of your source distributions which contain Mr. Phantom Inker's code or modified versions thereof. This is one of the very few conditions the license imposes on you:

//    * Redistributions of source code must retain the above copyright  
//       notice, this list of conditions and the following disclaimer.

The comment as you've pasted it appears to consist of a copyright notice, a list of conditions and then a disclaimer, so all of that must be "retained" in your version.

Also, when you modify someone else's code it's best to add an additional comment saying that you modified it and the original version had so-and-so license, not because any license requires you to, but simply because it makes it clear what's going on. So you should actually have a longer comment block than the original code did.

The good news--if you were worried about this wall of text being an eyesore in your code--is that you do not necessarily have to include this comment block right on top of or in the middle of that particular method, as long as you make it sufficiently obvious what it is referring to. I would personally put all this licensing stuff at the top of the file, make sure your additional comment says something like "The code for method foo() was taken from Phantom Maker's FooLib v1.2 and modified by Brett. The FooLib v1.2 copyright notice is as follows: ", then on the actual method in question have a single line comment saying something like "For licensing information pertaining to this method, see the comments at the top of this file."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.