-
Notifications
You must be signed in to change notification settings - Fork 75
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
fixed Java method overload bug, #349
Conversation
e.g. 1. Java: ``` method(JsonArray array); method(JsonObject object); ``` 2. JS: ``` java.method([ "a", "b", "c" ]);// JS Native Array can convert to Java Map, { 0 : "a", 1 : "b", 2 : "c" }, java.method({ name:"vv", age:18 }) ```
before:
after:
|
whithout
|
@@ -119,7 +119,7 @@ public ECMAEngine(Vertx vertx) { | |||
// Ensure bytes are supported | |||
.targetTypeMapping(Number.class, Byte.class, null, Number::byteValue) | |||
// map native JSON Object to Vert.x JSONObject | |||
.targetTypeMapping(Map.class, JsonObject.class, null, JsonObject::new) | |||
.targetTypeMapping(Map.class, JsonObject.class, v -> !Value.asValue(v).hasArrayElements(), JsonObject::new) | |||
// map native JSON Array to Vert.x JSONArray | |||
.targetTypeMapping(List.class, JsonArray.class, null, JsonArray::new) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the same logic, this null
should be the reversed assertion then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also have the reserve assertion for lists then?
No need to do that i think. |
Both of these 2 conditions are acceptable to the
For |
e.g.