From 5bb991ecafec519eec4967fc7cff2816570bb2be Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Thu, 21 Sep 2017 23:39:12 +0200 Subject: [PATCH] Replace getParameterTypes().length with getParameterCount() Closes gh-10377 --- .../filter/TypeExcludeFiltersContextCustomizer.java | 2 +- .../test/autoconfigure/json/JsonTestersAutoConfiguration.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java index a0bce873f6a..fc2e9e25fb5 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/TypeExcludeFiltersContextCustomizer.java @@ -62,7 +62,7 @@ class TypeExcludeFiltersContextCustomizer implements ContextCustomizer { try { Constructor constructor = getTypeExcludeFilterConstructor(filterClass); ReflectionUtils.makeAccessible(constructor); - if (constructor.getParameterTypes().length == 1) { + if (constructor.getParameterCount() == 1) { return (TypeExcludeFilter) constructor.newInstance(testClass); } return (TypeExcludeFilter) constructor.newInstance(); diff --git a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java index ffb7b10c318..f0eb7dd1571 100644 --- a/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java +++ b/spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTestersAutoConfiguration.java @@ -142,7 +142,7 @@ public class JsonTestersAutoConfiguration { } Constructor[] constructors = this.objectType.getDeclaredConstructors(); for (Constructor constructor : constructors) { - if (constructor.getParameterTypes().length == 1 + if (constructor.getParameterCount() == 1 && constructor.getParameterTypes()[0] .isInstance(this.marshaller)) { ReflectionUtils.makeAccessible(constructor);