Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2025 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
//
//===----------------------------------------------------------------------===//

public protocol ProtocolWithStatic {
// static requirements are not yet supported.
static func myFunc() -> Int
static var value: Int64 { get }
init()
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,23 @@ extension JNISwift2JavaGenerator {

printer.printBraceBlock("public interface \(decl.swiftNominal.name)\(extendsString)") { printer in
for initializer in decl.initializers {
printFunctionDowncallMethods(&printer, initializer, skipMethodBody: true)
printer.println()
self.logger.debug("Skipping static method '\(initializer.name)'")
}

for method in decl.methods {
if method.isStatic {
self.logger.debug("Skipping static method '\(method.name)'")
continue
}
printFunctionDowncallMethods(&printer, method, skipMethodBody: true)
printer.println()
}

for variable in decl.variables {
if variable.isStatic {
self.logger.debug("Skipping static property '\(variable.name)'")
continue
}
printFunctionDowncallMethods(&printer, variable, skipMethodBody: true)
printer.println()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ SwiftJava's `swift-java jextract` tool automates generating Java bindings from S
| Tuples: `(Int, String)`, `(A, B, C)` | ❌ | ❌ |
| Protocols: `protocol` | ❌ | ✅ |
| Protocols: `protocol` with associated types | ❌ | ❌ |
| Protocols static requirements: `static func`, `init(rawValue:)` | ❌ | ❌ |
| Existential parameters `f(x: any SomeProtocol)` (excepts `Any`) | ❌ | ✅ |
| Existential parameters `f(x: any (A & B)) ` | ❌ | ✅ |
| Existential return types `f() -> any Collection` | ❌ | ❌ |
Expand Down
Loading