From 3640052c30988649c6dbb0ed90aba6afdfa66443 Mon Sep 17 00:00:00 2001 From: Konrad 'ktoso' Malawski Date: Thu, 14 Aug 2025 18:13:10 +0900 Subject: [PATCH] fix javadoc formatting --- ...t2JavaGenerator+JavaBindingsPrinting.swift | 10 +-- .../JNI/JNIClassTests.swift | 40 +++++------ .../JNI/JNIClosureTests.swift | 20 +++--- .../JNI/JNIJavaKitTests.swift | 10 +-- .../JNI/JNIModuleTests.swift | 60 ++++++++-------- .../JNI/JNIOptionalTests.swift | 68 +++++++++---------- .../JNI/JNIStructTests.swift | 20 +++--- .../JNI/JNIUnsignedNumberTests.swift | 40 +++++------ .../MemoryManagementModeTests.swift | 16 ++--- 9 files changed, 142 insertions(+), 142 deletions(-) diff --git a/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaBindingsPrinting.swift b/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaBindingsPrinting.swift index 0920a89b..4cd3f0ce 100644 --- a/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaBindingsPrinting.swift +++ b/Sources/JExtractSwiftLib/JNI/JNISwift2JavaGenerator+JavaBindingsPrinting.swift @@ -356,11 +356,11 @@ extension JNISwift2JavaGenerator { printer.print( """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * \(decl.signatureString) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * \(decl.signatureString) + * } + */ """ ) } diff --git a/Tests/JExtractSwiftTests/JNI/JNIClassTests.swift b/Tests/JExtractSwiftTests/JNI/JNIClassTests.swift index 5b015f89..513d5b90 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIClassTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIClassTests.swift @@ -158,22 +158,22 @@ struct JNIClassTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public init(x: Int64, y: Int64) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public init(x: Int64, y: Int64) + * } + */ public static MyClass init(long x, long y, SwiftArena swiftArena$) { return new MyClass(MyClass.$init(x, y), swiftArena$); } """, """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public init() - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public init() + * } + */ public static MyClass init(SwiftArena swiftArena$) { return new MyClass(MyClass.$init(), swiftArena$); } @@ -303,11 +303,11 @@ struct JNIClassTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func copy() -> MyClass - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func copy() -> MyClass + * } + */ public MyClass copy(SwiftArena swiftArena$) { return new MyClass(MyClass.$copy(this.$memoryAddress()), swiftArena$); } @@ -355,11 +355,11 @@ struct JNIClassTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func isEqual(to other: MyClass) -> Bool - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func isEqual(to other: MyClass) -> Bool + * } + */ public boolean isEqual(MyClass other) { return MyClass.$isEqual(other.$memoryAddress(), this.$memoryAddress()); } diff --git a/Tests/JExtractSwiftTests/JNI/JNIClosureTests.swift b/Tests/JExtractSwiftTests/JNI/JNIClosureTests.swift index 9a388da1..b374d24e 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIClosureTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIClosureTests.swift @@ -36,11 +36,11 @@ struct JNIClosureTests { """, """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func emptyClosure(closure: () -> ()) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func emptyClosure(closure: () -> ()) + * } + */ public static void emptyClosure(com.example.swift.SwiftModule.emptyClosure.closure closure) { SwiftModule.$emptyClosure(closure); } @@ -88,11 +88,11 @@ struct JNIClosureTests { """, """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func closureWithArgumentsAndReturn(closure: (Int64, Bool) -> Int64) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func closureWithArgumentsAndReturn(closure: (Int64, Bool) -> Int64) + * } + */ public static void closureWithArgumentsAndReturn(com.example.swift.SwiftModule.closureWithArgumentsAndReturn.closure closure) { SwiftModule.$closureWithArgumentsAndReturn(closure); } diff --git a/Tests/JExtractSwiftTests/JNI/JNIJavaKitTests.swift b/Tests/JExtractSwiftTests/JNI/JNIJavaKitTests.swift index 1f19c8f9..ac6b8384 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIJavaKitTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIJavaKitTests.swift @@ -37,11 +37,11 @@ struct JNIJavaKitTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func function(javaLong: JavaLong, javaInteger: JavaInteger, int: Int64) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func function(javaLong: JavaLong, javaInteger: JavaInteger, int: Int64) + * } + */ public static void function(java.lang.Long javaLong, java.lang.Integer javaInteger, long int) { SwiftModule.$function(javaLong, javaInteger, int); } diff --git a/Tests/JExtractSwiftTests/JNI/JNIModuleTests.swift b/Tests/JExtractSwiftTests/JNI/JNIModuleTests.swift index 198276ba..ad55f491 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIModuleTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIModuleTests.swift @@ -67,11 +67,11 @@ struct JNIModuleTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func helloWorld() - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func helloWorld() + * } + */ public static void helloWorld() { SwiftModule.$helloWorld(); } @@ -81,11 +81,11 @@ struct JNIModuleTests { """, """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func takeIntegers(i1: Int8, i2: Int16, i3: Int32, i4: Int64) -> UInt16 - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func takeIntegers(i1: Int8, i2: Int16, i3: Int32, i4: Int64) -> UInt16 + * } + */ @Unsigned public static char takeIntegers(byte i1, short i2, int i3, long i4) { return SwiftModule.$takeIntegers(i1, i2, i3, i4); @@ -96,11 +96,11 @@ struct JNIModuleTests { """, """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func otherPrimitives(b: Bool, f: Float, d: Double) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func otherPrimitives(b: Bool, f: Float, d: Double) + * } + */ public static void otherPrimitives(boolean b, float f, double d) { SwiftModule.$otherPrimitives(b, f, d); } @@ -151,11 +151,11 @@ struct JNIModuleTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func copy(_ string: String) -> String - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func copy(_ string: String) -> String + * } + */ public static java.lang.String copy(java.lang.String string) { return SwiftModule.$copy(string); } @@ -194,11 +194,11 @@ struct JNIModuleTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func methodA() throws - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func methodA() throws + * } + */ public static void methodA() throws Exception { SwiftModule.$methodA(); } @@ -208,11 +208,11 @@ struct JNIModuleTests { """, """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func methodB() throws -> Int64 - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func methodB() throws -> Int64 + * } + */ public static long methodB() throws Exception { return SwiftModule.$methodB(); } diff --git a/Tests/JExtractSwiftTests/JNI/JNIOptionalTests.swift b/Tests/JExtractSwiftTests/JNI/JNIOptionalTests.swift index cd04660b..e5fb7088 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIOptionalTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIOptionalTests.swift @@ -46,12 +46,12 @@ struct JNIOptionalTests { * public func optionalSugar(_ arg: Int64?) -> Int32? * } */ - public static OptionalInt optionalSugar(OptionalLong arg) { - long combined$ = SwiftModule.$optionalSugar((byte) (arg.isPresent() ? 1 : 0), arg.orElse(0L)); - byte discriminator$ = (byte) (combined$ & 0xFF); - int value$ = (int) (combined$ >> 32); - return discriminator$ == 1 ? OptionalInt.of(value$) : OptionalInt.empty(); - } + public static OptionalInt optionalSugar(OptionalLong arg) { + long combined$ = SwiftModule.$optionalSugar((byte) (arg.isPresent() ? 1 : 0), arg.orElse(0L)); + byte discriminator$ = (byte) (combined$ & 0xFF); + int value$ = (int) (combined$ >> 32); + return discriminator$ == 1 ? OptionalInt.of(value$) : OptionalInt.empty(); + } """, """ private static native long $optionalSugar(byte arg_discriminator, long arg_value); @@ -92,16 +92,16 @@ struct JNIOptionalTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func optionalExplicit(_ arg: Optional) -> Optional - * } - */ - public static Optional optionalExplicit(Optional arg) { - byte[] result_discriminator$ = new byte[1]; - java.lang.String result$ = SwiftModule.$optionalExplicit((byte) (arg.isPresent() ? 1 : 0), arg.orElse(null), result_discriminator$); - return (result_discriminator$[0] == 1) ? Optional.of(result$) : Optional.empty(); - } + * Downcall to Swift: + * {@snippet lang=swift : + * public func optionalExplicit(_ arg: Optional) -> Optional + * } + */ + public static Optional optionalExplicit(Optional arg) { + byte[] result_discriminator$ = new byte[1]; + java.lang.String result$ = SwiftModule.$optionalExplicit((byte) (arg.isPresent() ? 1 : 0), arg.orElse(null), result_discriminator$); + return (result_discriminator$[0] == 1) ? Optional.of(result$) : Optional.empty(); + } """, """ private static native java.lang.String $optionalExplicit(byte arg_discriminator, java.lang.String arg_value, byte[] result_discriminator$); @@ -150,16 +150,16 @@ struct JNIOptionalTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func optionalClass(_ arg: MyClass?) -> MyClass? - * } - */ - public static Optional optionalClass(Optional arg, SwiftArena swiftArena$) { - byte[] result_discriminator$ = new byte[1]; - long result$ = SwiftModule.$optionalClass(arg.map(MyClass::$memoryAddress).orElse(0L), result_discriminator$); - return (result_discriminator$[0] == 1) ? Optional.of(new MyClass(result$, swiftArena$)) : Optional.empty(); - } + * Downcall to Swift: + * {@snippet lang=swift : + * public func optionalClass(_ arg: MyClass?) -> MyClass? + * } + */ + public static Optional optionalClass(Optional arg, SwiftArena swiftArena$) { + byte[] result_discriminator$ = new byte[1]; + long result$ = SwiftModule.$optionalClass(arg.map(MyClass::$memoryAddress).orElse(0L), result_discriminator$); + return (result_discriminator$[0] == 1) ? Optional.of(new MyClass(result$, swiftArena$)) : Optional.empty(); + } """, """ private static native long $optionalClass(long arg, byte[] result_discriminator$); @@ -213,14 +213,14 @@ struct JNIOptionalTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func optionalJavaKitClass(_ arg: JavaLong?) - * } - */ - public static void optionalJavaKitClass(Optional arg) { - SwiftModule.$optionalJavaKitClass(arg.orElse(null)); - } + * Downcall to Swift: + * {@snippet lang=swift : + * public func optionalJavaKitClass(_ arg: JavaLong?) + * } + */ + public static void optionalJavaKitClass(Optional arg) { + SwiftModule.$optionalJavaKitClass(arg.orElse(null)); + } """, """ private static native void $optionalJavaKitClass(java.lang.Long arg); diff --git a/Tests/JExtractSwiftTests/JNI/JNIStructTests.swift b/Tests/JExtractSwiftTests/JNI/JNIStructTests.swift index 01a2e3c0..86f4675a 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIStructTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIStructTests.swift @@ -104,11 +104,11 @@ struct JNIStructTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public init(x: Int64, y: Int64) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public init(x: Int64, y: Int64) + * } + */ public static MyStruct init(long x, long y, SwiftArena swiftArena$) { return new MyStruct(MyStruct.$init(x, y), swiftArena$); } @@ -176,11 +176,11 @@ struct JNIStructTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func doSomething(x: Int64) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func doSomething(x: Int64) + * } + */ public void doSomething(long x) { MyStruct.$doSomething(x, this.$memoryAddress()); } diff --git a/Tests/JExtractSwiftTests/JNI/JNIUnsignedNumberTests.swift b/Tests/JExtractSwiftTests/JNI/JNIUnsignedNumberTests.swift index f4dbffed..bfae447a 100644 --- a/Tests/JExtractSwiftTests/JNI/JNIUnsignedNumberTests.swift +++ b/Tests/JExtractSwiftTests/JNI/JNIUnsignedNumberTests.swift @@ -27,11 +27,11 @@ final class JNIUnsignedNumberTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func unsignedChar(_ arg: UInt16) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func unsignedChar(_ arg: UInt16) + * } + */ public static void unsignedChar(@Unsigned char arg) { SwiftModule.$unsignedChar(arg); } @@ -57,11 +57,11 @@ final class JNIUnsignedNumberTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func unsignedInt(_ arg: UInt32) - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func unsignedInt(_ arg: UInt32) + * } + */ public static void unsignedInt(@Unsigned int arg) { SwiftModule.$unsignedInt(arg); } @@ -83,11 +83,11 @@ final class JNIUnsignedNumberTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func returnUnsignedInt() -> UInt32 - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func returnUnsignedInt() -> UInt32 + * } + */ @Unsigned public static int returnUnsignedInt() { return SwiftModule.$returnUnsignedInt(); @@ -137,11 +137,11 @@ final class JNIUnsignedNumberTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func unsignedLong(first: UInt64, second: UInt32) -> UInt32 - * } - */ + * Downcall to Swift: + * {@snippet lang=swift : + * public func unsignedLong(first: UInt64, second: UInt32) -> UInt32 + * } + */ @Unsigned public static int unsignedLong(@Unsigned long first, @Unsigned int second) { return SwiftModule.$unsignedLong(first, second); diff --git a/Tests/JExtractSwiftTests/MemoryManagementModeTests.swift b/Tests/JExtractSwiftTests/MemoryManagementModeTests.swift index 4edf59c2..b4e00a9f 100644 --- a/Tests/JExtractSwiftTests/MemoryManagementModeTests.swift +++ b/Tests/JExtractSwiftTests/MemoryManagementModeTests.swift @@ -37,14 +37,14 @@ struct MemoryManagementModeTests { expectedChunks: [ """ /** - * Downcall to Swift: - * {@snippet lang=swift : - * public func f() -> MyClass - * } - */ - public static MyClass f(SwiftArena swiftArena$) { - return new MyClass(SwiftModule.$f(), swiftArena$); - } + * Downcall to Swift: + * {@snippet lang=swift : + * public func f() -> MyClass + * } + */ + public static MyClass f(SwiftArena swiftArena$) { + return new MyClass(SwiftModule.$f(), swiftArena$); + } """, ] )