From b1b2288932bdc6ba85ee038d282a78e227c90a1d Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Mon, 29 Sep 2025 14:07:16 +0300 Subject: [PATCH 1/4] Remove Jackson #5319 workaround and update to 3.0.0-rc11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove float-to-int coercion workaround methods from EndpointInvoker - Remove TreeTraversingParser limitation comments and logic - Update Jackson version from 3.0.0-rc9 to 3.0.0-rc11 - Issue #5319 is fixed in Jackson 3.0.0-rc11 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../com/vaadin/hilla/EndpointInvoker.java | 99 +------------------ pom.xml | 2 +- 2 files changed, 5 insertions(+), 96 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java index dd28ed23ef..f802d69b16 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java @@ -47,7 +47,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Parameter; -import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.security.Principal; @@ -126,80 +125,6 @@ private static Logger getLogger() { return LoggerFactory.getLogger(EndpointInvoker.class); } - private boolean needsFloatToIntCoercion(JsonNode node, Type targetType) { - if (node == null) { - return false; - } - - // Direct number node - if (node.isNumber() && isIntegralType(targetType) - && !node.canConvertToExactIntegral()) { - return true; - } - - // Array node containing floats to be converted to integral types - if (node.isArray() && isIntegralType(targetType)) { - for (JsonNode element : node) { - if (element.isNumber() - && !element.canConvertToExactIntegral()) { - return true; - } - } - } - - // Object node (for Maps and complex objects) - if (node.isObject() && targetType instanceof ParameterizedType) { - Type rawType = ((ParameterizedType) targetType).getRawType(); - if (rawType instanceof Class - && Map.class.isAssignableFrom((Class) rawType)) { - Type[] args = ((ParameterizedType) targetType) - .getActualTypeArguments(); - if (args.length > 1 && isIntegralType(args[1])) { - // Check if any map values need conversion - for (JsonNode value : node) { - if (value.isNumber() - && !value.canConvertToExactIntegral()) { - return true; - } - } - } - } - } - - return false; - } - - private boolean isIntegralType(Type type) { - if (type instanceof Class) { - Class cls = (Class) type; - if (cls.isArray()) { - // Handle array types - return isIntegralType(cls.getComponentType()); - } - return cls == int.class || cls == Integer.class || cls == long.class - || cls == Long.class || cls == short.class - || cls == Short.class || cls == byte.class - || cls == Byte.class || cls == java.math.BigInteger.class; - } else if (type instanceof ParameterizedType) { - Type rawType = ((ParameterizedType) type).getRawType(); - if (rawType instanceof Class) { - Class cls = (Class) rawType; - // Check for collections of integral types - if (Collection.class.isAssignableFrom(cls) - || Map.class.isAssignableFrom(cls)) { - Type[] args = ((ParameterizedType) type) - .getActualTypeArguments(); - if (args.length > 0) { - // For Map, check the value type (args[1]) - int checkIndex = Map.class.isAssignableFrom(cls) - && args.length > 1 ? 1 : 0; - return isIntegralType(args[checkIndex]); - } - } - } - } - return false; - } /** * Gets the return type of the given method. @@ -418,26 +343,10 @@ private Object[] getVaadinEndpointParameters( Type parameterType = javaParameters[i]; Type incomingType = parameterType; try { - JsonNode parameterNode = requestParameters - .get(parameterNames[i]); - Object parameter; - - // Jackson 3 limitation: TreeTraversingParser doesn't respect - // ACCEPT_FLOAT_AS_INT - // when deserializing from JsonNode. Convert to string for - // numeric coercion. - if (needsFloatToIntCoercion(parameterNode, parameterType)) { - // Convert JsonNode to string to allow float-to-int coercion - parameter = endpointObjectMapper - .readerFor(endpointObjectMapper.getTypeFactory() - .constructType(incomingType)) - .readValue(parameterNode.toString()); - } else { - parameter = endpointObjectMapper - .readerFor(endpointObjectMapper.getTypeFactory() - .constructType(incomingType)) - .readValue(parameterNode); - } + Object parameter = endpointObjectMapper + .readerFor(endpointObjectMapper.getTypeFactory() + .constructType(incomingType)) + .readValue(requestParameters.get(parameterNames[i])); endpointParameters[i] = parameter; if (parameter != null) { diff --git a/pom.xml b/pom.xml index 3b618daeb0..37e09ee149 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ 2.1.15 2.20.0 2.20 - 3.0.0-rc9 + 3.0.0-rc11 5.10.1 4.5.0 25.0.0-alpha15 From 0d285f5202786d32bdc7aa8e7d0c6cdd9a847b06 Mon Sep 17 00:00:00 2001 From: Artur Date: Wed, 8 Oct 2025 14:54:54 +0300 Subject: [PATCH 2/4] Jackson 3 is out --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2b8d661643..207730f7a7 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 2.1.15 2.20.0 2.20 - 3.0.0-rc11 + 3.0.0 5.10.1 4.5.0 25.0-SNAPSHOT From 9d56749af3224619789952528e0608dfc7e95233 Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Thu, 9 Oct 2025 09:19:42 +0300 Subject: [PATCH 3/4] chore: java code formatting --- .../endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java index f802d69b16..918b033c2a 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointInvoker.java @@ -125,7 +125,6 @@ private static Logger getLogger() { return LoggerFactory.getLogger(EndpointInvoker.class); } - /** * Gets the return type of the given method. * From 56cafa27733cb0ff0d9e1a8f450323b9bf211eea Mon Sep 17 00:00:00 2001 From: Artur Date: Sun, 12 Oct 2025 09:36:54 +0300 Subject: [PATCH 4/4] Update jackson.version to 3.0.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a942f35253..dd548241b1 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 2.1.15 2.20.0 2.20 - 3.0.0 + 3.0.1 5.10.1 4.5.0 25.0-SNAPSHOT