I haven't looked at this too closely, but do you think that there could be some benefit to keeping them in separate packages if you expect the consumer and provider apis to evolve at a different pace?
If I recall correctly, the bundles that import and use stuff from a package that contains both consumer and provider classes may get a too specific range for the import package range. This has to do with bndlib choosing the "provider-policy" instead of the "consumer-policy" when calculating the version ranges. >From what I read, the default definitions for bnd are: -consumer-policy ${range;[==,+)} -provider-policy ${range;[==,=+)} Specifically, the import-package item can end up with a narrow range as something like org.apache.sling.whatever; version="[2.4, 2.5)" for the importing bundles which can leads to troubles when the next minor change requires the exported package to get bumped to "2.5.0" since that exported package number no longer satisfies the import package range. This would mean that all the "importing" bundles would have to change as well and you end up with a cascade of new releases just for some minor change in the "consumer" part of the exported package even if the changes were trivial and backward compatible. Regards, -Eric On Tue, Jun 29, 2021 at 8:54 AM Carsten Ziegeler <cziege...@apache.org> wrote: > I don't think that not mixing consumer and provider interfaces is a best > practice. > > The OSGi specs - which I think are usually following best practices - > are mixing them. For example event admin where the event admin interface > is in the same package as the event handler. > > The markers actually help putting those interfaces into the same > package. In above example you can change the event admin interface > without breaking the event handler. > > The framework api does the same, confgig admin etc. > > It's good to split packages based on purpose and usage. For example to > move SPI interfaces into a separate package. > > Regards > Carsten > > Am 29.06.2021 um 16:49 schrieb Bertrand Delacretaz: > > Hi Konrad, > > > > On Tue, Jun 29, 2021 at 3:04 PM Konrad Windszus <konra...@gmx.de> wrote: > >> - Please don't mix Consumer and Provider interfaces in the same package > >> ( > https://github.com/apache/sling-org-apache-sling-sitemap/tree/master/src/main/java/org/apache/sling/sitemap/generator > >> and > >> > https://github.com/apache/sling-org-apache-sling-sitemap/tree/master/src/main/java/org/apache/sling/sitemap/builder/extensions > ) > >> as that enforces updates to break more consumers than necessary.... > > > > Could you elaborate on that? The issue is not obvious to me. > > > > More generally, I think it would be useful for us to document best > > practices around Consumer and Provider interfaces. > > > > If someone has links to such best practices that would be great, > > otherwise feel free to add some notes in response to this message and > > I'll write something up for https://sling.apache.org/ > > > > -Bertrand > > > > -- > -- > Carsten Ziegeler > Adobe Research Switzerland > cziege...@apache.org >