Skip to content
This repository was archived by the owner on Mar 20, 2020. It is now read-only.

Commit d817763

Browse files
committed
Dev: fix @SwiftFunc with 0 argumnets
1 parent 77529b4 commit d817763

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

compiler/src/main/java/com/readdle/codegen/SwiftFuncDescriptor.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,17 @@ class SwiftFuncDescriptor implements JavaSwiftProcessor.WritableElement {
5757
this.swiftMethodName = funcFullName.substring(0, paramStart);
5858

5959
String arguments = funcFullName.substring(paramStart + 1, paramEnd);
60-
String[] paramNames = arguments.split(":");
60+
61+
String[] paramNames;
62+
if (!arguments.isEmpty()) {
63+
paramNames = arguments.split(":");
64+
}
65+
else {
66+
paramNames = new String[0];
67+
}
6168

6269
if (paramNames.length != params.size()) {
63-
throw new SwiftMappingException("Wrong count of arguments in func name", executableElement);
70+
throw new SwiftMappingException("Wrong count of arguments in func name " + paramNames.length + " != " + params.size(), executableElement);
6471
}
6572

6673
for (String paramName : paramNames) {

sample/src/main/java/com/readdle/swiftjava/sample/SampleReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public interface CompletionBlock {
122122
@NonNull
123123
public native List<AbstractType> getAbstractTypeList();
124124

125-
@NonNull
125+
@SwiftFunc("getAbstractType()") @NonNull
126126
public native AbstractType getAbstractType();
127127

128128
@NonNull

0 commit comments

Comments
 (0)