Skip to content

Commit 883969f

Browse files
madsodgaardktoso
authored andcommitted
[jextract/jni] Add support for importing nested types (swiftlang#429)
1 parent a13656c commit 883969f

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

Sources/SwiftJavaToolLib/JavaClassTranslator.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,7 @@ extension JavaClassTranslator {
874874
/// method.
875875
func isOverride(_ method: Method) -> Bool {
876876
var currentSuperclass = effectiveJavaSuperclass
877+
print("currentSuperclass = \(currentSuperclass)")
877878
while let currentSuperclassNonOpt = currentSuperclass {
878879
// Set the loop up for the next run.
879880
defer {

Tests/JExtractSwiftTests/JNI/JNINestedTypesTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ struct JNINestedTypesTests {
2424
public class B {
2525
public func g(c: C) {}
2626

27-
extension MyNamespace {
2827
public struct C {
2928
public func h(b: B) {}
3029
}

Tests/SwiftJavaTests/BasicRuntimeTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class BasicRuntimeTests: XCTestCase {
5656
do {
5757
_ = try URL("bad url", environment: environment)
5858
} catch {
59-
XCTAssertEqual(String(describing: error), "java.net.MalformedURLException: no protocol: bad url")
59+
XCTAssertEqual(String(describing: error), "java.net.MalformedURLException(no protocol: bad url)")
6060
}
6161
}
6262

Tests/SwiftJavaToolLibTests/CompileJavaWrapTools.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import JavaNet
1919
import SwiftJavaShared
2020
import SwiftJavaConfigurationShared
2121
import _Subprocess
22-
import Testing // import XCTest // NOTE: Workaround for https://github.com/swiftlang/swift-java/issues/43
22+
import XCTest // NOTE: Workaround for https://github.com/swiftlang/swift-java/issues/43
2323
import Foundation
2424

2525
fileprivate func createTemporaryDirectory(in directory: Foundation.URL) throws -> Foundation.URL {
@@ -164,7 +164,7 @@ let failureMessage = "Expected chunk: \n" +
164164
"\n" +
165165
"not found in:\n" +
166166
"\(swiftCompleteOutputText)"
167-
#expect(checkAgainstText.contains(checkAgainstExpectedChunk),
167+
XCTAssertTrue(checkAgainstText.contains(checkAgainstExpectedChunk),
168168
"\(failureMessage)")
169169
}
170170
}

Tests/SwiftJavaToolLibTests/WrapJavaTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import SwiftJavaShared
1919
import JavaNet
2020
import SwiftJavaConfigurationShared
2121
import _Subprocess
22-
import Testing // import XCTest // NOTE: Workaround for https://github.com/swiftlang/swift-java/issues/43
22+
import XCTest // NOTE: Workaround for https://github.com/swiftlang/swift-java/issues/43
2323

24-
final class WrapJavaTests {
24+
final class WrapJavaTests: XCTestCase {
2525

26-
@Test
26+
// @Test
2727
func testWrapJavaFromCompiledJavaSource() async throws {
2828
let classpathURL = try await compileJava(
2929
"""
@@ -50,7 +50,7 @@ final class WrapJavaTests {
5050
)
5151
}
5252

53-
@Test
53+
// @Test
5454
func testWrapJavaGenericMethod_singleGeneric() async throws {
5555
let classpathURL = try await compileJava(
5656
"""
@@ -98,7 +98,7 @@ final class WrapJavaTests {
9898
}
9999

100100
// This is just a warning in Java, but a hard error in Swift, so we must 'prune' generic params
101-
@Test
101+
// @Test
102102
func testWrapJavaGenericMethod_pruneNotUsedGenericParam() async throws {
103103
let classpathURL = try await compileJava(
104104
"""
@@ -136,7 +136,7 @@ final class WrapJavaTests {
136136
)
137137
}
138138

139-
@Test
139+
// @Test
140140
func testWrapJavaGenericMethod_multipleGenerics() async throws {
141141
let classpathURL = try await compileJava(
142142
"""
@@ -204,7 +204,7 @@ final class WrapJavaTests {
204204
7 | @JavaMethod
205205
8 | @_nonoverride public convenience init(_ arg0: String, environment: JNIEnvironment? = nil)
206206
*/
207-
@Test
207+
// @Test
208208
func testGenericSuperclass() async throws {
209209
return // FIXME: we need this
210210

0 commit comments

Comments
 (0)