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.*;

closed as unclear what you're asking by curiousdannii, kdopen, Michael Schumacher, Trevor Clarke, Gilles Dec 24 '15 at 23:24

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You need to explain in what context you want to know whether you can do this. – curiousdannii Dec 16 '15 at 0:32

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.

  • 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 '15 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 – JeanValjean Dec 15 '15 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 '15 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. – JeanValjean Dec 15 '15 at 13:43

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.