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
Expand Up @@ -45,3 +45,9 @@ public enum NestedEnum {
public init() {}
}
}

public enum NamespaceEnum {
public enum Nested {
public static func something() {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,11 @@ void testStructInEnum() {
assertTrue(one.isPresent());
}
}
}

@Test
void testNamespaceEnum() {
try (var arena = SwiftArena.ofConfined()) {
NamespaceEnum.Nested.something();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ extension JNISwift2JavaGenerator {
}

private func printEnumDiscriminator(_ printer: inout CodePrinter, _ decl: ImportedNominalType) {
if decl.cases.isEmpty {
return
}

printer.printBraceBlock("public enum Discriminator") { printer in
printer.print(
decl.cases.map { $0.name.uppercased() }.joined(separator: ",\n")
Expand All @@ -374,6 +378,10 @@ extension JNISwift2JavaGenerator {
}

private func printEnumCaseInterface(_ printer: inout CodePrinter, _ decl: ImportedNominalType) {
if decl.cases.isEmpty {
return
}

printer.print("public sealed interface Case {}")
printer.println()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ extension JNISwift2JavaGenerator {
}

private func printEnumDiscriminator(_ printer: inout CodePrinter, _ type: ImportedNominalType) {
if type.cases.isEmpty {
return
}

let selfPointerParam = JavaParameter(name: "selfPointer", type: .long)
printCDecl(
&printer,
Expand Down