Skip to content

Commit c8023b7

Browse files
committed
fix mistake in how filtering applied to wrap java
1 parent 5f7ac58 commit c8023b7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Sources/SwiftJavaTool/Commands/WrapJavaCommand.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,19 @@ extension SwiftJava.WrapJavaCommand {
267267

268268
private func shouldImportJavaClass(_ javaClassName: String, config: Configuration) -> Bool {
269269
// If we have an inclusive filter, import only types from it
270-
for include in config.filterInclude ?? [] {
271-
guard javaClassName.starts(with: include) else {
272-
log.info("Skip Java type: \(javaClassName) (does not match include filter: \(include))")
270+
if let includes = config.filterInclude, !includes.isEmpty {
271+
let anyIncludeFilterMatched = includes.contains { include in
272+
if javaClassName.starts(with: include) {
273+
// TODO: lower to trace level
274+
log.info("Skip Java type: \(javaClassName) (does not match any include filter)")
275+
return true
276+
}
277+
278+
return false
279+
}
280+
281+
guard anyIncludeFilterMatched else {
282+
log.info("Skip Java type: \(javaClassName) (does not match any include filter)")
273283
return false
274284
}
275285
}

0 commit comments

Comments
 (0)