From a9d5a27e7bae1119f02e0efd63765f4f5cfde287 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Thu, 22 Jan 2026 16:52:10 +0900 Subject: [PATCH 1/4] nclude stacktrace of exceptions thrown and try! excluded in @JavaMethod --- Sources/SwiftJavaMacros/JavaMethodMacro.swift | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/Sources/SwiftJavaMacros/JavaMethodMacro.swift b/Sources/SwiftJavaMacros/JavaMethodMacro.swift index 099484528..7e1617c46 100644 --- a/Sources/SwiftJavaMacros/JavaMethodMacro.swift +++ b/Sources/SwiftJavaMacros/JavaMethodMacro.swift @@ -109,18 +109,44 @@ extension JavaMethodMacro: BodyMacro { parametersAsArgs = ", arguments: \(paramNames)" } - let tryKeyword = - funcDecl.signature.effectSpecifiers?.throwsClause != nil - ? "try" : "try!" + let canRethrowError = funcDecl.signature.effectSpecifiers?.throwsClause != nil + let catchPhrase = // how are we able to catch/handle thrown errors from the dynamicJava call + if canRethrowError { + "throw error" + } else { + """ + if let throwable = error as? Throwable { + throwable.printStackTrace() + } + fatalError("Java call threw unhandled exception: \\(error)") + """ + } let resultSyntax: CodeBlockItemSyntax = - "\(raw: tryKeyword) dynamicJava\(raw: isStatic ? "Static" : "")MethodCall(methodName: \(literal: funcName)\(raw: parametersAsArgs)\(raw: resultType))" + if canRethrowError { + """ + try { + return try dynamicJava\(raw: isStatic ? "Static" : "")MethodCall(methodName: \(literal: funcName)\(raw: parametersAsArgs)\(raw: resultType)) + }() + """ + } else { + """ + \(raw: canRethrowError ? "try " : ""){ + do { + return try dynamicJava\(raw: isStatic ? "Static" : "")MethodCall(methodName: \(literal: funcName)\(raw: parametersAsArgs)\(raw: resultType)) + } catch { + \(raw: catchPhrase) + } + }() + """ + } if let genericResultType { return [ """ /* convert erased return value to \(raw: genericResultType) */ - if let result$ = \(resultSyntax) { + let result$ = \(resultSyntax) + if let result$ { return \(raw: genericResultType)(javaThis: result$.javaThis, environment: try! JavaVirtualMachine.shared().environment()) } else { return nil From cf463d80ca30c4c9b0f48b7d36872048d43f9616 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Thu, 22 Jan 2026 17:33:21 +0900 Subject: [PATCH 2/4] Import PrintWriter and update JavaIO module --- Sources/JavaStdlib/JavaIO/Throwable+IO.swift | 29 + .../generated/BufferedInputStream.swift | 82 +- .../JavaIO/generated/ByteBuffer.swift | 733 ++++++++++++++++++ .../JavaStdlib/JavaIO/generated/Charset.swift | 165 +++- .../JavaIO/generated/Closeable.swift | 12 +- .../JavaStdlib/JavaIO/generated/File.swift | 376 ++++++++- .../JavaIO/generated/FileDescriptor.swift | 18 +- .../JavaIO/generated/FileReader.swift | 2 +- .../JavaIO/generated/Flushable.swift | 12 +- .../JavaIO/generated/InputStream.swift | 136 +++- .../JavaIO/generated/InputStreamReader.swift | 46 +- .../JavaIO/generated/OutputStream.swift | 52 +- .../JavaStdlib/JavaIO/generated/Path.swift | 294 ++++++- .../JavaIO/generated/PrintWriter.swift | 446 +++++++++++ .../JavaIO/generated/Readable.swift | 2 +- .../JavaStdlib/JavaIO/generated/Reader.swift | 154 +++- .../JavaIO/generated/StringReader.swift | 74 +- .../JavaIO/generated/StringWriter.swift | 155 ++++ .../JavaIO/generated/WatchService.swift | 12 +- .../JavaStdlib/JavaIO/generated/Writer.swift | 154 +++- Sources/JavaStdlib/JavaIO/swift-java.config | 26 +- Sources/SwiftJava/generated/Charset.swift | 49 ++ Sources/SwiftJava/generated/Closeable.swift | 9 + Sources/SwiftJava/generated/File.swift | 166 ++++ Sources/SwiftJava/generated/Flushable.swift | 9 + .../SwiftJava/generated/OutputStream.swift | 28 + Sources/SwiftJava/generated/Path.swift | 88 +++ .../JavaClassMacroTests.swift | 45 +- 28 files changed, 3240 insertions(+), 134 deletions(-) create mode 100644 Sources/JavaStdlib/JavaIO/Throwable+IO.swift create mode 100644 Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift create mode 100644 Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift create mode 100644 Sources/JavaStdlib/JavaIO/generated/StringWriter.swift create mode 100644 Sources/SwiftJava/generated/Charset.swift create mode 100644 Sources/SwiftJava/generated/Closeable.swift create mode 100644 Sources/SwiftJava/generated/File.swift create mode 100644 Sources/SwiftJava/generated/Flushable.swift create mode 100644 Sources/SwiftJava/generated/OutputStream.swift create mode 100644 Sources/SwiftJava/generated/Path.swift diff --git a/Sources/JavaStdlib/JavaIO/Throwable+IO.swift b/Sources/JavaStdlib/JavaIO/Throwable+IO.swift new file mode 100644 index 000000000..d1b88fec2 --- /dev/null +++ b/Sources/JavaStdlib/JavaIO/Throwable+IO.swift @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2024 Apple Inc. and the Swift.org project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of Swift.org project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +import SwiftJava +import CSwiftJavaJNI + +extension Throwable { + // TODO: We cannot have this method in SwiftJava module unless we also lower PrintStream from JavaIO into SwiftJava + + /// Prints this throwable and its backtrace to the specified print stream. + /// + /// ### Java method signature + /// ``` + /// public void printStackTrace(PrintStream s) + /// ``` + @JavaMethod + func fillInStackTrace(_ writer: PrintWriter?) +} \ No newline at end of file diff --git a/Sources/JavaStdlib/JavaIO/generated/BufferedInputStream.swift b/Sources/JavaStdlib/JavaIO/generated/BufferedInputStream.swift index 2a211eb9a..742482543 100644 --- a/Sources/JavaStdlib/JavaIO/generated/BufferedInputStream.swift +++ b/Sources/JavaStdlib/JavaIO/generated/BufferedInputStream.swift @@ -1,6 +1,6 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.BufferedInputStream") open class BufferedInputStream: InputStream { @@ -10,30 +10,102 @@ open class BufferedInputStream: InputStream { @JavaMethod @_nonoverride public convenience init(_ arg0: InputStream?, _ arg1: Int32, environment: JNIEnvironment? = nil) + /** + * Java method `reset`. + * + * ### Java method signature + * ```java + * public synchronized void java.io.BufferedInputStream.reset() throws java.io.IOException + * ``` + */ @JavaMethod open override func reset() throws + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.BufferedInputStream.close() throws java.io.IOException + * ``` + */ @JavaMethod - open override func read(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + open override func close() throws + /** + * Java method `mark`. + * + * ### Java method signature + * ```java + * public synchronized void java.io.BufferedInputStream.mark(int) + * ``` + */ @JavaMethod - open override func read() throws -> Int32 + open override func mark(_ arg0: Int32) + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public synchronized int java.io.BufferedInputStream.read(byte[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod - open override func close() throws + open override func read(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public synchronized int java.io.BufferedInputStream.read() throws java.io.IOException + * ``` + */ @JavaMethod - open override func mark(_ arg0: Int32) + open override func read() throws -> Int32 + /** + * Java method `transferTo`. + * + * ### Java method signature + * ```java + * public synchronized long java.io.BufferedInputStream.transferTo(java.io.OutputStream) throws java.io.IOException + * ``` + */ @JavaMethod open override func transferTo(_ arg0: OutputStream?) throws -> Int64 + /** + * Java method `skip`. + * + * ### Java method signature + * ```java + * public synchronized long java.io.BufferedInputStream.skip(long) throws java.io.IOException + * ``` + */ @JavaMethod open override func skip(_ arg0: Int64) throws -> Int64 + /** + * Java method `available`. + * + * ### Java method signature + * ```java + * public synchronized int java.io.BufferedInputStream.available() throws java.io.IOException + * ``` + */ @JavaMethod open override func available() throws -> Int32 + /** + * Java method `markSupported`. + * + * ### Java method signature + * ```java + * public boolean java.io.BufferedInputStream.markSupported() + * ``` + */ @JavaMethod open override func markSupported() -> Bool } diff --git a/Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift b/Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift new file mode 100644 index 000000000..a4b9937b5 --- /dev/null +++ b/Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift @@ -0,0 +1,733 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import CSwiftJavaJNI +import SwiftJava + +@JavaClass("java.nio.ByteBuffer") +open class ByteBuffer: JavaObject { + /** + * Java method `reset`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.reset() + * ``` + */ +@JavaMethod + open func reset() -> ByteBuffer! + + /** + * Java method `get`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.get(byte[]) + * ``` + */ +@JavaMethod + open func get(_ arg0: [Int8]) -> ByteBuffer! + + /** + * Java method `get`. + * + * ### Java method signature + * ```java + * public abstract byte java.nio.ByteBuffer.get(int) + * ``` + */ +@JavaMethod + open func get(_ arg0: Int32) -> Int8 + + /** + * Java method `get`. + * + * ### Java method signature + * ```java + * public abstract byte java.nio.ByteBuffer.get() + * ``` + */ +@JavaMethod + open func get() -> Int8 + + /** + * Java method `get`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.get(byte[],int,int) + * ``` + */ +@JavaMethod + open func get(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) -> ByteBuffer! + + /** + * Java method `get`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.get(int,byte[]) + * ``` + */ +@JavaMethod + open func get(_ arg0: Int32, _ arg1: [Int8]) -> ByteBuffer! + + /** + * Java method `get`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.get(int,byte[],int,int) + * ``` + */ +@JavaMethod + open func get(_ arg0: Int32, _ arg1: [Int8], _ arg2: Int32, _ arg3: Int32) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.put(int,byte) + * ``` + */ +@JavaMethod + open func put(_ arg0: Int32, _ arg1: Int8) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.put(java.nio.ByteBuffer) + * ``` + */ +@JavaMethod + open func put(_ arg0: ByteBuffer?) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.put(int,java.nio.ByteBuffer,int,int) + * ``` + */ +@JavaMethod + open func put(_ arg0: Int32, _ arg1: ByteBuffer?, _ arg2: Int32, _ arg3: Int32) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public final java.nio.ByteBuffer java.nio.ByteBuffer.put(byte[]) + * ``` + */ +@JavaMethod + open func put(_ arg0: [Int8]) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.put(int,byte[]) + * ``` + */ +@JavaMethod + open func put(_ arg0: Int32, _ arg1: [Int8]) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.put(int,byte[],int,int) + * ``` + */ +@JavaMethod + open func put(_ arg0: Int32, _ arg1: [Int8], _ arg2: Int32, _ arg3: Int32) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.put(byte[],int,int) + * ``` + */ +@JavaMethod + open func put(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) -> ByteBuffer! + + /** + * Java method `put`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.put(byte) + * ``` + */ +@JavaMethod + open func put(_ arg0: Int8) -> ByteBuffer! + + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public boolean java.nio.ByteBuffer.equals(java.lang.Object) + * ``` + */ +@JavaMethod + open override func equals(_ arg0: JavaObject?) -> Bool + + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public java.lang.String java.nio.ByteBuffer.toString() + * ``` + */ +@JavaMethod + open override func toString() -> String + + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public int java.nio.ByteBuffer.hashCode() + * ``` + */ +@JavaMethod + open override func hashCode() -> Int32 + + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.nio.ByteBuffer.compareTo(java.nio.ByteBuffer) + * ``` + */ +@JavaMethod + open func compareTo(_ arg0: ByteBuffer?) -> Int32 + + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.nio.ByteBuffer.compareTo(java.lang.Object) + * ``` + */ +@JavaMethod + open func compareTo(_ arg0: JavaObject?) -> Int32 + + /** + * Java method `getShort`. + * + * ### Java method signature + * ```java + * public abstract short java.nio.ByteBuffer.getShort() + * ``` + */ +@JavaMethod + open func getShort() -> Int16 + + /** + * Java method `getShort`. + * + * ### Java method signature + * ```java + * public abstract short java.nio.ByteBuffer.getShort(int) + * ``` + */ +@JavaMethod + open func getShort(_ arg0: Int32) -> Int16 + + /** + * Java method `putShort`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putShort(int,short) + * ``` + */ +@JavaMethod + open func putShort(_ arg0: Int32, _ arg1: Int16) -> ByteBuffer! + + /** + * Java method `putShort`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putShort(short) + * ``` + */ +@JavaMethod + open func putShort(_ arg0: Int16) -> ByteBuffer! + + /** + * Java method `getChar`. + * + * ### Java method signature + * ```java + * public abstract char java.nio.ByteBuffer.getChar(int) + * ``` + */ +@JavaMethod + open func getChar(_ arg0: Int32) -> UInt16 + + /** + * Java method `getChar`. + * + * ### Java method signature + * ```java + * public abstract char java.nio.ByteBuffer.getChar() + * ``` + */ +@JavaMethod + open func getChar() -> UInt16 + + /** + * Java method `putChar`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putChar(int,char) + * ``` + */ +@JavaMethod + open func putChar(_ arg0: Int32, _ arg1: UInt16) -> ByteBuffer! + + /** + * Java method `putChar`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putChar(char) + * ``` + */ +@JavaMethod + open func putChar(_ arg0: UInt16) -> ByteBuffer! + + /** + * Java method `getInt`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.ByteBuffer.getInt(int) + * ``` + */ +@JavaMethod + open func getInt(_ arg0: Int32) -> Int32 + + /** + * Java method `getInt`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.ByteBuffer.getInt() + * ``` + */ +@JavaMethod + open func getInt() -> Int32 + + /** + * Java method `putInt`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putInt(int,int) + * ``` + */ +@JavaMethod + open func putInt(_ arg0: Int32, _ arg1: Int32) -> ByteBuffer! + + /** + * Java method `putInt`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putInt(int) + * ``` + */ +@JavaMethod + open func putInt(_ arg0: Int32) -> ByteBuffer! + + /** + * Java method `getLong`. + * + * ### Java method signature + * ```java + * public abstract long java.nio.ByteBuffer.getLong(int) + * ``` + */ +@JavaMethod + open func getLong(_ arg0: Int32) -> Int64 + + /** + * Java method `getLong`. + * + * ### Java method signature + * ```java + * public abstract long java.nio.ByteBuffer.getLong() + * ``` + */ +@JavaMethod + open func getLong() -> Int64 + + /** + * Java method `putLong`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putLong(long) + * ``` + */ +@JavaMethod + open func putLong(_ arg0: Int64) -> ByteBuffer! + + /** + * Java method `putLong`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putLong(int,long) + * ``` + */ +@JavaMethod + open func putLong(_ arg0: Int32, _ arg1: Int64) -> ByteBuffer! + + /** + * Java method `getFloat`. + * + * ### Java method signature + * ```java + * public abstract float java.nio.ByteBuffer.getFloat() + * ``` + */ +@JavaMethod + open func getFloat() -> Float + + /** + * Java method `getFloat`. + * + * ### Java method signature + * ```java + * public abstract float java.nio.ByteBuffer.getFloat(int) + * ``` + */ +@JavaMethod + open func getFloat(_ arg0: Int32) -> Float + + /** + * Java method `putFloat`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putFloat(float) + * ``` + */ +@JavaMethod + open func putFloat(_ arg0: Float) -> ByteBuffer! + + /** + * Java method `putFloat`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putFloat(int,float) + * ``` + */ +@JavaMethod + open func putFloat(_ arg0: Int32, _ arg1: Float) -> ByteBuffer! + + /** + * Java method `getDouble`. + * + * ### Java method signature + * ```java + * public abstract double java.nio.ByteBuffer.getDouble(int) + * ``` + */ +@JavaMethod + open func getDouble(_ arg0: Int32) -> Double + + /** + * Java method `getDouble`. + * + * ### Java method signature + * ```java + * public abstract double java.nio.ByteBuffer.getDouble() + * ``` + */ +@JavaMethod + open func getDouble() -> Double + + /** + * Java method `putDouble`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putDouble(int,double) + * ``` + */ +@JavaMethod + open func putDouble(_ arg0: Int32, _ arg1: Double) -> ByteBuffer! + + /** + * Java method `putDouble`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.putDouble(double) + * ``` + */ +@JavaMethod + open func putDouble(_ arg0: Double) -> ByteBuffer! + + /** + * Java method `clear`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.clear() + * ``` + */ +@JavaMethod + open func clear() -> ByteBuffer! + + /** + * Java method `position`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.position(int) + * ``` + */ +@JavaMethod + open func position(_ arg0: Int32) -> ByteBuffer! + + /** + * Java method `mismatch`. + * + * ### Java method signature + * ```java + * public int java.nio.ByteBuffer.mismatch(java.nio.ByteBuffer) + * ``` + */ +@JavaMethod + open func mismatch(_ arg0: ByteBuffer?) -> Int32 + + /** + * Java method `limit`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.limit(int) + * ``` + */ +@JavaMethod + open func limit(_ arg0: Int32) -> ByteBuffer! + + /** + * Java method `isDirect`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.ByteBuffer.isDirect() + * ``` + */ +@JavaMethod + open func isDirect() -> Bool + + /** + * Java method `hasArray`. + * + * ### Java method signature + * ```java + * public final boolean java.nio.ByteBuffer.hasArray() + * ``` + */ +@JavaMethod + open func hasArray() -> Bool + + /** + * Java method `array`. + * + * ### Java method signature + * ```java + * public final byte[] java.nio.ByteBuffer.array() + * ``` + */ +@JavaMethod + open func array() -> [Int8] + + /** + * Java method `arrayOffset`. + * + * ### Java method signature + * ```java + * public final int java.nio.ByteBuffer.arrayOffset() + * ``` + */ +@JavaMethod + open func arrayOffset() -> Int32 + + /** + * Java method `mark`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.mark() + * ``` + */ +@JavaMethod + open func mark() -> ByteBuffer! + + /** + * Java method `flip`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.flip() + * ``` + */ +@JavaMethod + open func flip() -> ByteBuffer! + + /** + * Java method `rewind`. + * + * ### Java method signature + * ```java + * public java.nio.ByteBuffer java.nio.ByteBuffer.rewind() + * ``` + */ +@JavaMethod + open func rewind() -> ByteBuffer! + + /** + * Java method `slice`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.slice() + * ``` + */ +@JavaMethod + open func slice() -> ByteBuffer! + + /** + * Java method `slice`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.slice(int,int) + * ``` + */ +@JavaMethod + open func slice(_ arg0: Int32, _ arg1: Int32) -> ByteBuffer! + + /** + * Java method `duplicate`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.duplicate() + * ``` + */ +@JavaMethod + open func duplicate() -> ByteBuffer! + + /** + * Java method `alignmentOffset`. + * + * ### Java method signature + * ```java + * public final int java.nio.ByteBuffer.alignmentOffset(int,int) + * ``` + */ +@JavaMethod + open func alignmentOffset(_ arg0: Int32, _ arg1: Int32) -> Int32 + + /** + * Java method `asReadOnlyBuffer`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.asReadOnlyBuffer() + * ``` + */ +@JavaMethod + open func asReadOnlyBuffer() -> ByteBuffer! + + /** + * Java method `compact`. + * + * ### Java method signature + * ```java + * public abstract java.nio.ByteBuffer java.nio.ByteBuffer.compact() + * ``` + */ +@JavaMethod + open func compact() -> ByteBuffer! + + /** + * Java method `alignedSlice`. + * + * ### Java method signature + * ```java + * public final java.nio.ByteBuffer java.nio.ByteBuffer.alignedSlice(int) + * ``` + */ +@JavaMethod + open func alignedSlice(_ arg0: Int32) -> ByteBuffer! +} +extension JavaClass { + /** + * Java method `wrap`. + * + * ### Java method signature + * ```java + * public static java.nio.ByteBuffer java.nio.ByteBuffer.wrap(byte[],int,int) + * ``` + */ +@JavaStaticMethod + public func wrap(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) -> ByteBuffer! + + /** + * Java method `wrap`. + * + * ### Java method signature + * ```java + * public static java.nio.ByteBuffer java.nio.ByteBuffer.wrap(byte[]) + * ``` + */ +@JavaStaticMethod + public func wrap(_ arg0: [Int8]) -> ByteBuffer! + + /** + * Java method `allocate`. + * + * ### Java method signature + * ```java + * public static java.nio.ByteBuffer java.nio.ByteBuffer.allocate(int) + * ``` + */ +@JavaStaticMethod + public func allocate(_ arg0: Int32) -> ByteBuffer! + + /** + * Java method `allocateDirect`. + * + * ### Java method signature + * ```java + * public static java.nio.ByteBuffer java.nio.ByteBuffer.allocateDirect(int) + * ``` + */ +@JavaStaticMethod + public func allocateDirect(_ arg0: Int32) -> ByteBuffer! +} diff --git a/Sources/JavaStdlib/JavaIO/generated/Charset.swift b/Sources/JavaStdlib/JavaIO/generated/Charset.swift index 03e85a8c8..71e50ca67 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Charset.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Charset.swift @@ -1,49 +1,184 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import JavaUtil +import SwiftJava @JavaClass("java.nio.charset.Charset") open class Charset: JavaObject { - @JavaMethod + /** + * Java method `name`. + * + * ### Java method signature + * ```java + * public final java.lang.String java.nio.charset.Charset.name() + * ``` + */ +@JavaMethod open func name() -> String - @JavaMethod + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public final boolean java.nio.charset.Charset.equals(java.lang.Object) + * ``` + */ +@JavaMethod open override func equals(_ arg0: JavaObject?) -> Bool - @JavaMethod + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public final java.lang.String java.nio.charset.Charset.toString() + * ``` + */ +@JavaMethod open override func toString() -> String - @JavaMethod + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public final int java.nio.charset.Charset.hashCode() + * ``` + */ +@JavaMethod open override func hashCode() -> Int32 - @JavaMethod + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.nio.charset.Charset.compareTo(java.lang.Object) + * ``` + */ +@JavaMethod open func compareTo(_ arg0: JavaObject?) -> Int32 - @JavaMethod + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public final int java.nio.charset.Charset.compareTo(java.nio.charset.Charset) + * ``` + */ +@JavaMethod open func compareTo(_ arg0: Charset?) -> Int32 - @JavaMethod + /** + * Java method `encode`. + * + * ### Java method signature + * ```java + * public final java.nio.ByteBuffer java.nio.charset.Charset.encode(java.lang.String) + * ``` + */ +@JavaMethod + open func encode(_ arg0: String) -> ByteBuffer! + + /** + * Java method `canEncode`. + * + * ### Java method signature + * ```java + * public boolean java.nio.charset.Charset.canEncode() + * ``` + */ +@JavaMethod open func canEncode() -> Bool - @JavaMethod + /** + * Java method `contains`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.charset.Charset.contains(java.nio.charset.Charset) + * ``` + */ +@JavaMethod open func contains(_ arg0: Charset?) -> Bool - @JavaMethod + /** + * Java method `isRegistered`. + * + * ### Java method signature + * ```java + * public final boolean java.nio.charset.Charset.isRegistered() + * ``` + */ +@JavaMethod open func isRegistered() -> Bool - @JavaMethod + /** + * Java method `aliases`. + * + * ### Java method signature + * ```java + * public final java.util.Set java.nio.charset.Charset.aliases() + * ``` + */ +@JavaMethod + open func aliases() -> JavaSet! + + /** + * Java method `displayName`. + * + * ### Java method signature + * ```java + * public java.lang.String java.nio.charset.Charset.displayName() + * ``` + */ +@JavaMethod open func displayName() -> String } extension JavaClass { - @JavaStaticMethod + /** + * Java method `forName`. + * + * ### Java method signature + * ```java + * public static java.nio.charset.Charset java.nio.charset.Charset.forName(java.lang.String,java.nio.charset.Charset) + * ``` + */ +@JavaStaticMethod public func forName(_ arg0: String, _ arg1: Charset?) -> Charset! - @JavaStaticMethod + /** + * Java method `forName`. + * + * ### Java method signature + * ```java + * public static java.nio.charset.Charset java.nio.charset.Charset.forName(java.lang.String) + * ``` + */ +@JavaStaticMethod public func forName(_ arg0: String) -> Charset! - @JavaStaticMethod + /** + * Java method `defaultCharset`. + * + * ### Java method signature + * ```java + * public static java.nio.charset.Charset java.nio.charset.Charset.defaultCharset() + * ``` + */ +@JavaStaticMethod public func defaultCharset() -> Charset! - @JavaStaticMethod + /** + * Java method `isSupported`. + * + * ### Java method signature + * ```java + * public static boolean java.nio.charset.Charset.isSupported(java.lang.String) + * ``` + */ +@JavaStaticMethod public func isSupported(_ arg0: String) -> Bool } diff --git a/Sources/JavaStdlib/JavaIO/generated/Closeable.swift b/Sources/JavaStdlib/JavaIO/generated/Closeable.swift index 1df526419..707c59d72 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Closeable.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Closeable.swift @@ -1,9 +1,17 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaInterface("java.io.Closeable") public struct Closeable { - @JavaMethod + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Closeable.close() throws java.io.IOException + * ``` + */ +@JavaMethod public func close() throws } diff --git a/Sources/JavaStdlib/JavaIO/generated/File.swift b/Sources/JavaStdlib/JavaIO/generated/File.swift index 68b04efb4..411bfc095 100644 --- a/Sources/JavaStdlib/JavaIO/generated/File.swift +++ b/Sources/JavaStdlib/JavaIO/generated/File.swift @@ -1,6 +1,6 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.File") open class File: JavaObject { @@ -13,132 +13,476 @@ open class File: JavaObject { @JavaMethod @_nonoverride public convenience init(_ arg0: File?, _ arg1: String, environment: JNIEnvironment? = nil) + /** + * Java method `getName`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getName() + * ``` + */ @JavaMethod open func getName() -> String + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.equals(java.lang.Object) + * ``` + */ @JavaMethod open override func equals(_ arg0: JavaObject?) -> Bool + /** + * Java method `length`. + * + * ### Java method signature + * ```java + * public long java.io.File.length() + * ``` + */ @JavaMethod open func length() -> Int64 + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.toString() + * ``` + */ @JavaMethod open override func toString() -> String + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public int java.io.File.hashCode() + * ``` + */ @JavaMethod open override func hashCode() -> Int32 + /** + * Java method `isHidden`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isHidden() + * ``` + */ @JavaMethod open func isHidden() -> Bool + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.io.File.compareTo(java.io.File) + * ``` + */ @JavaMethod open func compareTo(_ arg0: File?) -> Int32 + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.io.File.compareTo(java.lang.Object) + * ``` + */ @JavaMethod open func compareTo(_ arg0: JavaObject?) -> Int32 + /** + * Java method `list`. + * + * ### Java method signature + * ```java + * public java.lang.String[] java.io.File.list() + * ``` + */ @JavaMethod open func list() -> [String] + /** + * Java method `isAbsolute`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isAbsolute() + * ``` + */ @JavaMethod open func isAbsolute() -> Bool + /** + * Java method `getParent`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getParent() + * ``` + */ @JavaMethod open func getParent() -> String - @JavaMethod - open func delete() -> Bool - + /** + * Java method `setReadOnly`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setReadOnly() + * ``` + */ @JavaMethod open func setReadOnly() -> Bool + /** + * Java method `canRead`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.canRead() + * ``` + */ @JavaMethod open func canRead() -> Bool + /** + * Java method `delete`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.delete() + * ``` + */ + @JavaMethod + open func delete() -> Bool + + /** + * Java method `getPath`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getPath() + * ``` + */ @JavaMethod open func getPath() -> String + /** + * Java method `getAbsolutePath`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getAbsolutePath() + * ``` + */ @JavaMethod open func getAbsolutePath() -> String + /** + * Java method `exists`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.exists() + * ``` + */ @JavaMethod open func exists() -> Bool + /** + * Java method `createNewFile`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.createNewFile() throws java.io.IOException + * ``` + */ @JavaMethod open func createNewFile() throws -> Bool + /** + * Java method `renameTo`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.renameTo(java.io.File) + * ``` + */ @JavaMethod open func renameTo(_ arg0: File?) -> Bool + /** + * Java method `isDirectory`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isDirectory() + * ``` + */ @JavaMethod open func isDirectory() -> Bool + /** + * Java method `getCanonicalPath`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getCanonicalPath() throws java.io.IOException + * ``` + */ @JavaMethod open func getCanonicalPath() throws -> String + /** + * Java method `getAbsoluteFile`. + * + * ### Java method signature + * ```java + * public java.io.File java.io.File.getAbsoluteFile() + * ``` + */ @JavaMethod open func getAbsoluteFile() -> File! + /** + * Java method `mkdir`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.mkdir() + * ``` + */ @JavaMethod open func mkdir() -> Bool + /** + * Java method `getCanonicalFile`. + * + * ### Java method signature + * ```java + * public java.io.File java.io.File.getCanonicalFile() throws java.io.IOException + * ``` + */ @JavaMethod open func getCanonicalFile() throws -> File! + /** + * Java method `getParentFile`. + * + * ### Java method signature + * ```java + * public java.io.File java.io.File.getParentFile() + * ``` + */ @JavaMethod open func getParentFile() -> File! + /** + * Java method `mkdirs`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.mkdirs() + * ``` + */ @JavaMethod open func mkdirs() -> Bool + /** + * Java method `setWritable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setWritable(boolean) + * ``` + */ @JavaMethod open func setWritable(_ arg0: Bool) -> Bool + /** + * Java method `setWritable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setWritable(boolean,boolean) + * ``` + */ @JavaMethod open func setWritable(_ arg0: Bool, _ arg1: Bool) -> Bool + /** + * Java method `setReadable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setReadable(boolean,boolean) + * ``` + */ @JavaMethod open func setReadable(_ arg0: Bool, _ arg1: Bool) -> Bool + /** + * Java method `setReadable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setReadable(boolean) + * ``` + */ @JavaMethod open func setReadable(_ arg0: Bool) -> Bool + /** + * Java method `setExecutable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setExecutable(boolean,boolean) + * ``` + */ @JavaMethod open func setExecutable(_ arg0: Bool, _ arg1: Bool) -> Bool + /** + * Java method `setExecutable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setExecutable(boolean) + * ``` + */ @JavaMethod open func setExecutable(_ arg0: Bool) -> Bool + /** + * Java method `canWrite`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.canWrite() + * ``` + */ @JavaMethod open func canWrite() -> Bool + /** + * Java method `isFile`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isFile() + * ``` + */ @JavaMethod open func isFile() -> Bool + /** + * Java method `lastModified`. + * + * ### Java method signature + * ```java + * public long java.io.File.lastModified() + * ``` + */ @JavaMethod open func lastModified() -> Int64 + /** + * Java method `deleteOnExit`. + * + * ### Java method signature + * ```java + * public void java.io.File.deleteOnExit() + * ``` + */ @JavaMethod open func deleteOnExit() + /** + * Java method `listFiles`. + * + * ### Java method signature + * ```java + * public java.io.File[] java.io.File.listFiles() + * ``` + */ @JavaMethod open func listFiles() -> [File?] + /** + * Java method `setLastModified`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setLastModified(long) + * ``` + */ @JavaMethod open func setLastModified(_ arg0: Int64) -> Bool + /** + * Java method `canExecute`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.canExecute() + * ``` + */ @JavaMethod open func canExecute() -> Bool + /** + * Java method `getTotalSpace`. + * + * ### Java method signature + * ```java + * public long java.io.File.getTotalSpace() + * ``` + */ @JavaMethod open func getTotalSpace() -> Int64 + /** + * Java method `getFreeSpace`. + * + * ### Java method signature + * ```java + * public long java.io.File.getFreeSpace() + * ``` + */ @JavaMethod open func getFreeSpace() -> Int64 + /** + * Java method `getUsableSpace`. + * + * ### Java method signature + * ```java + * public long java.io.File.getUsableSpace() + * ``` + */ @JavaMethod open func getUsableSpace() -> Int64 + /** + * Java method `toPath`. + * + * ### Java method signature + * ```java + * public java.nio.file.Path java.io.File.toPath() + * ``` + */ @JavaMethod open func toPath() -> Path! } @@ -155,12 +499,36 @@ extension JavaClass { @JavaStaticField(isFinal: true) public var pathSeparator: String + /** + * Java method `listRoots`. + * + * ### Java method signature + * ```java + * public static java.io.File[] java.io.File.listRoots() + * ``` + */ @JavaStaticMethod public func listRoots() -> [File?] + /** + * Java method `createTempFile`. + * + * ### Java method signature + * ```java + * public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String) throws java.io.IOException + * ``` + */ @JavaStaticMethod public func createTempFile(_ arg0: String, _ arg1: String) throws -> File! + /** + * Java method `createTempFile`. + * + * ### Java method signature + * ```java + * public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String,java.io.File) throws java.io.IOException + * ``` + */ @JavaStaticMethod public func createTempFile(_ arg0: String, _ arg1: String, _ arg2: File?) throws -> File! } diff --git a/Sources/JavaStdlib/JavaIO/generated/FileDescriptor.swift b/Sources/JavaStdlib/JavaIO/generated/FileDescriptor.swift index 4c95b2b3a..1bb6fc3de 100644 --- a/Sources/JavaStdlib/JavaIO/generated/FileDescriptor.swift +++ b/Sources/JavaStdlib/JavaIO/generated/FileDescriptor.swift @@ -1,15 +1,31 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.FileDescriptor") open class FileDescriptor: JavaObject { @JavaMethod @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + /** + * Java method `sync`. + * + * ### Java method signature + * ```java + * public void java.io.FileDescriptor.sync() throws java.io.SyncFailedException + * ``` + */ @JavaMethod open func sync() throws + /** + * Java method `valid`. + * + * ### Java method signature + * ```java + * public boolean java.io.FileDescriptor.valid() + * ``` + */ @JavaMethod open func valid() -> Bool } diff --git a/Sources/JavaStdlib/JavaIO/generated/FileReader.swift b/Sources/JavaStdlib/JavaIO/generated/FileReader.swift index b793a3f6f..933faeb72 100644 --- a/Sources/JavaStdlib/JavaIO/generated/FileReader.swift +++ b/Sources/JavaStdlib/JavaIO/generated/FileReader.swift @@ -1,6 +1,6 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.FileReader") open class FileReader: InputStreamReader { diff --git a/Sources/JavaStdlib/JavaIO/generated/Flushable.swift b/Sources/JavaStdlib/JavaIO/generated/Flushable.swift index 95cfc4488..183cbb70b 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Flushable.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Flushable.swift @@ -1,9 +1,17 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaInterface("java.io.Flushable") public struct Flushable { - @JavaMethod + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Flushable.flush() throws java.io.IOException + * ``` + */ +@JavaMethod public func flush() throws } diff --git a/Sources/JavaStdlib/JavaIO/generated/InputStream.swift b/Sources/JavaStdlib/JavaIO/generated/InputStream.swift index b42a8fd85..b3261c6a8 100644 --- a/Sources/JavaStdlib/JavaIO/generated/InputStream.swift +++ b/Sources/JavaStdlib/JavaIO/generated/InputStream.swift @@ -1,55 +1,175 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.InputStream", implements: Closeable.self) open class InputStream: JavaObject { @JavaMethod @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + /** + * Java method `reset`. + * + * ### Java method signature + * ```java + * public void java.io.InputStream.reset() throws java.io.IOException + * ``` + */ @JavaMethod open func reset() throws + /** + * Java method `readAllBytes`. + * + * ### Java method signature + * ```java + * public byte[] java.io.InputStream.readAllBytes() throws java.io.IOException + * ``` + */ @JavaMethod - open func read(_ arg0: [Int8]) throws -> Int32 + open func readAllBytes() throws -> [Int8] + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.InputStream.close() throws java.io.IOException + * ``` + */ @JavaMethod - open func read(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + open func close() throws + /** + * Java method `mark`. + * + * ### Java method signature + * ```java + * public void java.io.InputStream.mark(int) + * ``` + */ @JavaMethod - open func read() throws -> Int32 + open func mark(_ arg0: Int32) + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.InputStream.read(byte[]) throws java.io.IOException + * ``` + */ @JavaMethod - open func close() throws + open func read(_ arg0: [Int8]) throws -> Int32 + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.InputStream.read(byte[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod - open func readAllBytes() throws -> [Int8] + open func read(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public abstract int java.io.InputStream.read() throws java.io.IOException + * ``` + */ @JavaMethod - open func mark(_ arg0: Int32) + open func read() throws -> Int32 + /** + * Java method `readNBytes`. + * + * ### Java method signature + * ```java + * public int java.io.InputStream.readNBytes(byte[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod open func readNBytes(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + /** + * Java method `readNBytes`. + * + * ### Java method signature + * ```java + * public byte[] java.io.InputStream.readNBytes(int) throws java.io.IOException + * ``` + */ @JavaMethod open func readNBytes(_ arg0: Int32) throws -> [Int8] + /** + * Java method `transferTo`. + * + * ### Java method signature + * ```java + * public long java.io.InputStream.transferTo(java.io.OutputStream) throws java.io.IOException + * ``` + */ @JavaMethod open func transferTo(_ arg0: OutputStream?) throws -> Int64 + /** + * Java method `skip`. + * + * ### Java method signature + * ```java + * public long java.io.InputStream.skip(long) throws java.io.IOException + * ``` + */ @JavaMethod open func skip(_ arg0: Int64) throws -> Int64 + /** + * Java method `available`. + * + * ### Java method signature + * ```java + * public int java.io.InputStream.available() throws java.io.IOException + * ``` + */ @JavaMethod open func available() throws -> Int32 + /** + * Java method `markSupported`. + * + * ### Java method signature + * ```java + * public boolean java.io.InputStream.markSupported() + * ``` + */ @JavaMethod open func markSupported() -> Bool + /** + * Java method `skipNBytes`. + * + * ### Java method signature + * ```java + * public void java.io.InputStream.skipNBytes(long) throws java.io.IOException + * ``` + */ @JavaMethod open func skipNBytes(_ arg0: Int64) throws } extension JavaClass { - @JavaStaticMethod + /** + * Java method `nullInputStream`. + * + * ### Java method signature + * ```java + * public static java.io.InputStream java.io.InputStream.nullInputStream() + * ``` + */ +@JavaStaticMethod public func nullInputStream() -> InputStream! } diff --git a/Sources/JavaStdlib/JavaIO/generated/InputStreamReader.swift b/Sources/JavaStdlib/JavaIO/generated/InputStreamReader.swift index 7e55d6337..0447b2921 100644 --- a/Sources/JavaStdlib/JavaIO/generated/InputStreamReader.swift +++ b/Sources/JavaStdlib/JavaIO/generated/InputStreamReader.swift @@ -1,6 +1,6 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.InputStreamReader") open class InputStreamReader: Reader { @@ -13,18 +13,58 @@ open class InputStreamReader: Reader { @JavaMethod @_nonoverride public convenience init(_ arg0: InputStream?, environment: JNIEnvironment? = nil) + /** + * Java method `ready`. + * + * ### Java method signature + * ```java + * public boolean java.io.InputStreamReader.ready() throws java.io.IOException + * ``` + */ @JavaMethod open override func ready() throws -> Bool + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.InputStreamReader.close() throws java.io.IOException + * ``` + */ @JavaMethod - open override func read() throws -> Int32 + open override func close() throws + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.InputStreamReader.read(char[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod open override func read(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.InputStreamReader.read() throws java.io.IOException + * ``` + */ @JavaMethod - open override func close() throws + open override func read() throws -> Int32 + /** + * Java method `getEncoding`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.InputStreamReader.getEncoding() + * ``` + */ @JavaMethod open func getEncoding() -> String } diff --git a/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift b/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift index d499508cf..d573e4bc4 100644 --- a/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift +++ b/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift @@ -1,28 +1,76 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.OutputStream", implements: Closeable.self, Flushable.self) open class OutputStream: JavaObject { @JavaMethod @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.flush() throws java.io.IOException + * ``` + */ @JavaMethod open func flush() throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.write(byte[]) throws java.io.IOException + * ``` + */ @JavaMethod open func write(_ arg0: [Int8]) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.write(byte[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod open func write(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public abstract void java.io.OutputStream.write(int) throws java.io.IOException + * ``` + */ @JavaMethod open func write(_ arg0: Int32) throws + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.close() throws java.io.IOException + * ``` + */ @JavaMethod open func close() throws } extension JavaClass { - @JavaStaticMethod + /** + * Java method `nullOutputStream`. + * + * ### Java method signature + * ```java + * public static java.io.OutputStream java.io.OutputStream.nullOutputStream() + * ``` + */ +@JavaStaticMethod public func nullOutputStream() -> OutputStream! } diff --git a/Sources/JavaStdlib/JavaIO/generated/Path.swift b/Sources/JavaStdlib/JavaIO/generated/Path.swift index 235d9cef1..93dc24a79 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Path.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Path.swift @@ -1,88 +1,316 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import JavaUtil +import SwiftJava @JavaInterface("java.nio.file.Path") public struct Path { - @JavaMethod + /** + * Java method `getName`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getName(int) + * ``` + */ +@JavaMethod public func getName(_ arg0: Int32) -> Path! - @JavaMethod + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.equals(java.lang.Object) + * ``` + */ +@JavaMethod public func equals(_ arg0: JavaObject?) -> Bool - @JavaMethod + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public abstract java.lang.String java.nio.file.Path.toString() + * ``` + */ +@JavaMethod public func toString() -> String - @JavaMethod + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.file.Path.hashCode() + * ``` + */ +@JavaMethod public func hashCode() -> Int32 - @JavaMethod + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public default int java.nio.file.Path.compareTo(java.lang.Object) + * ``` + */ +@JavaMethod + public func compareTo(_ arg0: JavaObject?) -> Int32 + + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.file.Path.compareTo(java.nio.file.Path) + * ``` + */ +@JavaMethod public func compareTo(_ arg0: Path?) -> Int32 - @JavaMethod - public func compareTo(_ arg0: JavaObject?) -> Int32 + /** + * Java method `startsWith`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.startsWith(java.nio.file.Path) + * ``` + */ +@JavaMethod + public func startsWith(_ arg0: Path?) -> Bool - @JavaMethod + /** + * Java method `startsWith`. + * + * ### Java method signature + * ```java + * public default boolean java.nio.file.Path.startsWith(java.lang.String) + * ``` + */ +@JavaMethod public func startsWith(_ arg0: String) -> Bool - @JavaMethod - public func startsWith(_ arg0: Path?) -> Bool + /** + * Java method `iterator`. + * + * ### Java method signature + * ```java + * public default java.util.Iterator java.nio.file.Path.iterator() + * ``` + */ +@JavaMethod + public func iterator() -> JavaIterator! - @JavaMethod + /** + * Java method `endsWith`. + * + * ### Java method signature + * ```java + * public default boolean java.nio.file.Path.endsWith(java.lang.String) + * ``` + */ +@JavaMethod public func endsWith(_ arg0: String) -> Bool - @JavaMethod + /** + * Java method `endsWith`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.endsWith(java.nio.file.Path) + * ``` + */ +@JavaMethod public func endsWith(_ arg0: Path?) -> Bool - @JavaMethod + /** + * Java method `isAbsolute`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.isAbsolute() + * ``` + */ +@JavaMethod public func isAbsolute() -> Bool - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolve(java.lang.String,java.lang.String...) + * ``` + */ +@JavaMethod public func resolve(_ arg0: String, _ arg1: [String]) -> Path! - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolve(java.nio.file.Path,java.nio.file.Path...) + * ``` + */ +@JavaMethod public func resolve(_ arg0: Path?, _ arg1: [Path?]) -> Path! - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolve(java.lang.String) + * ``` + */ +@JavaMethod public func resolve(_ arg0: String) -> Path! - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.resolve(java.nio.file.Path) + * ``` + */ +@JavaMethod public func resolve(_ arg0: Path?) -> Path! - @JavaMethod + /** + * Java method `getParent`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getParent() + * ``` + */ +@JavaMethod public func getParent() -> Path! - @JavaMethod + /** + * Java method `getRoot`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getRoot() + * ``` + */ +@JavaMethod public func getRoot() -> Path! - @JavaMethod + /** + * Java method `toFile`. + * + * ### Java method signature + * ```java + * public default java.io.File java.nio.file.Path.toFile() + * ``` + */ +@JavaMethod public func toFile() -> File! - @JavaMethod + /** + * Java method `getFileName`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getFileName() + * ``` + */ +@JavaMethod public func getFileName() -> Path! - @JavaMethod + /** + * Java method `normalize`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.normalize() + * ``` + */ +@JavaMethod public func normalize() -> Path! - @JavaMethod + /** + * Java method `relativize`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.relativize(java.nio.file.Path) + * ``` + */ +@JavaMethod public func relativize(_ arg0: Path?) -> Path! - @JavaMethod - public func getNameCount() -> Int32 - - @JavaMethod + /** + * Java method `toAbsolutePath`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.toAbsolutePath() + * ``` + */ +@JavaMethod public func toAbsolutePath() -> Path! - @JavaMethod + /** + * Java method `resolveSibling`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolveSibling(java.nio.file.Path) + * ``` + */ +@JavaMethod + public func resolveSibling(_ arg0: Path?) -> Path! + + /** + * Java method `resolveSibling`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolveSibling(java.lang.String) + * ``` + */ +@JavaMethod public func resolveSibling(_ arg0: String) -> Path! - @JavaMethod - public func resolveSibling(_ arg0: Path?) -> Path! + /** + * Java method `getNameCount`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.file.Path.getNameCount() + * ``` + */ +@JavaMethod + public func getNameCount() -> Int32 - @JavaMethod + /** + * Java method `subpath`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.subpath(int,int) + * ``` + */ +@JavaMethod public func subpath(_ arg0: Int32, _ arg1: Int32) -> Path! } extension JavaClass { - @JavaStaticMethod + /** + * Java method `of`. + * + * ### Java method signature + * ```java + * public static java.nio.file.Path java.nio.file.Path.of(java.lang.String,java.lang.String...) + * ``` + */ +@JavaStaticMethod public func of(_ arg0: String, _ arg1: [String]) -> Path! } diff --git a/Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift b/Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift new file mode 100644 index 000000000..5ea18244d --- /dev/null +++ b/Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift @@ -0,0 +1,446 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import CSwiftJavaJNI +import SwiftJava + +@JavaClass("java.io.PrintWriter") +open class PrintWriter: Writer { + @JavaMethod + @_nonoverride public convenience init(_ arg0: String, _ arg1: String, environment: JNIEnvironment? = nil) throws + + @JavaMethod + @_nonoverride public convenience init(_ arg0: String, environment: JNIEnvironment? = nil) throws + + @JavaMethod + @_nonoverride public convenience init(_ arg0: String, _ arg1: Charset?, environment: JNIEnvironment? = nil) throws + + @JavaMethod + @_nonoverride public convenience init(_ arg0: File?, environment: JNIEnvironment? = nil) throws + + @JavaMethod + @_nonoverride public convenience init(_ arg0: File?, _ arg1: Charset?, environment: JNIEnvironment? = nil) throws + + @JavaMethod + @_nonoverride public convenience init(_ arg0: File?, _ arg1: String, environment: JNIEnvironment? = nil) throws + + @JavaMethod + @_nonoverride public convenience init(_ arg0: Writer?, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: Writer?, _ arg1: Bool, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: OutputStream?, _ arg1: Bool, _ arg2: Charset?, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: OutputStream?, _ arg1: Bool, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: OutputStream?, environment: JNIEnvironment? = nil) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(double) + * ``` + */ + @JavaMethod + open func println(_ arg0: Double) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(float) + * ``` + */ + @JavaMethod + open func println(_ arg0: Float) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(long) + * ``` + */ + @JavaMethod + open func println(_ arg0: Int64) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(char[]) + * ``` + */ + @JavaMethod + open func println(_ arg0: [UInt16]) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(java.lang.String) + * ``` + */ + @JavaMethod + open func println(_ arg0: String) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(java.lang.Object) + * ``` + */ + @JavaMethod + open func println(_ arg0: JavaObject?) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println() + * ``` + */ + @JavaMethod + open func println() + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(boolean) + * ``` + */ + @JavaMethod + open func println(_ arg0: Bool) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(char) + * ``` + */ + @JavaMethod + open func println(_ arg0: UInt16) + + /** + * Java method `println`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.println(int) + * ``` + */ + @JavaMethod + open func println(_ arg0: Int32) + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.PrintWriter.append(java.lang.CharSequence) throws java.io.IOException + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?) throws -> Appendable! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.PrintWriter java.io.PrintWriter.append(char) + * ``` + */ + @JavaMethod + open override func append(_ arg0: UInt16) -> PrintWriter! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.PrintWriter.append(java.lang.CharSequence,int,int) throws java.io.IOException + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?, _ arg1: Int32, _ arg2: Int32) throws -> Appendable! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.PrintWriter java.io.PrintWriter.append(java.lang.CharSequence,int,int) + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?, _ arg1: Int32, _ arg2: Int32) -> PrintWriter! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.PrintWriter java.io.PrintWriter.append(java.lang.CharSequence) + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?) -> PrintWriter! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.PrintWriter.append(char) throws java.io.IOException + * ``` + */ + @JavaMethod + open override func append(_ arg0: UInt16) throws -> Appendable! + + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.flush() + * ``` + */ + @JavaMethod + open override func flush() + + /** + * Java method `format`. + * + * ### Java method signature + * ```java + * public java.io.PrintWriter java.io.PrintWriter.format(java.lang.String,java.lang.Object...) + * ``` + */ + @JavaMethod + open func format(_ arg0: String, _ arg1: [JavaObject?]) -> PrintWriter! + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(float) + * ``` + */ + @JavaMethod + open func print(_ arg0: Float) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(long) + * ``` + */ + @JavaMethod + open func print(_ arg0: Int64) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(int) + * ``` + */ + @JavaMethod + open func print(_ arg0: Int32) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(char) + * ``` + */ + @JavaMethod + open func print(_ arg0: UInt16) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(boolean) + * ``` + */ + @JavaMethod + open func print(_ arg0: Bool) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(java.lang.Object) + * ``` + */ + @JavaMethod + open func print(_ arg0: JavaObject?) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(java.lang.String) + * ``` + */ + @JavaMethod + open func print(_ arg0: String) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(char[]) + * ``` + */ + @JavaMethod + open func print(_ arg0: [UInt16]) + + /** + * Java method `print`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.print(double) + * ``` + */ + @JavaMethod + open func print(_ arg0: Double) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.write(java.lang.String,int,int) + * ``` + */ + @JavaMethod + open override func write(_ arg0: String, _ arg1: Int32, _ arg2: Int32) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.write(java.lang.String) + * ``` + */ + @JavaMethod + open override func write(_ arg0: String) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.write(char[]) + * ``` + */ + @JavaMethod + open override func write(_ arg0: [UInt16]) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.write(int) + * ``` + */ + @JavaMethod + open override func write(_ arg0: Int32) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.write(char[],int,int) + * ``` + */ + @JavaMethod + open override func write(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) + + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.PrintWriter.close() + * ``` + */ + @JavaMethod + open override func close() + + /** + * Java method `printf`. + * + * ### Java method signature + * ```java + * public java.io.PrintWriter java.io.PrintWriter.printf(java.lang.String,java.lang.Object...) + * ``` + */ + @JavaMethod + open func printf(_ arg0: String, _ arg1: [JavaObject?]) -> PrintWriter! + + /** + * Java method `checkError`. + * + * ### Java method signature + * ```java + * public boolean java.io.PrintWriter.checkError() + * ``` + */ + @JavaMethod + open func checkError() -> Bool + + /** + * Java method `setError`. + * + * ### Java method signature + * ```java + * protected void java.io.PrintWriter.setError() + * ``` + */ + @JavaMethod + open func setError() + + /** + * Java method `clearError`. + * + * ### Java method signature + * ```java + * protected void java.io.PrintWriter.clearError() + * ``` + */ + @JavaMethod + open func clearError() +} diff --git a/Sources/JavaStdlib/JavaIO/generated/Readable.swift b/Sources/JavaStdlib/JavaIO/generated/Readable.swift index 8961e18af..a48e1fafd 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Readable.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Readable.swift @@ -1,6 +1,6 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaInterface("java.lang.Readable") public struct Readable { diff --git a/Sources/JavaStdlib/JavaIO/generated/Reader.swift b/Sources/JavaStdlib/JavaIO/generated/Reader.swift index 5d8f77bf5..c62fd3a63 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Reader.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Reader.swift @@ -1,40 +1,162 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import JavaUtil +import SwiftJava @JavaClass("java.io.Reader", implements: Readable.self, Closeable.self) open class Reader: JavaObject { - @JavaMethod + /** + * Java method `ready`. + * + * ### Java method signature + * ```java + * public boolean java.io.Reader.ready() throws java.io.IOException + * ``` + */ +@JavaMethod open func ready() throws -> Bool - @JavaMethod + /** + * Java method `readAllAsString`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.Reader.readAllAsString() throws java.io.IOException + * ``` + */ +@JavaMethod + open func readAllAsString() throws -> String + + /** + * Java method `reset`. + * + * ### Java method signature + * ```java + * public void java.io.Reader.reset() throws java.io.IOException + * ``` + */ +@JavaMethod open func reset() throws - @JavaMethod + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Reader.close() throws java.io.IOException + * ``` + */ +@JavaMethod + open func close() throws + + /** + * Java method `mark`. + * + * ### Java method signature + * ```java + * public void java.io.Reader.mark(int) throws java.io.IOException + * ``` + */ +@JavaMethod + open func mark(_ arg0: Int32) throws + + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public abstract int java.io.Reader.read(char[],int,int) throws java.io.IOException + * ``` + */ +@JavaMethod open func read(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) throws -> Int32 - @JavaMethod + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.Reader.read() throws java.io.IOException + * ``` + */ +@JavaMethod open func read() throws -> Int32 - @JavaMethod + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.Reader.read(char[]) throws java.io.IOException + * ``` + */ +@JavaMethod open func read(_ arg0: [UInt16]) throws -> Int32 - @JavaMethod - open func close() throws - - @JavaMethod - open func mark(_ arg0: Int32) throws - - @JavaMethod + /** + * Java method `transferTo`. + * + * ### Java method signature + * ```java + * public long java.io.Reader.transferTo(java.io.Writer) throws java.io.IOException + * ``` + */ +@JavaMethod open func transferTo(_ arg0: Writer?) throws -> Int64 - @JavaMethod + /** + * Java method `skip`. + * + * ### Java method signature + * ```java + * public long java.io.Reader.skip(long) throws java.io.IOException + * ``` + */ +@JavaMethod open func skip(_ arg0: Int64) throws -> Int64 - @JavaMethod + /** + * Java method `markSupported`. + * + * ### Java method signature + * ```java + * public boolean java.io.Reader.markSupported() + * ``` + */ +@JavaMethod open func markSupported() -> Bool + + /** + * Java method `readAllLines`. + * + * ### Java method signature + * ```java + * public java.util.List java.io.Reader.readAllLines() throws java.io.IOException + * ``` + */ +@JavaMethod + open func readAllLines() throws -> List! } extension JavaClass { - @JavaStaticMethod + /** + * Java method `nullReader`. + * + * ### Java method signature + * ```java + * public static java.io.Reader java.io.Reader.nullReader() + * ``` + */ +@JavaStaticMethod public func nullReader() -> Reader! + + /** + * Java method `of`. + * + * ### Java method signature + * ```java + * public static java.io.Reader java.io.Reader.of(java.lang.CharSequence) + * ``` + */ +@JavaStaticMethod + public func of(_ arg0: CharSequence?) -> Reader! } diff --git a/Sources/JavaStdlib/JavaIO/generated/StringReader.swift b/Sources/JavaStdlib/JavaIO/generated/StringReader.swift index ae4464ed7..4792e0d6b 100644 --- a/Sources/JavaStdlib/JavaIO/generated/StringReader.swift +++ b/Sources/JavaStdlib/JavaIO/generated/StringReader.swift @@ -1,33 +1,97 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.StringReader") open class StringReader: Reader { @JavaMethod @_nonoverride public convenience init(_ arg0: String, environment: JNIEnvironment? = nil) + /** + * Java method `ready`. + * + * ### Java method signature + * ```java + * public boolean java.io.StringReader.ready() throws java.io.IOException + * ``` + */ @JavaMethod open override func ready() throws -> Bool + /** + * Java method `reset`. + * + * ### Java method signature + * ```java + * public void java.io.StringReader.reset() throws java.io.IOException + * ``` + */ @JavaMethod open override func reset() throws + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.StringReader.close() + * ``` + */ @JavaMethod - open override func read() throws -> Int32 + open override func close() + /** + * Java method `mark`. + * + * ### Java method signature + * ```java + * public void java.io.StringReader.mark(int) throws java.io.IOException + * ``` + */ @JavaMethod - open override func read(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + open override func mark(_ arg0: Int32) throws + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.StringReader.read(char[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod - open override func close() + open override func read(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) throws -> Int32 + /** + * Java method `read`. + * + * ### Java method signature + * ```java + * public int java.io.StringReader.read() throws java.io.IOException + * ``` + */ @JavaMethod - open override func mark(_ arg0: Int32) throws + open override func read() throws -> Int32 + /** + * Java method `skip`. + * + * ### Java method signature + * ```java + * public long java.io.StringReader.skip(long) throws java.io.IOException + * ``` + */ @JavaMethod open override func skip(_ arg0: Int64) throws -> Int64 + /** + * Java method `markSupported`. + * + * ### Java method signature + * ```java + * public boolean java.io.StringReader.markSupported() + * ``` + */ @JavaMethod open override func markSupported() -> Bool } diff --git a/Sources/JavaStdlib/JavaIO/generated/StringWriter.swift b/Sources/JavaStdlib/JavaIO/generated/StringWriter.swift new file mode 100644 index 000000000..cd4179da2 --- /dev/null +++ b/Sources/JavaStdlib/JavaIO/generated/StringWriter.swift @@ -0,0 +1,155 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import CSwiftJavaJNI +import SwiftJava + +@JavaClass("java.io.StringWriter") +open class StringWriter: Writer { + @JavaMethod + @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: Int32, environment: JNIEnvironment? = nil) + + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.StringWriter.toString() + * ``` + */ + @JavaMethod + open override func toString() -> String + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.StringWriter java.io.StringWriter.append(java.lang.CharSequence,int,int) + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?, _ arg1: Int32, _ arg2: Int32) -> StringWriter! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.StringWriter java.io.StringWriter.append(char) + * ``` + */ + @JavaMethod + open override func append(_ arg0: UInt16) -> StringWriter! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.StringWriter java.io.StringWriter.append(java.lang.CharSequence) + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?) -> StringWriter! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.StringWriter.append(java.lang.CharSequence) throws java.io.IOException + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?) throws -> Appendable! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.StringWriter.append(java.lang.CharSequence,int,int) throws java.io.IOException + * ``` + */ + @JavaMethod + open override func append(_ arg0: CharSequence?, _ arg1: Int32, _ arg2: Int32) throws -> Appendable! + + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.StringWriter.append(char) throws java.io.IOException + * ``` + */ + @JavaMethod + open override func append(_ arg0: UInt16) throws -> Appendable! + + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public void java.io.StringWriter.flush() + * ``` + */ + @JavaMethod + open override func flush() + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.StringWriter.write(char[],int,int) + * ``` + */ + @JavaMethod + open override func write(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.StringWriter.write(java.lang.String,int,int) + * ``` + */ + @JavaMethod + open override func write(_ arg0: String, _ arg1: Int32, _ arg2: Int32) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.StringWriter.write(java.lang.String) + * ``` + */ + @JavaMethod + open override func write(_ arg0: String) + + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.StringWriter.write(int) + * ``` + */ + @JavaMethod + open override func write(_ arg0: Int32) + + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.StringWriter.close() throws java.io.IOException + * ``` + */ + @JavaMethod + open override func close() throws +} diff --git a/Sources/JavaStdlib/JavaIO/generated/WatchService.swift b/Sources/JavaStdlib/JavaIO/generated/WatchService.swift index e2c570a30..c330d94b8 100644 --- a/Sources/JavaStdlib/JavaIO/generated/WatchService.swift +++ b/Sources/JavaStdlib/JavaIO/generated/WatchService.swift @@ -1,9 +1,17 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaInterface("java.nio.file.WatchService", extends: Closeable.self) public struct WatchService { - @JavaMethod + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public abstract void java.nio.file.WatchService.close() throws java.io.IOException + * ``` + */ +@JavaMethod public func close() throws } diff --git a/Sources/JavaStdlib/JavaIO/generated/Writer.swift b/Sources/JavaStdlib/JavaIO/generated/Writer.swift index fe20d27d5..beeff6306 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Writer.swift +++ b/Sources/JavaStdlib/JavaIO/generated/Writer.swift @@ -1,49 +1,161 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI +import SwiftJava @JavaClass("java.io.Writer", implements: Appendable.self, Closeable.self, Flushable.self) open class Writer: JavaObject { - @JavaMethod - open func append(_ arg0: UInt16) throws -> Writer! - - @JavaMethod + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.Writer java.io.Writer.append(java.lang.CharSequence,int,int) throws java.io.IOException + * ``` + */ +@JavaMethod open func append(_ arg0: CharSequence?, _ arg1: Int32, _ arg2: Int32) throws -> Writer! - @JavaMethod - open func append(_ arg0: CharSequence?) throws -> Writer! + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.Writer java.io.Writer.append(char) throws java.io.IOException + * ``` + */ +@JavaMethod + open func append(_ arg0: UInt16) throws -> Writer! - @JavaMethod + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.Writer.append(java.lang.CharSequence) throws java.io.IOException + * ``` + */ +@JavaMethod open func append(_ arg0: CharSequence?) throws -> Appendable! - @JavaMethod + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.Writer.append(char) throws java.io.IOException + * ``` + */ +@JavaMethod open func append(_ arg0: UInt16) throws -> Appendable! - @JavaMethod + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.lang.Appendable java.io.Writer.append(java.lang.CharSequence,int,int) throws java.io.IOException + * ``` + */ +@JavaMethod open func append(_ arg0: CharSequence?, _ arg1: Int32, _ arg2: Int32) throws -> Appendable! - @JavaMethod + /** + * Java method `append`. + * + * ### Java method signature + * ```java + * public java.io.Writer java.io.Writer.append(java.lang.CharSequence) throws java.io.IOException + * ``` + */ +@JavaMethod + open func append(_ arg0: CharSequence?) throws -> Writer! + + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Writer.flush() throws java.io.IOException + * ``` + */ +@JavaMethod open func flush() throws - @JavaMethod - open func write(_ arg0: Int32) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.Writer.write(java.lang.String,int,int) throws java.io.IOException + * ``` + */ +@JavaMethod + open func write(_ arg0: String, _ arg1: Int32, _ arg2: Int32) throws - @JavaMethod - open func write(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.Writer.write(int) throws java.io.IOException + * ``` + */ +@JavaMethod + open func write(_ arg0: Int32) throws - @JavaMethod + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.Writer.write(java.lang.String) throws java.io.IOException + * ``` + */ +@JavaMethod open func write(_ arg0: String) throws - @JavaMethod - open func write(_ arg0: String, _ arg1: Int32, _ arg2: Int32) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Writer.write(char[],int,int) throws java.io.IOException + * ``` + */ +@JavaMethod + open func write(_ arg0: [UInt16], _ arg1: Int32, _ arg2: Int32) throws - @JavaMethod + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.Writer.write(char[]) throws java.io.IOException + * ``` + */ +@JavaMethod open func write(_ arg0: [UInt16]) throws - @JavaMethod + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Writer.close() throws java.io.IOException + * ``` + */ +@JavaMethod open func close() throws } extension JavaClass { - @JavaStaticMethod + /** + * Java method `nullWriter`. + * + * ### Java method signature + * ```java + * public static java.io.Writer java.io.Writer.nullWriter() + * ``` + */ +@JavaStaticMethod public func nullWriter() -> Writer! } diff --git a/Sources/JavaStdlib/JavaIO/swift-java.config b/Sources/JavaStdlib/JavaIO/swift-java.config index 571e02162..f1677c531 100644 --- a/Sources/JavaStdlib/JavaIO/swift-java.config +++ b/Sources/JavaStdlib/JavaIO/swift-java.config @@ -1,21 +1,29 @@ { "classes" : { - "java.io.FileReader" : "FileReader", - "java.io.StringReader" : "StringReader", - "java.io.InputStreamReader" : "InputStreamReader", - "java.io.BufferedInputStream" : "BufferedInputStream", + "java.lang.Readable" : "Readable", + "java.io.Closeable" : "Closeable", + "java.io.Flushable" : "Flushable", + "java.io.InputStream" : "InputStream", + "java.io.BufferedInputStream" : "BufferedInputStream", + "java.io.InputStreamReader" : "InputStreamReader", + "java.io.OutputStream" : "OutputStream", + "java.io.Reader" : "Reader", - "java.lang.Readable" : "Readable", + "java.io.FileReader" : "FileReader", + "java.io.StringReader" : "StringReader", + "java.io.Writer" : "Writer", + "java.io.PrintWriter" : "PrintWriter", + "java.io.StringWriter" : "StringWriter", + "java.io.File" : "File", - "java.io.Closeable" : "Closeable", - "java.nio.file.Path" : "Path", "java.io.FileDescriptor" : "FileDescriptor", + + "java.nio.file.Path" : "Path", "java.nio.charset.Charset" : "Charset", - "java.io.Flushable" : "Flushable", - "java.io.Flushable" : "ByteBuffer", + "java.nio.ByteBuffer" : "ByteBuffer", "java.nio.file.WatchService" : "WatchService", } } diff --git a/Sources/SwiftJava/generated/Charset.swift b/Sources/SwiftJava/generated/Charset.swift new file mode 100644 index 000000000..03e85a8c8 --- /dev/null +++ b/Sources/SwiftJava/generated/Charset.swift @@ -0,0 +1,49 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import SwiftJava +import CSwiftJavaJNI + +@JavaClass("java.nio.charset.Charset") +open class Charset: JavaObject { + @JavaMethod + open func name() -> String + + @JavaMethod + open override func equals(_ arg0: JavaObject?) -> Bool + + @JavaMethod + open override func toString() -> String + + @JavaMethod + open override func hashCode() -> Int32 + + @JavaMethod + open func compareTo(_ arg0: JavaObject?) -> Int32 + + @JavaMethod + open func compareTo(_ arg0: Charset?) -> Int32 + + @JavaMethod + open func canEncode() -> Bool + + @JavaMethod + open func contains(_ arg0: Charset?) -> Bool + + @JavaMethod + open func isRegistered() -> Bool + + @JavaMethod + open func displayName() -> String +} +extension JavaClass { + @JavaStaticMethod + public func forName(_ arg0: String, _ arg1: Charset?) -> Charset! + + @JavaStaticMethod + public func forName(_ arg0: String) -> Charset! + + @JavaStaticMethod + public func defaultCharset() -> Charset! + + @JavaStaticMethod + public func isSupported(_ arg0: String) -> Bool +} diff --git a/Sources/SwiftJava/generated/Closeable.swift b/Sources/SwiftJava/generated/Closeable.swift new file mode 100644 index 000000000..1df526419 --- /dev/null +++ b/Sources/SwiftJava/generated/Closeable.swift @@ -0,0 +1,9 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import SwiftJava +import CSwiftJavaJNI + +@JavaInterface("java.io.Closeable") +public struct Closeable { + @JavaMethod + public func close() throws +} diff --git a/Sources/SwiftJava/generated/File.swift b/Sources/SwiftJava/generated/File.swift new file mode 100644 index 000000000..68b04efb4 --- /dev/null +++ b/Sources/SwiftJava/generated/File.swift @@ -0,0 +1,166 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import SwiftJava +import CSwiftJavaJNI + +@JavaClass("java.io.File") +open class File: JavaObject { + @JavaMethod + @_nonoverride public convenience init(_ arg0: String, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: String, _ arg1: String, environment: JNIEnvironment? = nil) + + @JavaMethod + @_nonoverride public convenience init(_ arg0: File?, _ arg1: String, environment: JNIEnvironment? = nil) + + @JavaMethod + open func getName() -> String + + @JavaMethod + open override func equals(_ arg0: JavaObject?) -> Bool + + @JavaMethod + open func length() -> Int64 + + @JavaMethod + open override func toString() -> String + + @JavaMethod + open override func hashCode() -> Int32 + + @JavaMethod + open func isHidden() -> Bool + + @JavaMethod + open func compareTo(_ arg0: File?) -> Int32 + + @JavaMethod + open func compareTo(_ arg0: JavaObject?) -> Int32 + + @JavaMethod + open func list() -> [String] + + @JavaMethod + open func isAbsolute() -> Bool + + @JavaMethod + open func getParent() -> String + + @JavaMethod + open func delete() -> Bool + + @JavaMethod + open func setReadOnly() -> Bool + + @JavaMethod + open func canRead() -> Bool + + @JavaMethod + open func getPath() -> String + + @JavaMethod + open func getAbsolutePath() -> String + + @JavaMethod + open func exists() -> Bool + + @JavaMethod + open func createNewFile() throws -> Bool + + @JavaMethod + open func renameTo(_ arg0: File?) -> Bool + + @JavaMethod + open func isDirectory() -> Bool + + @JavaMethod + open func getCanonicalPath() throws -> String + + @JavaMethod + open func getAbsoluteFile() -> File! + + @JavaMethod + open func mkdir() -> Bool + + @JavaMethod + open func getCanonicalFile() throws -> File! + + @JavaMethod + open func getParentFile() -> File! + + @JavaMethod + open func mkdirs() -> Bool + + @JavaMethod + open func setWritable(_ arg0: Bool) -> Bool + + @JavaMethod + open func setWritable(_ arg0: Bool, _ arg1: Bool) -> Bool + + @JavaMethod + open func setReadable(_ arg0: Bool, _ arg1: Bool) -> Bool + + @JavaMethod + open func setReadable(_ arg0: Bool) -> Bool + + @JavaMethod + open func setExecutable(_ arg0: Bool, _ arg1: Bool) -> Bool + + @JavaMethod + open func setExecutable(_ arg0: Bool) -> Bool + + @JavaMethod + open func canWrite() -> Bool + + @JavaMethod + open func isFile() -> Bool + + @JavaMethod + open func lastModified() -> Int64 + + @JavaMethod + open func deleteOnExit() + + @JavaMethod + open func listFiles() -> [File?] + + @JavaMethod + open func setLastModified(_ arg0: Int64) -> Bool + + @JavaMethod + open func canExecute() -> Bool + + @JavaMethod + open func getTotalSpace() -> Int64 + + @JavaMethod + open func getFreeSpace() -> Int64 + + @JavaMethod + open func getUsableSpace() -> Int64 + + @JavaMethod + open func toPath() -> Path! +} +extension JavaClass { + @JavaStaticField(isFinal: true) + public var separatorChar: UInt16 + + @JavaStaticField(isFinal: true) + public var separator: String + + @JavaStaticField(isFinal: true) + public var pathSeparatorChar: UInt16 + + @JavaStaticField(isFinal: true) + public var pathSeparator: String + + @JavaStaticMethod + public func listRoots() -> [File?] + + @JavaStaticMethod + public func createTempFile(_ arg0: String, _ arg1: String) throws -> File! + + @JavaStaticMethod + public func createTempFile(_ arg0: String, _ arg1: String, _ arg2: File?) throws -> File! +} diff --git a/Sources/SwiftJava/generated/Flushable.swift b/Sources/SwiftJava/generated/Flushable.swift new file mode 100644 index 000000000..95cfc4488 --- /dev/null +++ b/Sources/SwiftJava/generated/Flushable.swift @@ -0,0 +1,9 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import SwiftJava +import CSwiftJavaJNI + +@JavaInterface("java.io.Flushable") +public struct Flushable { + @JavaMethod + public func flush() throws +} diff --git a/Sources/SwiftJava/generated/OutputStream.swift b/Sources/SwiftJava/generated/OutputStream.swift new file mode 100644 index 000000000..d499508cf --- /dev/null +++ b/Sources/SwiftJava/generated/OutputStream.swift @@ -0,0 +1,28 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import SwiftJava +import CSwiftJavaJNI + +@JavaClass("java.io.OutputStream", implements: Closeable.self, Flushable.self) +open class OutputStream: JavaObject { + @JavaMethod + @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + + @JavaMethod + open func flush() throws + + @JavaMethod + open func write(_ arg0: [Int8]) throws + + @JavaMethod + open func write(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws + + @JavaMethod + open func write(_ arg0: Int32) throws + + @JavaMethod + open func close() throws +} +extension JavaClass { + @JavaStaticMethod + public func nullOutputStream() -> OutputStream! +} diff --git a/Sources/SwiftJava/generated/Path.swift b/Sources/SwiftJava/generated/Path.swift new file mode 100644 index 000000000..235d9cef1 --- /dev/null +++ b/Sources/SwiftJava/generated/Path.swift @@ -0,0 +1,88 @@ +// Auto-generated by Java-to-Swift wrapper generator. +import SwiftJava +import CSwiftJavaJNI + +@JavaInterface("java.nio.file.Path") +public struct Path { + @JavaMethod + public func getName(_ arg0: Int32) -> Path! + + @JavaMethod + public func equals(_ arg0: JavaObject?) -> Bool + + @JavaMethod + public func toString() -> String + + @JavaMethod + public func hashCode() -> Int32 + + @JavaMethod + public func compareTo(_ arg0: Path?) -> Int32 + + @JavaMethod + public func compareTo(_ arg0: JavaObject?) -> Int32 + + @JavaMethod + public func startsWith(_ arg0: String) -> Bool + + @JavaMethod + public func startsWith(_ arg0: Path?) -> Bool + + @JavaMethod + public func endsWith(_ arg0: String) -> Bool + + @JavaMethod + public func endsWith(_ arg0: Path?) -> Bool + + @JavaMethod + public func isAbsolute() -> Bool + + @JavaMethod + public func resolve(_ arg0: String, _ arg1: [String]) -> Path! + + @JavaMethod + public func resolve(_ arg0: Path?, _ arg1: [Path?]) -> Path! + + @JavaMethod + public func resolve(_ arg0: String) -> Path! + + @JavaMethod + public func resolve(_ arg0: Path?) -> Path! + + @JavaMethod + public func getParent() -> Path! + + @JavaMethod + public func getRoot() -> Path! + + @JavaMethod + public func toFile() -> File! + + @JavaMethod + public func getFileName() -> Path! + + @JavaMethod + public func normalize() -> Path! + + @JavaMethod + public func relativize(_ arg0: Path?) -> Path! + + @JavaMethod + public func getNameCount() -> Int32 + + @JavaMethod + public func toAbsolutePath() -> Path! + + @JavaMethod + public func resolveSibling(_ arg0: String) -> Path! + + @JavaMethod + public func resolveSibling(_ arg0: Path?) -> Path! + + @JavaMethod + public func subpath(_ arg0: Int32, _ arg1: Int32) -> Path! +} +extension JavaClass { + @JavaStaticMethod + public func of(_ arg0: String, _ arg1: [String]) -> Path! +} diff --git a/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift b/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift index 85a124760..173383469 100644 --- a/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift +++ b/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift @@ -128,7 +128,16 @@ class JavaKitMacroTests: XCTestCase { self = try! Self.dynamicJavaNewObject(in: _environment, arguments: value.self) } public func isBigEnough(_: Int32) -> Bool { - return try! dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) + return { + do { + return try dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) + } catch { + if let throwable = error as? Throwable { + throwable.printStackTrace() + } + fatalError("Java call threw unhandled exception: \\(error)") + } + }() } public var myField: Int64 { get { @@ -224,7 +233,16 @@ class JavaKitMacroTests: XCTestCase { self.init(javaThis: javaThis, environment: _environment) } public func isBigEnough(_: Int32) -> Bool { - return try! dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) + return { + do { + return try dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) + } catch { + if let throwable = error as? Throwable { + throwable.printStackTrace() + } + fatalError("Java call threw unhandled exception: \\(error)") + } + }() } public var myField: Int64 { get { @@ -290,7 +308,16 @@ class JavaKitMacroTests: XCTestCase { self.init(javaThis: javaThis, environment: _environment) } public func isBigEnough(_: Int32) -> Bool { - return try! dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) + return { + do { + return try dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) + } catch { + if let throwable = error as? Throwable { + throwable.printStackTrace() + } + fatalError("Java call threw unhandled exception: \\(error)") + } + }() } /// The full Java class name for this Swift type. @@ -326,7 +353,17 @@ class JavaKitMacroTests: XCTestCase { open class JavaOptional: JavaObject { open func get() -> T! { /* convert erased return value to T */ - if let result$ = try! dynamicJavaMethodCall(methodName: "get", resultType: /*type-erased:T*/ JavaObject?.self) { + let result$ = { + do { + return try dynamicJavaMethodCall(methodName: "get", resultType: /*type-erased:T*/ JavaObject?.self) + } catch { + if let throwable = error as? Throwable { + throwable.printStackTrace() + } + fatalError("Java call threw unhandled exception: \\(error)") + } + }() + if let result$ { return T(javaThis: result$.javaThis, environment: try! JavaVirtualMachine.shared().environment()) } else { return nil From 028b701fcbeac1366afef7710bc1d3ec73ddf9a6 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Thu, 22 Jan 2026 20:16:00 +0900 Subject: [PATCH 3/4] reorganize types so that SwiftJava/Throwable can gain func printStackTrace(_ writer: PrintWriter?) --- Sources/JavaStdlib/JavaIO/Throwable+IO.swift | 29 - .../JavaStdlib/JavaIO/generated/Charset.swift | 184 ------ .../JavaIO/generated/Closeable.swift | 17 - .../JavaStdlib/JavaIO/generated/File.swift | 534 ------------------ .../JavaIO/generated/Flushable.swift | 17 - .../JavaIO/generated/OutputStream.swift | 76 --- .../JavaStdlib/JavaIO/generated/Path.swift | 316 ----------- Sources/JavaStdlib/JavaIO/swift-java.config | 14 - Sources/JavaStdlib/JavaUtil/swift-java.config | 5 - .../JavaUtilFunction/swift-java.config | 2 - .../JavaIterator+Iterator.swift | 1 - .../JavaExtensions}/List+Sequence.swift | 3 +- .../generated/ByteBuffer.swift | 1 - Sources/SwiftJava/generated/Charset.swift | 163 +++++- Sources/SwiftJava/generated/Closeable.swift | 11 +- Sources/SwiftJava/generated/File.swift | 375 +++++++++++- Sources/SwiftJava/generated/Flushable.swift | 11 +- .../generated/JavaCollection.swift | 1 - .../generated/JavaIterator.swift | 1 - .../generated/JavaSet.swift | 1 - .../generated/List.swift | 1 - .../generated/ListIterator.swift | 1 - .../SwiftJava/generated/OutputStream.swift | 51 +- Sources/SwiftJava/generated/Path.swift | 292 ++++++++-- .../generated/PrintWriter.swift | 1 - .../generated/Readable.swift | 1 - .../generated/StringWriter.swift | 1 - Sources/SwiftJava/generated/Throwable.swift | 3 + .../generated/Writer.swift | 1 - Sources/SwiftJava/swift-java.config | 23 +- Sources/SwiftJavaMacros/JavaMethodMacro.swift | 5 +- .../JavaClassMacroTests.swift | 20 +- 32 files changed, 891 insertions(+), 1271 deletions(-) delete mode 100644 Sources/JavaStdlib/JavaIO/Throwable+IO.swift delete mode 100644 Sources/JavaStdlib/JavaIO/generated/Charset.swift delete mode 100644 Sources/JavaStdlib/JavaIO/generated/Closeable.swift delete mode 100644 Sources/JavaStdlib/JavaIO/generated/File.swift delete mode 100644 Sources/JavaStdlib/JavaIO/generated/Flushable.swift delete mode 100644 Sources/JavaStdlib/JavaIO/generated/OutputStream.swift delete mode 100644 Sources/JavaStdlib/JavaIO/generated/Path.swift rename Sources/{JavaStdlib/JavaUtil => SwiftJava/JavaExtensions}/JavaIterator+Iterator.swift (97%) rename Sources/{JavaStdlib/JavaUtil => SwiftJava/JavaExtensions}/List+Sequence.swift (99%) rename Sources/{JavaStdlib/JavaIO => SwiftJava}/generated/ByteBuffer.swift (99%) rename Sources/{JavaStdlib/JavaUtil => SwiftJava}/generated/JavaCollection.swift (98%) rename Sources/{JavaStdlib/JavaUtil => SwiftJava}/generated/JavaIterator.swift (94%) rename Sources/{JavaStdlib/JavaUtil => SwiftJava}/generated/JavaSet.swift (99%) rename Sources/{JavaStdlib/JavaUtil => SwiftJava}/generated/List.swift (99%) rename Sources/{JavaStdlib/JavaUtil => SwiftJava}/generated/ListIterator.swift (97%) rename Sources/{JavaStdlib/JavaIO => SwiftJava}/generated/PrintWriter.swift (99%) rename Sources/{JavaStdlib/JavaIO => SwiftJava}/generated/Readable.swift (89%) rename Sources/{JavaStdlib/JavaIO => SwiftJava}/generated/StringWriter.swift (99%) rename Sources/{JavaStdlib/JavaIO => SwiftJava}/generated/Writer.swift (99%) diff --git a/Sources/JavaStdlib/JavaIO/Throwable+IO.swift b/Sources/JavaStdlib/JavaIO/Throwable+IO.swift deleted file mode 100644 index d1b88fec2..000000000 --- a/Sources/JavaStdlib/JavaIO/Throwable+IO.swift +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2024 Apple Inc. and the Swift.org project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of Swift.org project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -import SwiftJava -import CSwiftJavaJNI - -extension Throwable { - // TODO: We cannot have this method in SwiftJava module unless we also lower PrintStream from JavaIO into SwiftJava - - /// Prints this throwable and its backtrace to the specified print stream. - /// - /// ### Java method signature - /// ``` - /// public void printStackTrace(PrintStream s) - /// ``` - @JavaMethod - func fillInStackTrace(_ writer: PrintWriter?) -} \ No newline at end of file diff --git a/Sources/JavaStdlib/JavaIO/generated/Charset.swift b/Sources/JavaStdlib/JavaIO/generated/Charset.swift deleted file mode 100644 index 71e50ca67..000000000 --- a/Sources/JavaStdlib/JavaIO/generated/Charset.swift +++ /dev/null @@ -1,184 +0,0 @@ -// Auto-generated by Java-to-Swift wrapper generator. -import CSwiftJavaJNI -import JavaUtil -import SwiftJava - -@JavaClass("java.nio.charset.Charset") -open class Charset: JavaObject { - /** - * Java method `name`. - * - * ### Java method signature - * ```java - * public final java.lang.String java.nio.charset.Charset.name() - * ``` - */ -@JavaMethod - open func name() -> String - - /** - * Java method `equals`. - * - * ### Java method signature - * ```java - * public final boolean java.nio.charset.Charset.equals(java.lang.Object) - * ``` - */ -@JavaMethod - open override func equals(_ arg0: JavaObject?) -> Bool - - /** - * Java method `toString`. - * - * ### Java method signature - * ```java - * public final java.lang.String java.nio.charset.Charset.toString() - * ``` - */ -@JavaMethod - open override func toString() -> String - - /** - * Java method `hashCode`. - * - * ### Java method signature - * ```java - * public final int java.nio.charset.Charset.hashCode() - * ``` - */ -@JavaMethod - open override func hashCode() -> Int32 - - /** - * Java method `compareTo`. - * - * ### Java method signature - * ```java - * public int java.nio.charset.Charset.compareTo(java.lang.Object) - * ``` - */ -@JavaMethod - open func compareTo(_ arg0: JavaObject?) -> Int32 - - /** - * Java method `compareTo`. - * - * ### Java method signature - * ```java - * public final int java.nio.charset.Charset.compareTo(java.nio.charset.Charset) - * ``` - */ -@JavaMethod - open func compareTo(_ arg0: Charset?) -> Int32 - - /** - * Java method `encode`. - * - * ### Java method signature - * ```java - * public final java.nio.ByteBuffer java.nio.charset.Charset.encode(java.lang.String) - * ``` - */ -@JavaMethod - open func encode(_ arg0: String) -> ByteBuffer! - - /** - * Java method `canEncode`. - * - * ### Java method signature - * ```java - * public boolean java.nio.charset.Charset.canEncode() - * ``` - */ -@JavaMethod - open func canEncode() -> Bool - - /** - * Java method `contains`. - * - * ### Java method signature - * ```java - * public abstract boolean java.nio.charset.Charset.contains(java.nio.charset.Charset) - * ``` - */ -@JavaMethod - open func contains(_ arg0: Charset?) -> Bool - - /** - * Java method `isRegistered`. - * - * ### Java method signature - * ```java - * public final boolean java.nio.charset.Charset.isRegistered() - * ``` - */ -@JavaMethod - open func isRegistered() -> Bool - - /** - * Java method `aliases`. - * - * ### Java method signature - * ```java - * public final java.util.Set java.nio.charset.Charset.aliases() - * ``` - */ -@JavaMethod - open func aliases() -> JavaSet! - - /** - * Java method `displayName`. - * - * ### Java method signature - * ```java - * public java.lang.String java.nio.charset.Charset.displayName() - * ``` - */ -@JavaMethod - open func displayName() -> String -} -extension JavaClass { - /** - * Java method `forName`. - * - * ### Java method signature - * ```java - * public static java.nio.charset.Charset java.nio.charset.Charset.forName(java.lang.String,java.nio.charset.Charset) - * ``` - */ -@JavaStaticMethod - public func forName(_ arg0: String, _ arg1: Charset?) -> Charset! - - /** - * Java method `forName`. - * - * ### Java method signature - * ```java - * public static java.nio.charset.Charset java.nio.charset.Charset.forName(java.lang.String) - * ``` - */ -@JavaStaticMethod - public func forName(_ arg0: String) -> Charset! - - /** - * Java method `defaultCharset`. - * - * ### Java method signature - * ```java - * public static java.nio.charset.Charset java.nio.charset.Charset.defaultCharset() - * ``` - */ -@JavaStaticMethod - public func defaultCharset() -> Charset! - - /** - * Java method `isSupported`. - * - * ### Java method signature - * ```java - * public static boolean java.nio.charset.Charset.isSupported(java.lang.String) - * ``` - */ -@JavaStaticMethod - public func isSupported(_ arg0: String) -> Bool -} diff --git a/Sources/JavaStdlib/JavaIO/generated/Closeable.swift b/Sources/JavaStdlib/JavaIO/generated/Closeable.swift deleted file mode 100644 index 707c59d72..000000000 --- a/Sources/JavaStdlib/JavaIO/generated/Closeable.swift +++ /dev/null @@ -1,17 +0,0 @@ -// Auto-generated by Java-to-Swift wrapper generator. -import CSwiftJavaJNI -import SwiftJava - -@JavaInterface("java.io.Closeable") -public struct Closeable { - /** - * Java method `close`. - * - * ### Java method signature - * ```java - * public abstract void java.io.Closeable.close() throws java.io.IOException - * ``` - */ -@JavaMethod - public func close() throws -} diff --git a/Sources/JavaStdlib/JavaIO/generated/File.swift b/Sources/JavaStdlib/JavaIO/generated/File.swift deleted file mode 100644 index 411bfc095..000000000 --- a/Sources/JavaStdlib/JavaIO/generated/File.swift +++ /dev/null @@ -1,534 +0,0 @@ -// Auto-generated by Java-to-Swift wrapper generator. -import CSwiftJavaJNI -import SwiftJava - -@JavaClass("java.io.File") -open class File: JavaObject { - @JavaMethod - @_nonoverride public convenience init(_ arg0: String, environment: JNIEnvironment? = nil) - - @JavaMethod - @_nonoverride public convenience init(_ arg0: String, _ arg1: String, environment: JNIEnvironment? = nil) - - @JavaMethod - @_nonoverride public convenience init(_ arg0: File?, _ arg1: String, environment: JNIEnvironment? = nil) - - /** - * Java method `getName`. - * - * ### Java method signature - * ```java - * public java.lang.String java.io.File.getName() - * ``` - */ - @JavaMethod - open func getName() -> String - - /** - * Java method `equals`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.equals(java.lang.Object) - * ``` - */ - @JavaMethod - open override func equals(_ arg0: JavaObject?) -> Bool - - /** - * Java method `length`. - * - * ### Java method signature - * ```java - * public long java.io.File.length() - * ``` - */ - @JavaMethod - open func length() -> Int64 - - /** - * Java method `toString`. - * - * ### Java method signature - * ```java - * public java.lang.String java.io.File.toString() - * ``` - */ - @JavaMethod - open override func toString() -> String - - /** - * Java method `hashCode`. - * - * ### Java method signature - * ```java - * public int java.io.File.hashCode() - * ``` - */ - @JavaMethod - open override func hashCode() -> Int32 - - /** - * Java method `isHidden`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.isHidden() - * ``` - */ - @JavaMethod - open func isHidden() -> Bool - - /** - * Java method `compareTo`. - * - * ### Java method signature - * ```java - * public int java.io.File.compareTo(java.io.File) - * ``` - */ - @JavaMethod - open func compareTo(_ arg0: File?) -> Int32 - - /** - * Java method `compareTo`. - * - * ### Java method signature - * ```java - * public int java.io.File.compareTo(java.lang.Object) - * ``` - */ - @JavaMethod - open func compareTo(_ arg0: JavaObject?) -> Int32 - - /** - * Java method `list`. - * - * ### Java method signature - * ```java - * public java.lang.String[] java.io.File.list() - * ``` - */ - @JavaMethod - open func list() -> [String] - - /** - * Java method `isAbsolute`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.isAbsolute() - * ``` - */ - @JavaMethod - open func isAbsolute() -> Bool - - /** - * Java method `getParent`. - * - * ### Java method signature - * ```java - * public java.lang.String java.io.File.getParent() - * ``` - */ - @JavaMethod - open func getParent() -> String - - /** - * Java method `setReadOnly`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setReadOnly() - * ``` - */ - @JavaMethod - open func setReadOnly() -> Bool - - /** - * Java method `canRead`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.canRead() - * ``` - */ - @JavaMethod - open func canRead() -> Bool - - /** - * Java method `delete`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.delete() - * ``` - */ - @JavaMethod - open func delete() -> Bool - - /** - * Java method `getPath`. - * - * ### Java method signature - * ```java - * public java.lang.String java.io.File.getPath() - * ``` - */ - @JavaMethod - open func getPath() -> String - - /** - * Java method `getAbsolutePath`. - * - * ### Java method signature - * ```java - * public java.lang.String java.io.File.getAbsolutePath() - * ``` - */ - @JavaMethod - open func getAbsolutePath() -> String - - /** - * Java method `exists`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.exists() - * ``` - */ - @JavaMethod - open func exists() -> Bool - - /** - * Java method `createNewFile`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.createNewFile() throws java.io.IOException - * ``` - */ - @JavaMethod - open func createNewFile() throws -> Bool - - /** - * Java method `renameTo`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.renameTo(java.io.File) - * ``` - */ - @JavaMethod - open func renameTo(_ arg0: File?) -> Bool - - /** - * Java method `isDirectory`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.isDirectory() - * ``` - */ - @JavaMethod - open func isDirectory() -> Bool - - /** - * Java method `getCanonicalPath`. - * - * ### Java method signature - * ```java - * public java.lang.String java.io.File.getCanonicalPath() throws java.io.IOException - * ``` - */ - @JavaMethod - open func getCanonicalPath() throws -> String - - /** - * Java method `getAbsoluteFile`. - * - * ### Java method signature - * ```java - * public java.io.File java.io.File.getAbsoluteFile() - * ``` - */ - @JavaMethod - open func getAbsoluteFile() -> File! - - /** - * Java method `mkdir`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.mkdir() - * ``` - */ - @JavaMethod - open func mkdir() -> Bool - - /** - * Java method `getCanonicalFile`. - * - * ### Java method signature - * ```java - * public java.io.File java.io.File.getCanonicalFile() throws java.io.IOException - * ``` - */ - @JavaMethod - open func getCanonicalFile() throws -> File! - - /** - * Java method `getParentFile`. - * - * ### Java method signature - * ```java - * public java.io.File java.io.File.getParentFile() - * ``` - */ - @JavaMethod - open func getParentFile() -> File! - - /** - * Java method `mkdirs`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.mkdirs() - * ``` - */ - @JavaMethod - open func mkdirs() -> Bool - - /** - * Java method `setWritable`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setWritable(boolean) - * ``` - */ - @JavaMethod - open func setWritable(_ arg0: Bool) -> Bool - - /** - * Java method `setWritable`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setWritable(boolean,boolean) - * ``` - */ - @JavaMethod - open func setWritable(_ arg0: Bool, _ arg1: Bool) -> Bool - - /** - * Java method `setReadable`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setReadable(boolean,boolean) - * ``` - */ - @JavaMethod - open func setReadable(_ arg0: Bool, _ arg1: Bool) -> Bool - - /** - * Java method `setReadable`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setReadable(boolean) - * ``` - */ - @JavaMethod - open func setReadable(_ arg0: Bool) -> Bool - - /** - * Java method `setExecutable`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setExecutable(boolean,boolean) - * ``` - */ - @JavaMethod - open func setExecutable(_ arg0: Bool, _ arg1: Bool) -> Bool - - /** - * Java method `setExecutable`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setExecutable(boolean) - * ``` - */ - @JavaMethod - open func setExecutable(_ arg0: Bool) -> Bool - - /** - * Java method `canWrite`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.canWrite() - * ``` - */ - @JavaMethod - open func canWrite() -> Bool - - /** - * Java method `isFile`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.isFile() - * ``` - */ - @JavaMethod - open func isFile() -> Bool - - /** - * Java method `lastModified`. - * - * ### Java method signature - * ```java - * public long java.io.File.lastModified() - * ``` - */ - @JavaMethod - open func lastModified() -> Int64 - - /** - * Java method `deleteOnExit`. - * - * ### Java method signature - * ```java - * public void java.io.File.deleteOnExit() - * ``` - */ - @JavaMethod - open func deleteOnExit() - - /** - * Java method `listFiles`. - * - * ### Java method signature - * ```java - * public java.io.File[] java.io.File.listFiles() - * ``` - */ - @JavaMethod - open func listFiles() -> [File?] - - /** - * Java method `setLastModified`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.setLastModified(long) - * ``` - */ - @JavaMethod - open func setLastModified(_ arg0: Int64) -> Bool - - /** - * Java method `canExecute`. - * - * ### Java method signature - * ```java - * public boolean java.io.File.canExecute() - * ``` - */ - @JavaMethod - open func canExecute() -> Bool - - /** - * Java method `getTotalSpace`. - * - * ### Java method signature - * ```java - * public long java.io.File.getTotalSpace() - * ``` - */ - @JavaMethod - open func getTotalSpace() -> Int64 - - /** - * Java method `getFreeSpace`. - * - * ### Java method signature - * ```java - * public long java.io.File.getFreeSpace() - * ``` - */ - @JavaMethod - open func getFreeSpace() -> Int64 - - /** - * Java method `getUsableSpace`. - * - * ### Java method signature - * ```java - * public long java.io.File.getUsableSpace() - * ``` - */ - @JavaMethod - open func getUsableSpace() -> Int64 - - /** - * Java method `toPath`. - * - * ### Java method signature - * ```java - * public java.nio.file.Path java.io.File.toPath() - * ``` - */ - @JavaMethod - open func toPath() -> Path! -} -extension JavaClass { - @JavaStaticField(isFinal: true) - public var separatorChar: UInt16 - - @JavaStaticField(isFinal: true) - public var separator: String - - @JavaStaticField(isFinal: true) - public var pathSeparatorChar: UInt16 - - @JavaStaticField(isFinal: true) - public var pathSeparator: String - - /** - * Java method `listRoots`. - * - * ### Java method signature - * ```java - * public static java.io.File[] java.io.File.listRoots() - * ``` - */ - @JavaStaticMethod - public func listRoots() -> [File?] - - /** - * Java method `createTempFile`. - * - * ### Java method signature - * ```java - * public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String) throws java.io.IOException - * ``` - */ - @JavaStaticMethod - public func createTempFile(_ arg0: String, _ arg1: String) throws -> File! - - /** - * Java method `createTempFile`. - * - * ### Java method signature - * ```java - * public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String,java.io.File) throws java.io.IOException - * ``` - */ - @JavaStaticMethod - public func createTempFile(_ arg0: String, _ arg1: String, _ arg2: File?) throws -> File! -} diff --git a/Sources/JavaStdlib/JavaIO/generated/Flushable.swift b/Sources/JavaStdlib/JavaIO/generated/Flushable.swift deleted file mode 100644 index 183cbb70b..000000000 --- a/Sources/JavaStdlib/JavaIO/generated/Flushable.swift +++ /dev/null @@ -1,17 +0,0 @@ -// Auto-generated by Java-to-Swift wrapper generator. -import CSwiftJavaJNI -import SwiftJava - -@JavaInterface("java.io.Flushable") -public struct Flushable { - /** - * Java method `flush`. - * - * ### Java method signature - * ```java - * public abstract void java.io.Flushable.flush() throws java.io.IOException - * ``` - */ -@JavaMethod - public func flush() throws -} diff --git a/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift b/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift deleted file mode 100644 index d573e4bc4..000000000 --- a/Sources/JavaStdlib/JavaIO/generated/OutputStream.swift +++ /dev/null @@ -1,76 +0,0 @@ -// Auto-generated by Java-to-Swift wrapper generator. -import CSwiftJavaJNI -import SwiftJava - -@JavaClass("java.io.OutputStream", implements: Closeable.self, Flushable.self) -open class OutputStream: JavaObject { - @JavaMethod - @_nonoverride public convenience init(environment: JNIEnvironment? = nil) - - /** - * Java method `flush`. - * - * ### Java method signature - * ```java - * public void java.io.OutputStream.flush() throws java.io.IOException - * ``` - */ - @JavaMethod - open func flush() throws - - /** - * Java method `write`. - * - * ### Java method signature - * ```java - * public void java.io.OutputStream.write(byte[]) throws java.io.IOException - * ``` - */ - @JavaMethod - open func write(_ arg0: [Int8]) throws - - /** - * Java method `write`. - * - * ### Java method signature - * ```java - * public void java.io.OutputStream.write(byte[],int,int) throws java.io.IOException - * ``` - */ - @JavaMethod - open func write(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws - - /** - * Java method `write`. - * - * ### Java method signature - * ```java - * public abstract void java.io.OutputStream.write(int) throws java.io.IOException - * ``` - */ - @JavaMethod - open func write(_ arg0: Int32) throws - - /** - * Java method `close`. - * - * ### Java method signature - * ```java - * public void java.io.OutputStream.close() throws java.io.IOException - * ``` - */ - @JavaMethod - open func close() throws -} -extension JavaClass { - /** - * Java method `nullOutputStream`. - * - * ### Java method signature - * ```java - * public static java.io.OutputStream java.io.OutputStream.nullOutputStream() - * ``` - */ -@JavaStaticMethod - public func nullOutputStream() -> OutputStream! -} diff --git a/Sources/JavaStdlib/JavaIO/generated/Path.swift b/Sources/JavaStdlib/JavaIO/generated/Path.swift deleted file mode 100644 index 93dc24a79..000000000 --- a/Sources/JavaStdlib/JavaIO/generated/Path.swift +++ /dev/null @@ -1,316 +0,0 @@ -// Auto-generated by Java-to-Swift wrapper generator. -import CSwiftJavaJNI -import JavaUtil -import SwiftJava - -@JavaInterface("java.nio.file.Path") -public struct Path { - /** - * Java method `getName`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.getName(int) - * ``` - */ -@JavaMethod - public func getName(_ arg0: Int32) -> Path! - - /** - * Java method `equals`. - * - * ### Java method signature - * ```java - * public abstract boolean java.nio.file.Path.equals(java.lang.Object) - * ``` - */ -@JavaMethod - public func equals(_ arg0: JavaObject?) -> Bool - - /** - * Java method `toString`. - * - * ### Java method signature - * ```java - * public abstract java.lang.String java.nio.file.Path.toString() - * ``` - */ -@JavaMethod - public func toString() -> String - - /** - * Java method `hashCode`. - * - * ### Java method signature - * ```java - * public abstract int java.nio.file.Path.hashCode() - * ``` - */ -@JavaMethod - public func hashCode() -> Int32 - - /** - * Java method `compareTo`. - * - * ### Java method signature - * ```java - * public default int java.nio.file.Path.compareTo(java.lang.Object) - * ``` - */ -@JavaMethod - public func compareTo(_ arg0: JavaObject?) -> Int32 - - /** - * Java method `compareTo`. - * - * ### Java method signature - * ```java - * public abstract int java.nio.file.Path.compareTo(java.nio.file.Path) - * ``` - */ -@JavaMethod - public func compareTo(_ arg0: Path?) -> Int32 - - /** - * Java method `startsWith`. - * - * ### Java method signature - * ```java - * public abstract boolean java.nio.file.Path.startsWith(java.nio.file.Path) - * ``` - */ -@JavaMethod - public func startsWith(_ arg0: Path?) -> Bool - - /** - * Java method `startsWith`. - * - * ### Java method signature - * ```java - * public default boolean java.nio.file.Path.startsWith(java.lang.String) - * ``` - */ -@JavaMethod - public func startsWith(_ arg0: String) -> Bool - - /** - * Java method `iterator`. - * - * ### Java method signature - * ```java - * public default java.util.Iterator java.nio.file.Path.iterator() - * ``` - */ -@JavaMethod - public func iterator() -> JavaIterator! - - /** - * Java method `endsWith`. - * - * ### Java method signature - * ```java - * public default boolean java.nio.file.Path.endsWith(java.lang.String) - * ``` - */ -@JavaMethod - public func endsWith(_ arg0: String) -> Bool - - /** - * Java method `endsWith`. - * - * ### Java method signature - * ```java - * public abstract boolean java.nio.file.Path.endsWith(java.nio.file.Path) - * ``` - */ -@JavaMethod - public func endsWith(_ arg0: Path?) -> Bool - - /** - * Java method `isAbsolute`. - * - * ### Java method signature - * ```java - * public abstract boolean java.nio.file.Path.isAbsolute() - * ``` - */ -@JavaMethod - public func isAbsolute() -> Bool - - /** - * Java method `resolve`. - * - * ### Java method signature - * ```java - * public default java.nio.file.Path java.nio.file.Path.resolve(java.lang.String,java.lang.String...) - * ``` - */ -@JavaMethod - public func resolve(_ arg0: String, _ arg1: [String]) -> Path! - - /** - * Java method `resolve`. - * - * ### Java method signature - * ```java - * public default java.nio.file.Path java.nio.file.Path.resolve(java.nio.file.Path,java.nio.file.Path...) - * ``` - */ -@JavaMethod - public func resolve(_ arg0: Path?, _ arg1: [Path?]) -> Path! - - /** - * Java method `resolve`. - * - * ### Java method signature - * ```java - * public default java.nio.file.Path java.nio.file.Path.resolve(java.lang.String) - * ``` - */ -@JavaMethod - public func resolve(_ arg0: String) -> Path! - - /** - * Java method `resolve`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.resolve(java.nio.file.Path) - * ``` - */ -@JavaMethod - public func resolve(_ arg0: Path?) -> Path! - - /** - * Java method `getParent`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.getParent() - * ``` - */ -@JavaMethod - public func getParent() -> Path! - - /** - * Java method `getRoot`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.getRoot() - * ``` - */ -@JavaMethod - public func getRoot() -> Path! - - /** - * Java method `toFile`. - * - * ### Java method signature - * ```java - * public default java.io.File java.nio.file.Path.toFile() - * ``` - */ -@JavaMethod - public func toFile() -> File! - - /** - * Java method `getFileName`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.getFileName() - * ``` - */ -@JavaMethod - public func getFileName() -> Path! - - /** - * Java method `normalize`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.normalize() - * ``` - */ -@JavaMethod - public func normalize() -> Path! - - /** - * Java method `relativize`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.relativize(java.nio.file.Path) - * ``` - */ -@JavaMethod - public func relativize(_ arg0: Path?) -> Path! - - /** - * Java method `toAbsolutePath`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.toAbsolutePath() - * ``` - */ -@JavaMethod - public func toAbsolutePath() -> Path! - - /** - * Java method `resolveSibling`. - * - * ### Java method signature - * ```java - * public default java.nio.file.Path java.nio.file.Path.resolveSibling(java.nio.file.Path) - * ``` - */ -@JavaMethod - public func resolveSibling(_ arg0: Path?) -> Path! - - /** - * Java method `resolveSibling`. - * - * ### Java method signature - * ```java - * public default java.nio.file.Path java.nio.file.Path.resolveSibling(java.lang.String) - * ``` - */ -@JavaMethod - public func resolveSibling(_ arg0: String) -> Path! - - /** - * Java method `getNameCount`. - * - * ### Java method signature - * ```java - * public abstract int java.nio.file.Path.getNameCount() - * ``` - */ -@JavaMethod - public func getNameCount() -> Int32 - - /** - * Java method `subpath`. - * - * ### Java method signature - * ```java - * public abstract java.nio.file.Path java.nio.file.Path.subpath(int,int) - * ``` - */ -@JavaMethod - public func subpath(_ arg0: Int32, _ arg1: Int32) -> Path! -} -extension JavaClass { - /** - * Java method `of`. - * - * ### Java method signature - * ```java - * public static java.nio.file.Path java.nio.file.Path.of(java.lang.String,java.lang.String...) - * ``` - */ -@JavaStaticMethod - public func of(_ arg0: String, _ arg1: [String]) -> Path! -} diff --git a/Sources/JavaStdlib/JavaIO/swift-java.config b/Sources/JavaStdlib/JavaIO/swift-java.config index f1677c531..1b8c152f9 100644 --- a/Sources/JavaStdlib/JavaIO/swift-java.config +++ b/Sources/JavaStdlib/JavaIO/swift-java.config @@ -1,29 +1,15 @@ { "classes" : { - "java.lang.Readable" : "Readable", - "java.io.Closeable" : "Closeable", - "java.io.Flushable" : "Flushable", - "java.io.InputStream" : "InputStream", "java.io.BufferedInputStream" : "BufferedInputStream", "java.io.InputStreamReader" : "InputStreamReader", - "java.io.OutputStream" : "OutputStream", - "java.io.Reader" : "Reader", "java.io.FileReader" : "FileReader", "java.io.StringReader" : "StringReader", - "java.io.Writer" : "Writer", - "java.io.PrintWriter" : "PrintWriter", - "java.io.StringWriter" : "StringWriter", - - "java.io.File" : "File", "java.io.FileDescriptor" : "FileDescriptor", - "java.nio.file.Path" : "Path", - "java.nio.charset.Charset" : "Charset", - "java.nio.ByteBuffer" : "ByteBuffer", "java.nio.file.WatchService" : "WatchService", } } diff --git a/Sources/JavaStdlib/JavaUtil/swift-java.config b/Sources/JavaStdlib/JavaUtil/swift-java.config index a809cb8c6..5a414200c 100644 --- a/Sources/JavaStdlib/JavaUtil/swift-java.config +++ b/Sources/JavaStdlib/JavaUtil/swift-java.config @@ -1,13 +1,8 @@ { "classes" : { - "java.util.Collection" : "JavaCollection", "java.util.Enumeration" : "Enumeration", - "java.util.Iterator" : "JavaIterator", - "java.util.List" : "List", - "java.util.ListIterator" : "ListIterator", "java.util.Queue" : "Queue", "java.util.RandomAccess" : "RandomAccess", - "java.util.Set" : "JavaSet", "java.util.ArrayDeque" : "ArrayDeque", "java.util.ArrayList" : "ArrayList", "java.util.BitSet" : "BitSet", diff --git a/Sources/JavaStdlib/JavaUtilFunction/swift-java.config b/Sources/JavaStdlib/JavaUtilFunction/swift-java.config index 93debe571..4aa1fd9b1 100644 --- a/Sources/JavaStdlib/JavaUtilFunction/swift-java.config +++ b/Sources/JavaStdlib/JavaUtilFunction/swift-java.config @@ -2,7 +2,6 @@ "classes" : { "java.util.function.BiConsumer" : "JavaBiConsumer", "java.util.function.BiFunction" : "JavaBiFunction", - "java.util.function.BinaryOperator" : "JavaBinaryOperator", "java.util.function.BiPredicate" : "JavaBiPredicate", "java.util.function.BinaryOperator" : "JavaBinaryOperator", "java.util.function.BooleanSupplier" : "JavaBooleanSupplier", @@ -18,7 +17,6 @@ "java.util.function.Function" : "JavaFunction", "java.util.function.IntBinaryOperator" : "JavaIntBinaryOperator", "java.util.function.IntConsumer" : "JavaIntConsumer", - "java.util.function.IntConsumer" : "JavaIntConsumer", "java.util.function.IntFunction" : "JavaIntFunction", "java.util.function.IntPredicate" : "JavaIntPredicate", "java.util.function.IntSupplier" : "JavaIntSupplier", diff --git a/Sources/JavaStdlib/JavaUtil/JavaIterator+Iterator.swift b/Sources/SwiftJava/JavaExtensions/JavaIterator+Iterator.swift similarity index 97% rename from Sources/JavaStdlib/JavaUtil/JavaIterator+Iterator.swift rename to Sources/SwiftJava/JavaExtensions/JavaIterator+Iterator.swift index ad4275270..fe82074d8 100644 --- a/Sources/JavaStdlib/JavaUtil/JavaIterator+Iterator.swift +++ b/Sources/SwiftJava/JavaExtensions/JavaIterator+Iterator.swift @@ -11,7 +11,6 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -import SwiftJava extension JavaIterator: IteratorProtocol { public typealias Element = E diff --git a/Sources/JavaStdlib/JavaUtil/List+Sequence.swift b/Sources/SwiftJava/JavaExtensions/List+Sequence.swift similarity index 99% rename from Sources/JavaStdlib/JavaUtil/List+Sequence.swift rename to Sources/SwiftJava/JavaExtensions/List+Sequence.swift index b36295698..77313759d 100644 --- a/Sources/JavaStdlib/JavaUtil/List+Sequence.swift +++ b/Sources/SwiftJava/JavaExtensions/List+Sequence.swift @@ -19,5 +19,4 @@ extension List: Sequence { public func makeIterator() -> Iterator { return self.iterator()!.as(JavaIterator.self)! } -} - +} \ No newline at end of file diff --git a/Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift b/Sources/SwiftJava/generated/ByteBuffer.swift similarity index 99% rename from Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift rename to Sources/SwiftJava/generated/ByteBuffer.swift index a4b9937b5..600a334b5 100644 --- a/Sources/JavaStdlib/JavaIO/generated/ByteBuffer.swift +++ b/Sources/SwiftJava/generated/ByteBuffer.swift @@ -1,6 +1,5 @@ // Auto-generated by Java-to-Swift wrapper generator. import CSwiftJavaJNI -import SwiftJava @JavaClass("java.nio.ByteBuffer") open class ByteBuffer: JavaObject { diff --git a/Sources/SwiftJava/generated/Charset.swift b/Sources/SwiftJava/generated/Charset.swift index 03e85a8c8..b6935bdbb 100644 --- a/Sources/SwiftJava/generated/Charset.swift +++ b/Sources/SwiftJava/generated/Charset.swift @@ -1,49 +1,182 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaClass("java.nio.charset.Charset") open class Charset: JavaObject { - @JavaMethod + /** + * Java method `name`. + * + * ### Java method signature + * ```java + * public final java.lang.String java.nio.charset.Charset.name() + * ``` + */ +@JavaMethod open func name() -> String - @JavaMethod + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public final boolean java.nio.charset.Charset.equals(java.lang.Object) + * ``` + */ +@JavaMethod open override func equals(_ arg0: JavaObject?) -> Bool - @JavaMethod + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public final java.lang.String java.nio.charset.Charset.toString() + * ``` + */ +@JavaMethod open override func toString() -> String - @JavaMethod + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public final int java.nio.charset.Charset.hashCode() + * ``` + */ +@JavaMethod open override func hashCode() -> Int32 - @JavaMethod + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.nio.charset.Charset.compareTo(java.lang.Object) + * ``` + */ +@JavaMethod open func compareTo(_ arg0: JavaObject?) -> Int32 - @JavaMethod + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public final int java.nio.charset.Charset.compareTo(java.nio.charset.Charset) + * ``` + */ +@JavaMethod open func compareTo(_ arg0: Charset?) -> Int32 - @JavaMethod + /** + * Java method `encode`. + * + * ### Java method signature + * ```java + * public final java.nio.ByteBuffer java.nio.charset.Charset.encode(java.lang.String) + * ``` + */ +@JavaMethod + open func encode(_ arg0: String) -> ByteBuffer! + + /** + * Java method `canEncode`. + * + * ### Java method signature + * ```java + * public boolean java.nio.charset.Charset.canEncode() + * ``` + */ +@JavaMethod open func canEncode() -> Bool - @JavaMethod + /** + * Java method `contains`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.charset.Charset.contains(java.nio.charset.Charset) + * ``` + */ +@JavaMethod open func contains(_ arg0: Charset?) -> Bool - @JavaMethod + /** + * Java method `isRegistered`. + * + * ### Java method signature + * ```java + * public final boolean java.nio.charset.Charset.isRegistered() + * ``` + */ +@JavaMethod open func isRegistered() -> Bool - @JavaMethod + /** + * Java method `aliases`. + * + * ### Java method signature + * ```java + * public final java.util.Set java.nio.charset.Charset.aliases() + * ``` + */ +@JavaMethod + open func aliases() -> JavaSet! + + /** + * Java method `displayName`. + * + * ### Java method signature + * ```java + * public java.lang.String java.nio.charset.Charset.displayName() + * ``` + */ +@JavaMethod open func displayName() -> String } extension JavaClass { - @JavaStaticMethod + /** + * Java method `forName`. + * + * ### Java method signature + * ```java + * public static java.nio.charset.Charset java.nio.charset.Charset.forName(java.lang.String,java.nio.charset.Charset) + * ``` + */ +@JavaStaticMethod public func forName(_ arg0: String, _ arg1: Charset?) -> Charset! - @JavaStaticMethod + /** + * Java method `forName`. + * + * ### Java method signature + * ```java + * public static java.nio.charset.Charset java.nio.charset.Charset.forName(java.lang.String) + * ``` + */ +@JavaStaticMethod public func forName(_ arg0: String) -> Charset! - @JavaStaticMethod + /** + * Java method `defaultCharset`. + * + * ### Java method signature + * ```java + * public static java.nio.charset.Charset java.nio.charset.Charset.defaultCharset() + * ``` + */ +@JavaStaticMethod public func defaultCharset() -> Charset! - @JavaStaticMethod + /** + * Java method `isSupported`. + * + * ### Java method signature + * ```java + * public static boolean java.nio.charset.Charset.isSupported(java.lang.String) + * ``` + */ +@JavaStaticMethod public func isSupported(_ arg0: String) -> Bool } diff --git a/Sources/SwiftJava/generated/Closeable.swift b/Sources/SwiftJava/generated/Closeable.swift index 1df526419..39d68a360 100644 --- a/Sources/SwiftJava/generated/Closeable.swift +++ b/Sources/SwiftJava/generated/Closeable.swift @@ -1,9 +1,16 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.io.Closeable") public struct Closeable { - @JavaMethod + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Closeable.close() throws java.io.IOException + * ``` + */ +@JavaMethod public func close() throws } diff --git a/Sources/SwiftJava/generated/File.swift b/Sources/SwiftJava/generated/File.swift index 68b04efb4..431122c01 100644 --- a/Sources/SwiftJava/generated/File.swift +++ b/Sources/SwiftJava/generated/File.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaClass("java.io.File") @@ -13,132 +12,476 @@ open class File: JavaObject { @JavaMethod @_nonoverride public convenience init(_ arg0: File?, _ arg1: String, environment: JNIEnvironment? = nil) + /** + * Java method `getName`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getName() + * ``` + */ @JavaMethod open func getName() -> String + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.equals(java.lang.Object) + * ``` + */ @JavaMethod open override func equals(_ arg0: JavaObject?) -> Bool + /** + * Java method `length`. + * + * ### Java method signature + * ```java + * public long java.io.File.length() + * ``` + */ @JavaMethod open func length() -> Int64 + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.toString() + * ``` + */ @JavaMethod open override func toString() -> String + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public int java.io.File.hashCode() + * ``` + */ @JavaMethod open override func hashCode() -> Int32 + /** + * Java method `isHidden`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isHidden() + * ``` + */ @JavaMethod open func isHidden() -> Bool + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.io.File.compareTo(java.io.File) + * ``` + */ @JavaMethod open func compareTo(_ arg0: File?) -> Int32 + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public int java.io.File.compareTo(java.lang.Object) + * ``` + */ @JavaMethod open func compareTo(_ arg0: JavaObject?) -> Int32 + /** + * Java method `list`. + * + * ### Java method signature + * ```java + * public java.lang.String[] java.io.File.list() + * ``` + */ @JavaMethod open func list() -> [String] + /** + * Java method `isAbsolute`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isAbsolute() + * ``` + */ @JavaMethod open func isAbsolute() -> Bool + /** + * Java method `getParent`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getParent() + * ``` + */ @JavaMethod open func getParent() -> String - @JavaMethod - open func delete() -> Bool - + /** + * Java method `setReadOnly`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setReadOnly() + * ``` + */ @JavaMethod open func setReadOnly() -> Bool + /** + * Java method `canRead`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.canRead() + * ``` + */ @JavaMethod open func canRead() -> Bool + /** + * Java method `delete`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.delete() + * ``` + */ + @JavaMethod + open func delete() -> Bool + + /** + * Java method `getPath`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getPath() + * ``` + */ @JavaMethod open func getPath() -> String + /** + * Java method `getAbsolutePath`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getAbsolutePath() + * ``` + */ @JavaMethod open func getAbsolutePath() -> String + /** + * Java method `exists`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.exists() + * ``` + */ @JavaMethod open func exists() -> Bool + /** + * Java method `createNewFile`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.createNewFile() throws java.io.IOException + * ``` + */ @JavaMethod open func createNewFile() throws -> Bool + /** + * Java method `renameTo`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.renameTo(java.io.File) + * ``` + */ @JavaMethod open func renameTo(_ arg0: File?) -> Bool + /** + * Java method `isDirectory`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isDirectory() + * ``` + */ @JavaMethod open func isDirectory() -> Bool + /** + * Java method `getCanonicalPath`. + * + * ### Java method signature + * ```java + * public java.lang.String java.io.File.getCanonicalPath() throws java.io.IOException + * ``` + */ @JavaMethod open func getCanonicalPath() throws -> String + /** + * Java method `getAbsoluteFile`. + * + * ### Java method signature + * ```java + * public java.io.File java.io.File.getAbsoluteFile() + * ``` + */ @JavaMethod open func getAbsoluteFile() -> File! + /** + * Java method `mkdir`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.mkdir() + * ``` + */ @JavaMethod open func mkdir() -> Bool + /** + * Java method `getCanonicalFile`. + * + * ### Java method signature + * ```java + * public java.io.File java.io.File.getCanonicalFile() throws java.io.IOException + * ``` + */ @JavaMethod open func getCanonicalFile() throws -> File! + /** + * Java method `getParentFile`. + * + * ### Java method signature + * ```java + * public java.io.File java.io.File.getParentFile() + * ``` + */ @JavaMethod open func getParentFile() -> File! + /** + * Java method `mkdirs`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.mkdirs() + * ``` + */ @JavaMethod open func mkdirs() -> Bool + /** + * Java method `setWritable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setWritable(boolean) + * ``` + */ @JavaMethod open func setWritable(_ arg0: Bool) -> Bool + /** + * Java method `setWritable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setWritable(boolean,boolean) + * ``` + */ @JavaMethod open func setWritable(_ arg0: Bool, _ arg1: Bool) -> Bool + /** + * Java method `setReadable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setReadable(boolean,boolean) + * ``` + */ @JavaMethod open func setReadable(_ arg0: Bool, _ arg1: Bool) -> Bool + /** + * Java method `setReadable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setReadable(boolean) + * ``` + */ @JavaMethod open func setReadable(_ arg0: Bool) -> Bool + /** + * Java method `setExecutable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setExecutable(boolean,boolean) + * ``` + */ @JavaMethod open func setExecutable(_ arg0: Bool, _ arg1: Bool) -> Bool + /** + * Java method `setExecutable`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setExecutable(boolean) + * ``` + */ @JavaMethod open func setExecutable(_ arg0: Bool) -> Bool + /** + * Java method `canWrite`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.canWrite() + * ``` + */ @JavaMethod open func canWrite() -> Bool + /** + * Java method `isFile`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.isFile() + * ``` + */ @JavaMethod open func isFile() -> Bool + /** + * Java method `lastModified`. + * + * ### Java method signature + * ```java + * public long java.io.File.lastModified() + * ``` + */ @JavaMethod open func lastModified() -> Int64 + /** + * Java method `deleteOnExit`. + * + * ### Java method signature + * ```java + * public void java.io.File.deleteOnExit() + * ``` + */ @JavaMethod open func deleteOnExit() + /** + * Java method `listFiles`. + * + * ### Java method signature + * ```java + * public java.io.File[] java.io.File.listFiles() + * ``` + */ @JavaMethod open func listFiles() -> [File?] + /** + * Java method `setLastModified`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.setLastModified(long) + * ``` + */ @JavaMethod open func setLastModified(_ arg0: Int64) -> Bool + /** + * Java method `canExecute`. + * + * ### Java method signature + * ```java + * public boolean java.io.File.canExecute() + * ``` + */ @JavaMethod open func canExecute() -> Bool + /** + * Java method `getTotalSpace`. + * + * ### Java method signature + * ```java + * public long java.io.File.getTotalSpace() + * ``` + */ @JavaMethod open func getTotalSpace() -> Int64 + /** + * Java method `getFreeSpace`. + * + * ### Java method signature + * ```java + * public long java.io.File.getFreeSpace() + * ``` + */ @JavaMethod open func getFreeSpace() -> Int64 + /** + * Java method `getUsableSpace`. + * + * ### Java method signature + * ```java + * public long java.io.File.getUsableSpace() + * ``` + */ @JavaMethod open func getUsableSpace() -> Int64 + /** + * Java method `toPath`. + * + * ### Java method signature + * ```java + * public java.nio.file.Path java.io.File.toPath() + * ``` + */ @JavaMethod open func toPath() -> Path! } @@ -155,12 +498,36 @@ extension JavaClass { @JavaStaticField(isFinal: true) public var pathSeparator: String + /** + * Java method `listRoots`. + * + * ### Java method signature + * ```java + * public static java.io.File[] java.io.File.listRoots() + * ``` + */ @JavaStaticMethod public func listRoots() -> [File?] + /** + * Java method `createTempFile`. + * + * ### Java method signature + * ```java + * public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String) throws java.io.IOException + * ``` + */ @JavaStaticMethod public func createTempFile(_ arg0: String, _ arg1: String) throws -> File! + /** + * Java method `createTempFile`. + * + * ### Java method signature + * ```java + * public static java.io.File java.io.File.createTempFile(java.lang.String,java.lang.String,java.io.File) throws java.io.IOException + * ``` + */ @JavaStaticMethod public func createTempFile(_ arg0: String, _ arg1: String, _ arg2: File?) throws -> File! } diff --git a/Sources/SwiftJava/generated/Flushable.swift b/Sources/SwiftJava/generated/Flushable.swift index 95cfc4488..717b21e6d 100644 --- a/Sources/SwiftJava/generated/Flushable.swift +++ b/Sources/SwiftJava/generated/Flushable.swift @@ -1,9 +1,16 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.io.Flushable") public struct Flushable { - @JavaMethod + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public abstract void java.io.Flushable.flush() throws java.io.IOException + * ``` + */ +@JavaMethod public func flush() throws } diff --git a/Sources/JavaStdlib/JavaUtil/generated/JavaCollection.swift b/Sources/SwiftJava/generated/JavaCollection.swift similarity index 98% rename from Sources/JavaStdlib/JavaUtil/generated/JavaCollection.swift rename to Sources/SwiftJava/generated/JavaCollection.swift index 3a8db21b3..622f5708a 100644 --- a/Sources/JavaStdlib/JavaUtil/generated/JavaCollection.swift +++ b/Sources/SwiftJava/generated/JavaCollection.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.util.Collection") diff --git a/Sources/JavaStdlib/JavaUtil/generated/JavaIterator.swift b/Sources/SwiftJava/generated/JavaIterator.swift similarity index 94% rename from Sources/JavaStdlib/JavaUtil/generated/JavaIterator.swift rename to Sources/SwiftJava/generated/JavaIterator.swift index 06f09d7f0..50a9c1867 100644 --- a/Sources/JavaStdlib/JavaUtil/generated/JavaIterator.swift +++ b/Sources/SwiftJava/generated/JavaIterator.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.util.Iterator") diff --git a/Sources/JavaStdlib/JavaUtil/generated/JavaSet.swift b/Sources/SwiftJava/generated/JavaSet.swift similarity index 99% rename from Sources/JavaStdlib/JavaUtil/generated/JavaSet.swift rename to Sources/SwiftJava/generated/JavaSet.swift index 12ff00567..5f7c1a1c7 100644 --- a/Sources/JavaStdlib/JavaUtil/generated/JavaSet.swift +++ b/Sources/SwiftJava/generated/JavaSet.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.util.Set", extends: JavaCollection.self) diff --git a/Sources/JavaStdlib/JavaUtil/generated/List.swift b/Sources/SwiftJava/generated/List.swift similarity index 99% rename from Sources/JavaStdlib/JavaUtil/generated/List.swift rename to Sources/SwiftJava/generated/List.swift index 2ebc19420..40c794502 100644 --- a/Sources/JavaStdlib/JavaUtil/generated/List.swift +++ b/Sources/SwiftJava/generated/List.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.util.List") diff --git a/Sources/JavaStdlib/JavaUtil/generated/ListIterator.swift b/Sources/SwiftJava/generated/ListIterator.swift similarity index 97% rename from Sources/JavaStdlib/JavaUtil/generated/ListIterator.swift rename to Sources/SwiftJava/generated/ListIterator.swift index 121330b13..be1068446 100644 --- a/Sources/JavaStdlib/JavaUtil/generated/ListIterator.swift +++ b/Sources/SwiftJava/generated/ListIterator.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.util.ListIterator", extends: JavaIterator.self) diff --git a/Sources/SwiftJava/generated/OutputStream.swift b/Sources/SwiftJava/generated/OutputStream.swift index d499508cf..a410d16a8 100644 --- a/Sources/SwiftJava/generated/OutputStream.swift +++ b/Sources/SwiftJava/generated/OutputStream.swift @@ -1,5 +1,4 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaClass("java.io.OutputStream", implements: Closeable.self, Flushable.self) @@ -7,22 +6,70 @@ open class OutputStream: JavaObject { @JavaMethod @_nonoverride public convenience init(environment: JNIEnvironment? = nil) + /** + * Java method `flush`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.flush() throws java.io.IOException + * ``` + */ @JavaMethod open func flush() throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.write(byte[]) throws java.io.IOException + * ``` + */ @JavaMethod open func write(_ arg0: [Int8]) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.write(byte[],int,int) throws java.io.IOException + * ``` + */ @JavaMethod open func write(_ arg0: [Int8], _ arg1: Int32, _ arg2: Int32) throws + /** + * Java method `write`. + * + * ### Java method signature + * ```java + * public abstract void java.io.OutputStream.write(int) throws java.io.IOException + * ``` + */ @JavaMethod open func write(_ arg0: Int32) throws + /** + * Java method `close`. + * + * ### Java method signature + * ```java + * public void java.io.OutputStream.close() throws java.io.IOException + * ``` + */ @JavaMethod open func close() throws } extension JavaClass { - @JavaStaticMethod + /** + * Java method `nullOutputStream`. + * + * ### Java method signature + * ```java + * public static java.io.OutputStream java.io.OutputStream.nullOutputStream() + * ``` + */ +@JavaStaticMethod public func nullOutputStream() -> OutputStream! } diff --git a/Sources/SwiftJava/generated/Path.swift b/Sources/SwiftJava/generated/Path.swift index 235d9cef1..b762fdc00 100644 --- a/Sources/SwiftJava/generated/Path.swift +++ b/Sources/SwiftJava/generated/Path.swift @@ -1,88 +1,314 @@ // Auto-generated by Java-to-Swift wrapper generator. -import SwiftJava import CSwiftJavaJNI @JavaInterface("java.nio.file.Path") public struct Path { - @JavaMethod + /** + * Java method `getName`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getName(int) + * ``` + */ +@JavaMethod public func getName(_ arg0: Int32) -> Path! - @JavaMethod + /** + * Java method `equals`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.equals(java.lang.Object) + * ``` + */ +@JavaMethod public func equals(_ arg0: JavaObject?) -> Bool - @JavaMethod + /** + * Java method `toString`. + * + * ### Java method signature + * ```java + * public abstract java.lang.String java.nio.file.Path.toString() + * ``` + */ +@JavaMethod public func toString() -> String - @JavaMethod + /** + * Java method `hashCode`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.file.Path.hashCode() + * ``` + */ +@JavaMethod public func hashCode() -> Int32 - @JavaMethod + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public default int java.nio.file.Path.compareTo(java.lang.Object) + * ``` + */ +@JavaMethod + public func compareTo(_ arg0: JavaObject?) -> Int32 + + /** + * Java method `compareTo`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.file.Path.compareTo(java.nio.file.Path) + * ``` + */ +@JavaMethod public func compareTo(_ arg0: Path?) -> Int32 - @JavaMethod - public func compareTo(_ arg0: JavaObject?) -> Int32 + /** + * Java method `startsWith`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.startsWith(java.nio.file.Path) + * ``` + */ +@JavaMethod + public func startsWith(_ arg0: Path?) -> Bool - @JavaMethod + /** + * Java method `startsWith`. + * + * ### Java method signature + * ```java + * public default boolean java.nio.file.Path.startsWith(java.lang.String) + * ``` + */ +@JavaMethod public func startsWith(_ arg0: String) -> Bool - @JavaMethod - public func startsWith(_ arg0: Path?) -> Bool + /** + * Java method `iterator`. + * + * ### Java method signature + * ```java + * public default java.util.Iterator java.nio.file.Path.iterator() + * ``` + */ +@JavaMethod + public func iterator() -> JavaIterator! - @JavaMethod + /** + * Java method `endsWith`. + * + * ### Java method signature + * ```java + * public default boolean java.nio.file.Path.endsWith(java.lang.String) + * ``` + */ +@JavaMethod public func endsWith(_ arg0: String) -> Bool - @JavaMethod + /** + * Java method `endsWith`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.endsWith(java.nio.file.Path) + * ``` + */ +@JavaMethod public func endsWith(_ arg0: Path?) -> Bool - @JavaMethod + /** + * Java method `isAbsolute`. + * + * ### Java method signature + * ```java + * public abstract boolean java.nio.file.Path.isAbsolute() + * ``` + */ +@JavaMethod public func isAbsolute() -> Bool - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolve(java.lang.String,java.lang.String...) + * ``` + */ +@JavaMethod public func resolve(_ arg0: String, _ arg1: [String]) -> Path! - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolve(java.nio.file.Path,java.nio.file.Path...) + * ``` + */ +@JavaMethod public func resolve(_ arg0: Path?, _ arg1: [Path?]) -> Path! - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolve(java.lang.String) + * ``` + */ +@JavaMethod public func resolve(_ arg0: String) -> Path! - @JavaMethod + /** + * Java method `resolve`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.resolve(java.nio.file.Path) + * ``` + */ +@JavaMethod public func resolve(_ arg0: Path?) -> Path! - @JavaMethod + /** + * Java method `getParent`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getParent() + * ``` + */ +@JavaMethod public func getParent() -> Path! - @JavaMethod + /** + * Java method `getRoot`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getRoot() + * ``` + */ +@JavaMethod public func getRoot() -> Path! - @JavaMethod + /** + * Java method `toFile`. + * + * ### Java method signature + * ```java + * public default java.io.File java.nio.file.Path.toFile() + * ``` + */ +@JavaMethod public func toFile() -> File! - @JavaMethod + /** + * Java method `getFileName`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.getFileName() + * ``` + */ +@JavaMethod public func getFileName() -> Path! - @JavaMethod + /** + * Java method `normalize`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.normalize() + * ``` + */ +@JavaMethod public func normalize() -> Path! - @JavaMethod + /** + * Java method `relativize`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.relativize(java.nio.file.Path) + * ``` + */ +@JavaMethod public func relativize(_ arg0: Path?) -> Path! - @JavaMethod - public func getNameCount() -> Int32 - - @JavaMethod + /** + * Java method `toAbsolutePath`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.toAbsolutePath() + * ``` + */ +@JavaMethod public func toAbsolutePath() -> Path! - @JavaMethod + /** + * Java method `resolveSibling`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolveSibling(java.nio.file.Path) + * ``` + */ +@JavaMethod + public func resolveSibling(_ arg0: Path?) -> Path! + + /** + * Java method `resolveSibling`. + * + * ### Java method signature + * ```java + * public default java.nio.file.Path java.nio.file.Path.resolveSibling(java.lang.String) + * ``` + */ +@JavaMethod public func resolveSibling(_ arg0: String) -> Path! - @JavaMethod - public func resolveSibling(_ arg0: Path?) -> Path! + /** + * Java method `getNameCount`. + * + * ### Java method signature + * ```java + * public abstract int java.nio.file.Path.getNameCount() + * ``` + */ +@JavaMethod + public func getNameCount() -> Int32 - @JavaMethod + /** + * Java method `subpath`. + * + * ### Java method signature + * ```java + * public abstract java.nio.file.Path java.nio.file.Path.subpath(int,int) + * ``` + */ +@JavaMethod public func subpath(_ arg0: Int32, _ arg1: Int32) -> Path! } extension JavaClass { - @JavaStaticMethod + /** + * Java method `of`. + * + * ### Java method signature + * ```java + * public static java.nio.file.Path java.nio.file.Path.of(java.lang.String,java.lang.String...) + * ``` + */ +@JavaStaticMethod public func of(_ arg0: String, _ arg1: [String]) -> Path! } diff --git a/Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift b/Sources/SwiftJava/generated/PrintWriter.swift similarity index 99% rename from Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift rename to Sources/SwiftJava/generated/PrintWriter.swift index 5ea18244d..d8a8ccd24 100644 --- a/Sources/JavaStdlib/JavaIO/generated/PrintWriter.swift +++ b/Sources/SwiftJava/generated/PrintWriter.swift @@ -1,6 +1,5 @@ // Auto-generated by Java-to-Swift wrapper generator. import CSwiftJavaJNI -import SwiftJava @JavaClass("java.io.PrintWriter") open class PrintWriter: Writer { diff --git a/Sources/JavaStdlib/JavaIO/generated/Readable.swift b/Sources/SwiftJava/generated/Readable.swift similarity index 89% rename from Sources/JavaStdlib/JavaIO/generated/Readable.swift rename to Sources/SwiftJava/generated/Readable.swift index a48e1fafd..65fc1bb22 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Readable.swift +++ b/Sources/SwiftJava/generated/Readable.swift @@ -1,6 +1,5 @@ // Auto-generated by Java-to-Swift wrapper generator. import CSwiftJavaJNI -import SwiftJava @JavaInterface("java.lang.Readable") public struct Readable { diff --git a/Sources/JavaStdlib/JavaIO/generated/StringWriter.swift b/Sources/SwiftJava/generated/StringWriter.swift similarity index 99% rename from Sources/JavaStdlib/JavaIO/generated/StringWriter.swift rename to Sources/SwiftJava/generated/StringWriter.swift index cd4179da2..6b0945173 100644 --- a/Sources/JavaStdlib/JavaIO/generated/StringWriter.swift +++ b/Sources/SwiftJava/generated/StringWriter.swift @@ -1,6 +1,5 @@ // Auto-generated by Java-to-Swift wrapper generator. import CSwiftJavaJNI -import SwiftJava @JavaClass("java.io.StringWriter") open class StringWriter: Writer { diff --git a/Sources/SwiftJava/generated/Throwable.swift b/Sources/SwiftJava/generated/Throwable.swift index 7df74b7e8..27351254d 100644 --- a/Sources/SwiftJava/generated/Throwable.swift +++ b/Sources/SwiftJava/generated/Throwable.swift @@ -18,6 +18,9 @@ open class Throwable: JavaObject { @JavaMethod open func printStackTrace() + @JavaMethod + open func printStackTrace(_ writer: PrintWriter?) + @JavaMethod open func fillInStackTrace() -> Throwable! diff --git a/Sources/JavaStdlib/JavaIO/generated/Writer.swift b/Sources/SwiftJava/generated/Writer.swift similarity index 99% rename from Sources/JavaStdlib/JavaIO/generated/Writer.swift rename to Sources/SwiftJava/generated/Writer.swift index beeff6306..4c0293d4f 100644 --- a/Sources/JavaStdlib/JavaIO/generated/Writer.swift +++ b/Sources/SwiftJava/generated/Writer.swift @@ -1,6 +1,5 @@ // Auto-generated by Java-to-Swift wrapper generator. import CSwiftJavaJNI -import SwiftJava @JavaClass("java.io.Writer", implements: Appendable.self, Closeable.self, Flushable.self) open class Writer: JavaObject { diff --git a/Sources/SwiftJava/swift-java.config b/Sources/SwiftJava/swift-java.config index d43096a73..fcd8a6c4d 100644 --- a/Sources/SwiftJava/swift-java.config +++ b/Sources/SwiftJava/swift-java.config @@ -23,10 +23,31 @@ "java.lang.Void" : "JavaVoid", "java.lang.CharSequence": "CharSequence", "java.lang.Appendable": "Appendable", + "java.lang.Readable": "Readable", "java.lang.Thread": "JavaThread", "java.util.Optional": "JavaOptional", "java.util.OptionalDouble": "JavaOptionalDouble", "java.util.OptionalInt": "JavaOptionalInt", - "java.util.OptionalLong": "JavaOptionalLong" + "java.util.OptionalLong": "JavaOptionalLong", + + // Basic subset of collections API + "java.util.Collection": "JavaCollection", + "java.util.List" : "List", + "java.util.Iterator": "JavaIterator", + "java.util.ListIterator": "ListIterator", + "java.util.Set": "JavaSet", + + // requirements for Throwable APIs we need + "java.nio.ByteBuffer": "ByteBuffer", + "java.nio.file.Path": "Path", + "java.io.Closeable": "Closeable", + "java.io.Flushable": "Flushable", + "java.nio.charset.Charset": "Charset", + "java.io.File": "File", + "java.io.OutputStream": "OutputStream", + "java.io.Writer": "Writer", + "java.io.PrintWriter": "PrintWriter", + "java.io.StringWriter": "StringWriter" + } } diff --git a/Sources/SwiftJavaMacros/JavaMethodMacro.swift b/Sources/SwiftJavaMacros/JavaMethodMacro.swift index 7e1617c46..fdbf09a55 100644 --- a/Sources/SwiftJavaMacros/JavaMethodMacro.swift +++ b/Sources/SwiftJavaMacros/JavaMethodMacro.swift @@ -116,7 +116,10 @@ extension JavaMethodMacro: BodyMacro { } else { """ if let throwable = error as? Throwable { - throwable.printStackTrace() + let sw = StringWriter() + let pw = PrintWriter(sw) + throwable.printStackTrace(pw) + fatalError("Java call threw unhandled exception: \\(error)\\n\\(sw.toString())") } fatalError("Java call threw unhandled exception: \\(error)") """ diff --git a/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift b/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift index 173383469..8c5e2d593 100644 --- a/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift +++ b/Tests/SwiftJavaMacrosTests/JavaClassMacroTests.swift @@ -133,7 +133,10 @@ class JavaKitMacroTests: XCTestCase { return try dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) } catch { if let throwable = error as? Throwable { - throwable.printStackTrace() + let sw = StringWriter() + let pw = PrintWriter(sw) + throwable.printStackTrace(pw) + fatalError("Java call threw unhandled exception: \\(error)\\n\\(sw.toString())") } fatalError("Java call threw unhandled exception: \\(error)") } @@ -238,7 +241,10 @@ class JavaKitMacroTests: XCTestCase { return try dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) } catch { if let throwable = error as? Throwable { - throwable.printStackTrace() + let sw = StringWriter() + let pw = PrintWriter(sw) + throwable.printStackTrace(pw) + fatalError("Java call threw unhandled exception: \\(error)\\n\\(sw.toString())") } fatalError("Java call threw unhandled exception: \\(error)") } @@ -313,7 +319,10 @@ class JavaKitMacroTests: XCTestCase { return try dynamicJavaMethodCall(methodName: "isBigEnough", resultType: Bool.self) } catch { if let throwable = error as? Throwable { - throwable.printStackTrace() + let sw = StringWriter() + let pw = PrintWriter(sw) + throwable.printStackTrace(pw) + fatalError("Java call threw unhandled exception: \\(error)\\n\\(sw.toString())") } fatalError("Java call threw unhandled exception: \\(error)") } @@ -358,7 +367,10 @@ class JavaKitMacroTests: XCTestCase { return try dynamicJavaMethodCall(methodName: "get", resultType: /*type-erased:T*/ JavaObject?.self) } catch { if let throwable = error as? Throwable { - throwable.printStackTrace() + let sw = StringWriter() + let pw = PrintWriter(sw) + throwable.printStackTrace(pw) + fatalError("Java call threw unhandled exception: \\(error)\\n\\(sw.toString())") } fatalError("Java call threw unhandled exception: \\(error)") } From 35c8f76113c7c089b9b14c19e07b99b9f9e906a1 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Thu, 22 Jan 2026 20:28:44 +0900 Subject: [PATCH 4/4] de-duplicate generated catch logic, use the catch-phrase --- Sources/SwiftJavaMacros/JavaMethodMacro.swift | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/Sources/SwiftJavaMacros/JavaMethodMacro.swift b/Sources/SwiftJavaMacros/JavaMethodMacro.swift index fdbf09a55..2f7d850ef 100644 --- a/Sources/SwiftJavaMacros/JavaMethodMacro.swift +++ b/Sources/SwiftJavaMacros/JavaMethodMacro.swift @@ -126,23 +126,15 @@ extension JavaMethodMacro: BodyMacro { } let resultSyntax: CodeBlockItemSyntax = - if canRethrowError { - """ - try { + """ + \(raw: canRethrowError ? "try " : ""){ + do { return try dynamicJava\(raw: isStatic ? "Static" : "")MethodCall(methodName: \(literal: funcName)\(raw: parametersAsArgs)\(raw: resultType)) - }() - """ - } else { - """ - \(raw: canRethrowError ? "try " : ""){ - do { - return try dynamicJava\(raw: isStatic ? "Static" : "")MethodCall(methodName: \(literal: funcName)\(raw: parametersAsArgs)\(raw: resultType)) - } catch { - \(raw: catchPhrase) - } - }() - """ - } + } catch { + \(raw: catchPhrase) + } + }() + """ if let genericResultType { return [