Skip to content

Instantly share code, notes, and snippets.

@M66B
Created July 29, 2022 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M66B/1e1186719992a4916e657b04df4654f8 to your computer and use it in GitHub Desktop.
Save M66B/1e1186719992a4916e657b04df4654f8 to your computer and use it in GitHub Desktop.
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