From 55ffb82498ed6fd418ed201040e6c32fc3ab0d87 Mon Sep 17 00:00:00 2001 From: Victor Tran Date: Sat, 19 Oct 2024 21:50:44 +1100 Subject: [PATCH] Handle wildcard types to support Kotlin better --- .../src/main/java/org/freedesktop/dbus/Marshalling.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbus-java-core/src/main/java/org/freedesktop/dbus/Marshalling.java b/dbus-java-core/src/main/java/org/freedesktop/dbus/Marshalling.java index b86a44e2..a70c3323 100644 --- a/dbus-java-core/src/main/java/org/freedesktop/dbus/Marshalling.java +++ b/dbus-java-core/src/main/java/org/freedesktop/dbus/Marshalling.java @@ -200,7 +200,9 @@ private static String[] recursiveGetDBusType(StringBuffer[] _out, Type _dataType throw new DBusException(_dataType + " is not a basic type"); } - if (_dataType instanceof TypeVariable) { + if (_dataType instanceof WildcardType wildcardType && wildcardType.getUpperBounds().length > 0) { + return recursiveGetDBusType(_out, wildcardType.getUpperBounds()[0], _basic, _level); + } else if (_dataType instanceof TypeVariable) { _out[_level].append((char) ArgumentType.VARIANT); } else if (_dataType instanceof GenericArrayType gat) { _out[_level].append((char) ArgumentType.ARRAY);