Add a way for collecting analysis results in the Analyzer
Lets assume I have an Analyzer and get a manifest from it, then I get some nice package imports with a version range. But from time to time one might ask why a given version was choose for a range. This is not always obvious because it might be depend on what interfaces are used e.g. if its a provider or consumer type.
It would therefore be good if the Analyzer has a way to install a listener that is informed about such choices, w.g. it could get a callback like:
void explain(Package pkg, VersionRange range, String why)
that is called like explain("a.b.c", "(1,1.1]", "Type X implements interface Y that is marked as provider type") whenever the analyzer takes a decision. Implementation can then keep a backlog of why a certain range was chosen.
@laeubi do you already have an idea where this listener could be called inside Analyzer? In other words: Where would this info be available?
I had a quick look - what about somewhere around here in Analyzer.augmentImports(Packages imports, Packages exports)?
https://github.com/bndtools/bnd/blob/46c8fccdebf9d46d4dd976347f38edf4503b75b1/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java#L2090
There is also
https://github.com/bndtools/bnd/blob/46c8fccdebf9d46d4dd976347f38edf4503b75b1/biz.aQute.bndlib/src/aQute/bnd/osgi/Analyzer.java#L2252