Skip to content

Commit 9b848a9

Browse files
committed
add a default toString to imported heap objects
1 parent c3bf377 commit 9b848a9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sources/JExtractSwift/Swift2JavaTranslator+Printing.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,4 +821,16 @@ extension Swift2JavaTranslator {
821821
printer.print(");");
822822
}
823823

824+
public func printHeapObjectToStringMethod(_ printer: inout CodePrinter, _ decl: ImportedNominalType) {
825+
printer.print(
826+
"""
827+
@Override
828+
public String toString() {
829+
return getClass().getSimpleName() + "(" +
830+
SwiftKit.nameOfSwiftType($swiftType().$memorySegment(), true) +
831+
")@" + $memorySegment();
832+
}
833+
""")
834+
}
835+
824836
}

0 commit comments

Comments
 (0)