How to concatenate multiple @Header into a single manifest header?

Hi,

Suppose my bundle contains two classes/packages, one of which is annotated with

@Header(name = "MyTag", value = "foo")

and the other with:

@Header(name = "MyTag", value = "bar")

I have noticed that one of these @Header annotations will effectively clobber the other, and it’s not difficult to understand why. Nor is it currently causing me a problem. However, I can imagine a time when I might want my bundle’s final MANIFEST.MF to contain this instead:

MyTag: bar,foo

Does Bnd already support some form of “duplicates resolution” policy for manifest headers, please? Or does something make it unnecessary?

Note that my bundle currently contains multiple occurrences of just:

Header(name = "MyTag", value = "foo")

and that I do want its manifest ultimately to contain only:

MyTag: foo

which is indeed the current behaviour.

Thanks,
Chris

I don’t believe there is any support for combining or deduplicating header values. You just need to be careful.

I have only used it for things such as @Header(name = Constants.BUNDLE_ACTIVATOR, value = "${@class}") and you shouldn’t have multiple bundle activator classes in one bundle.

Thanks for replying. As I said, it’s not currently causing me any grief. But I suspect my use-case is more grotesque than yours… :scream_cat:.

Cheers,
Chris