File tree Expand file tree Collapse file tree
Samples/JavaDependencySampleApp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -157,6 +157,11 @@ let package = Package(
157157 targets : [ " CSwiftJavaJNI " ]
158158 ) ,
159159
160+ . library (
161+ name : " SwiftJavaConfigurationShared " ,
162+ targets : [ " SwiftJavaConfigurationShared " ]
163+ ) ,
164+
160165 . library (
161166 name : " JavaUtil " ,
162167 targets : [ " JavaUtil " ]
@@ -297,7 +302,6 @@ let package = Package(
297302 " CSwiftJavaJNI " ,
298303 " SwiftJavaMacros " ,
299304 " JavaTypes " ,
300- " SwiftJavaConfigurationShared " , // for Configuration reading at runtime
301305 ] ,
302306 exclude : [ " swift-java.config " ] ,
303307 swiftSettings : [
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ let package = Package(
111111 name : " JavaDependencySample " ,
112112 dependencies : [
113113 . product ( name : " SwiftJava " , package : " swift-java " ) ,
114+ . product ( name : " SwiftJavaConfigurationShared " , package : " swift-java " ) ,
114115 . product ( name : " CSwiftJavaJNI " , package : " swift-java " ) ,
115116 . product ( name : " JavaUtilFunction " , package : " swift-java " ) ,
116117 " JavaCommonsCSV "
Original file line number Diff line number Diff line change 1212//
1313//===----------------------------------------------------------------------===//
1414
15+ #if canImport( FoundationEssentials )
16+ import FoundationEssentials
17+ #else
1518import Foundation
19+ #endif
1620
1721extension String {
1822 /// For a String that's of the form java.util.Vector, return the "Vector" part.
@@ -30,11 +34,10 @@ extension String {
3034 /// Convert a Java class name to its canonical name.
3135 /// Replaces `$` with `.` for nested classes but preserves `$` at the start of identifiers.
3236 package var javaClassNameToCanonicalName : String {
33- self . replacingOccurrences (
34- of : #"(?<=\w)\$"# ,
35- with : " . " ,
36- options : . regularExpression
37- )
37+ let regex = try! Regex ( #"(\w)\$"# , as : ( Substring , Substring ) . self )
38+ return self . replacing ( regex ) { match in
39+ " \( match . output . 1 ) . "
40+ }
3841 }
3942
4043 /// Whether this is the name of an anonymous class.
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public final class _JNIMethodIDCache: Sendable {
6060 fatalError ( " Cannot get JNI.shared, it should have been initialized by JNI_OnLoad when loading the library " )
6161 }
6262 guard let javaClass = try? jni . applicationClassLoader ? . loadClass (
63- className . replacingOccurrences ( of : " / " , with : " . " )
63+ className . replacing ( " / " , with : " . " )
6464 ) else {
6565 fatalError ( " Class \( className ) could not be found! " )
6666 }
You can’t perform that action at this time.
0 commit comments