Skip to content

Commit

Permalink
Allow duplicate pids in designates if one is for regular the other for
Browse files Browse the repository at this point in the history
factory pid

This closes bndtools#6042

Signed-off-by: Konrad Windszus <kwin@apache.org>
  • Loading branch information
kwin committed Mar 15, 2024
1 parent c951830 commit bd573f6
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public boolean analyzeJar(Analyzer analyzer) throws Exception {

Set<String> ocdIds = new HashSet<>();
Set<String> pids = new HashSet<>();
Set<String> factoryPids = new HashSet<>();

Instructions instructions = new Instructions(header);

Expand Down Expand Up @@ -142,8 +143,10 @@ public boolean analyzeJar(Analyzer analyzer) throws Exception {
analyzer.error("Duplicate OCD id %s from class %s; known ids %s", definition.id, c.getFQN(), ocdIds);
}
for (DesignateDef dDef : definition.designates) {
if (dDef.pid != null && !pids.add(dDef.pid)) {
analyzer.error("Duplicate pid %s from class %s", dDef.pid, c.getFQN());
Set<String> relevantPids = dDef.factory ? factoryPids : pids;
if (dDef.pid != null && !relevantPids.add(dDef.pid)) {
analyzer.error("Duplicate %s from class %s", dDef.factory ? "factoryPid" : "pid", dDef.pid,
c.getFQN());
}
}
String name = "OSGI-INF/metatype/" + analyzer.validResourcePath(definition.id, "Invalid resource name")
Expand Down

0 comments on commit bd573f6

Please sign in to comment.