Skip to content

Commit 334af56

Browse files
authored
Replace getParameterTypes().length with getParameterCount() (#870)
1 parent 92f064d commit 334af56

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

bson/src/main/org/bson/codecs/pojo/PojoBuilderHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ static <T> void configureClassModelBuilder(final ClassModelBuilder<T> classModel
138138

139139
Constructor<T> noArgsConstructor = null;
140140
for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
141-
if (constructor.getParameterTypes().length == 0
141+
if (constructor.getParameterCount() == 0
142142
&& (isPublic(constructor.getModifiers()) || isProtected(constructor.getModifiers()))) {
143143
noArgsConstructor = (Constructor<T>) constructor;
144144
noArgsConstructor.setAccessible(true);

bson/src/main/org/bson/codecs/pojo/PropertyReflectionUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private PropertyReflectionUtils() {}
3232
private static final String SET_PREFIX = "set";
3333

3434
static boolean isGetter(final Method method) {
35-
if (method.getParameterTypes().length > 0) {
35+
if (method.getParameterCount() > 0) {
3636
return false;
3737
} else if (method.getName().startsWith(GET_PREFIX) && method.getName().length() > GET_PREFIX.length()) {
3838
return Character.isUpperCase(method.getName().charAt(GET_PREFIX.length()));
@@ -44,7 +44,7 @@ static boolean isGetter(final Method method) {
4444

4545
static boolean isSetter(final Method method) {
4646
if (method.getName().startsWith(SET_PREFIX) && method.getName().length() > SET_PREFIX.length()
47-
&& method.getParameterTypes().length == 1) {
47+
&& method.getParameterCount() == 1) {
4848
return Character.isUpperCase(method.getName().charAt(SET_PREFIX.length()));
4949
}
5050
return false;

0 commit comments

Comments
 (0)