Skip to content

Instantly share code, notes, and snippets.

@M66B
Created Jul 29, 2022
Embed
What would you like to do?
diff --git a/app/src/main/java/eu/faircode/xlua/XParam.java b/app/src/main/java/eu/faircode/xlua/XParam.java
index 6ce29bd..e75eb5d 100644
--- a/app/src/main/java/eu/faircode/xlua/XParam.java
+++ b/app/src/main/java/eu/faircode/xlua/XParam.java
@@ -147,8 +147,18 @@ public class XParam {
this.param.setThrowable((Throwable) result);
else {
if (BuildConfig.DEBUG)
- Log.i(TAG, "Set " + this.getPackageName() + ":" + this.getUid() + " result=" + result);
+ Log.i(TAG, "Set " + this.getPackageName() + ":" + this.getUid() +
+ " result=" + result + " return=" + this.returnType);
if (result != null && this.returnType != null) {
+ if (result instanceof String && int.class.equals(this.returnType))
+ result = Integer.parseInt((String) result);
+ else if (result instanceof String && long.class.equals(this.returnType))
+ result = Long.parseLong((String) result);
+ else if (result instanceof String && float.class.equals(this.returnType))
+ result = Float.parseFloat((String) result);
+ else if (result instanceof String && double.class.equals(this.returnType))
+ result = Double.parseDouble((String) result);
+ else
result = coerceValue(this.returnType, result);
if (!boxType(this.returnType).isInstance(result))
throw new IllegalArgumentException(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment