2

I'm extending an open source library written in Java released under the BSD License. That library has a class, let's call it Utils, that exposes a lot of static methods. The common use case is to import all the exposed methods in a static import, i.e.

import static org.acme.Utils.*;

Now, I'm creating new functions in my brand new open source library to extend the one from company acme. I'm wondering if is lecit to do

package org.myself;

import org.acme.Utils;

public class MyUtils extends Utils{
   ...
}

such that I can then use a single import

import static org.myself.MyUtils.*;

instead of

import static org.acme.Utils.*;
import static org.myself.MyUtils.*;
1
  • You need to explain in what context you want to know whether you can do this. Dec 16, 2015 at 0:32

2 Answers 2

3

As far as the copyright/license is concerned, there is no difference in what namespace you put things, so this is fine.

Whether it is a good idea for your re-users to do this is more of a question for Programmers.se, and mainly comes down to whether it is more simple for your users to understand what's going on or to write one import fewer.

4
  • As a single data point, I hate libraries that do this. The amount of time it costs me to find the source of function y stands in no relation to the amount of time it costs me to type an additional import.
    – Martijn
    Dec 15, 2015 at 11:53
  • I don't see why you should find the original class that implemented the function. Anyway, finding the class/interface that first implemented/defined a method is a straightworward task for all the modern IDEs Dec 15, 2015 at 12:27
  • @JeanValjean usually to read the source (part of the reason open source exists in the first place) when I'm not 100% sure of what the function does from the doc, or when I want to do something similar, and want to know how they did it. Different people have different opinions on this, which is fine.
    – Martijn
    Dec 15, 2015 at 12:32
  • I guess that inheritance was meant to be used for inherithing functionalities to avoid code duplication. Flat-programming and code parcellization may lead to much higher confusion. Dec 15, 2015 at 13:43
2

The licence states that

Redistribution and use in source and binary forms are permitted provided [etc...]

It does not specify how you can and cannot use a specific class, function or library. All uses in "binary form" are the same to it. So yes, you could use a class from a BSD-licensed library like that, provided you comply with all of the license's terms.

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