@@ -150,7 +150,7 @@ class ModuleInfo implements Serializable {
150
150
final String service
151
151
152
152
UsesBuilder (String service ) {
153
- this . service = service . replace( ' $ ' , ' . ' )
153
+ this . service = adjustQualifiedName(service )
154
154
}
155
155
156
156
@Override
@@ -185,12 +185,12 @@ class ModuleInfo implements Serializable {
185
185
final TreeSet<String > implementations = new TreeSet<> ()
186
186
187
187
ProvidesBuilder (String service ) {
188
- this . service = service . replace( ' $ ' , ' . ' )
188
+ this . service = adjustQualifiedName(service )
189
189
}
190
190
191
191
ProvidesBuilder with (String ... implementations ) {
192
192
for (s in implementations) {
193
- this . implementations. add(s . replace( ' $ ' , ' . ' ))
193
+ this . implementations. add(adjustQualifiedName(s ))
194
194
}
195
195
this
196
196
}
@@ -241,4 +241,12 @@ class ModuleInfo implements Serializable {
241
241
for (builder in providesBuilders) { entries << blanks + builder. toString(language)}
242
242
entries. join(' \n ' )
243
243
}
244
+
245
+ private static String adjustQualifiedName (String s ) {
246
+ int idx = s. indexOf(' .$' )
247
+ String notAdjusted = (idx < 0 ) ? ' ' : s. substring(idx)
248
+ String toAdjust = (idx < 0 ) ? s : s. substring(0 , idx)
249
+ String adjusted = toAdjust. replaceAll(' ([^.])\\ $' , ' $1.' )
250
+ return adjusted + notAdjusted
251
+ }
244
252
}
0 commit comments