Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicProxyable works only with non-primitive arguments #1965

Closed
mikereiche opened this issue Sep 20, 2024 · 2 comments
Closed

DynamicProxyable works only with non-primitive arguments #1965

mikereiche opened this issue Sep 20, 2024 · 2 comments
Assignees
Labels
type: bug A general bug

Comments

@mikereiche
Copy link
Collaborator

see https://www.couchbase.com/forums/t/reactive-dynamicproxyable-is-not-working/39163

Issue is in FindMethod

for (k = 0; k < l; k++) {
if (!testParams[k].isAssignableFrom(currentParams[k])) {
break;
}
}

@mikereiche mikereiche added the type: bug A general bug label Sep 20, 2024
@mikereiche
Copy link
Collaborator Author

Could do something like this for int/Integer, but I'm hoping to find something that is less of a hack.

            if(params[j] == int.class && parameterTypes[j] == Integer.class )
                continue;

@mikereiche
Copy link
Collaborator Author

mikereiche commented Sep 24, 2024

// primitive types are : int, byte, short, long, float, double, boolean, and char.
// but only int, long, double and boolean are supported.
Flux findAll(int iint, long llong, double ddouble, boolean bboolean);

Others, such as byte, short, float and char don't have an equivalent.

com.couchbase.client.core.error.InvalidArgumentException: Unsupported type for JSON value: class java.lang.Character
	at com.couchbase.client.core.error.InvalidArgumentException.fromMessage(InvalidArgumentException.java:28)
	at com.couchbase.client.java.json.JsonValue.coerce(JsonValue.java:97)
	at com.couchbase.client.java.json.JsonArray.add(JsonArray.java:207)
	at org.springframework.data.couchbase.repository.query.StringBasedN1qlQueryParser.putPositionalValue(StringBasedN1qlQueryParser.java:554)

Couchbase JVM Core JsonValue only supports these:
/**
* Helper method to check if the given item is a supported JSON item.
*
* @param item the value to check.
* @return true if supported, false otherwise.
*/
public static boolean checkType(Object item) {
return item == null
|| item instanceof String
|| item instanceof Integer
|| item instanceof Long
|| item instanceof Double
|| item instanceof Boolean
|| item instanceof BigInteger
|| item instanceof BigDecimal
|| item instanceof JsonObject
|| item instanceof JsonArray;
}

Arrays won't work here either. They need to be List or Iterable. see https://github.com/couchbase/couchbase-jvm-clients/blob/41834f54f30be0a4dd7fc9953de0fbaac76255db/java-client/src/main/java/com/couchbase/client/java/json/JsonValue.java#L79-L98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant