diff --git a/blackbird/src/main/java/com/fasterxml/jackson/module/blackbird/deser/CreatorOptimizer.java b/blackbird/src/main/java/com/fasterxml/jackson/module/blackbird/deser/CreatorOptimizer.java index e5f6f3c3..d26c0aa5 100644 --- a/blackbird/src/main/java/com/fasterxml/jackson/module/blackbird/deser/CreatorOptimizer.java +++ b/blackbird/src/main/java/com/fasterxml/jackson/module/blackbird/deser/CreatorOptimizer.java @@ -71,7 +71,9 @@ public ValueInstantiator createOptimized() methodType(Object.class, MethodHandle.class, Object[].class)), methodType(Object.class, Object[].class)) .getTarget().invokeExact( - argsCreatorHandle.asSpreader( + argsCreatorHandle + .asFixedArity() + .asSpreader( Object[].class, argsCreatorHandle.type().parameterCount()) .asType(methodType(Object.class, Object[].class)))) @@ -107,10 +109,7 @@ private MethodHandle directHandle(AnnotatedElement element) { Stream.of(element) .filter(Constructor.class::isInstance) .map(Constructor.class::cast) - .filter(c -> !Modifier.isPrivate(c.getModifiers()) - // 07-Jul-2021, ckozak: modules-base#141Avoid attempting to optimize varargs - // methods due to class-cast edge cases - && !c.isVarArgs()) + .filter(c -> !Modifier.isPrivate(c.getModifiers())) .flatMap(t -> { try { return Stream.of(_lookup.unreflectConstructor(t)); diff --git a/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoubleArrayDeserTest.java b/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoublePrimitiveArrayConstructorDeser141Test.java similarity index 91% rename from blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoubleArrayDeserTest.java rename to blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoublePrimitiveArrayConstructorDeser141Test.java index 97381509..9e94364d 100644 --- a/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoubleArrayDeserTest.java +++ b/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoublePrimitiveArrayConstructorDeser141Test.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.blackbird.BlackbirdTestBase; -public class DoubleArrayDeserTest extends BlackbirdTestBase +public class DoublePrimitiveArrayConstructorDeser141Test extends BlackbirdTestBase { static class Foo141 { @JsonProperty("bar") diff --git a/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoubleVarArgsDeser141Test.java b/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoublePrimitiveVarArgsConstructorDeser141Test.java similarity index 91% rename from blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoubleVarArgsDeser141Test.java rename to blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoublePrimitiveVarArgsConstructorDeser141Test.java index 44a44c81..41e51dca 100644 --- a/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoubleVarArgsDeser141Test.java +++ b/blackbird/src/test/java/com/fasterxml/jackson/module/blackbird/deser/DoublePrimitiveVarArgsConstructorDeser141Test.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.module.blackbird.BlackbirdTestBase; // [modules-base#141] -public class DoubleVarArgsDeser141Test extends BlackbirdTestBase +public class DoublePrimitiveVarArgsConstructorDeser141Test extends BlackbirdTestBase { // [modules-base#141] static class Foo141 {