Skip to content

Commit

Permalink
issue #200: createMergedModule fails with synthetic Service Providers
Browse files Browse the repository at this point in the history
  • Loading branch information
siordache committed Oct 20, 2021
1 parent 467b9b6 commit 4d93b09
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/main/groovy/org/beryx/jlink/data/ModuleInfo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class ModuleInfo implements Serializable {
final String service

UsesBuilder(String service) {
this.service = service.replace('$', '.')
this.service = adjustQualifiedName(service)
}

@Override
Expand Down Expand Up @@ -185,12 +185,12 @@ class ModuleInfo implements Serializable {
final TreeSet<String> implementations = new TreeSet<>()

ProvidesBuilder(String service) {
this.service = service.replace('$', '.')
this.service = adjustQualifiedName(service)
}

ProvidesBuilder with(String... implementations) {
for(s in implementations) {
this.implementations.add(s.replace('$', '.'))
this.implementations.add(adjustQualifiedName(s))
}
this
}
Expand Down Expand Up @@ -241,4 +241,12 @@ class ModuleInfo implements Serializable {
for(builder in providesBuilders) { entries << blanks + builder.toString(language)}
entries.join('\n')
}

private static String adjustQualifiedName(String s) {
int idx = s.indexOf('.$')
String notAdjusted = (idx < 0) ? '' : s.substring(idx)
String toAdjust = (idx < 0) ? s : s.substring(0, idx)
String adjusted = toAdjust.replaceAll('([^.])\\$', '$1.')
return adjusted + notAdjusted
}
}

0 comments on commit 4d93b09

Please sign in to comment.