diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/ProxyFactoryFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/ProxyFactoryFactoryImpl.java index 42537fbdca..1c0eb8cdbc 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/ProxyFactoryFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/ProxyFactoryFactoryImpl.java @@ -89,7 +89,7 @@ public class ProxyFactoryFactoryImpl implements ProxyFactoryFactory { private static final MethodFilter FINALIZE_FILTER = new MethodFilter() { public boolean isHandled(Method m) { // skip finalize methods - return !( m.getParameterTypes().length == 0 && m.getName().equals( "finalize" ) ); + return !( m.getParameterCount() == 0 && m.getName().equals( "finalize" ) ); } }; @@ -120,9 +120,9 @@ public class ProxyFactoryFactoryImpl implements ProxyFactoryFactory { return System.identityHashCode( object ); } - final boolean hasGetterSignature = method.getParameterTypes().length == 0 + final boolean hasGetterSignature = method.getParameterCount() == 0 && method.getReturnType() != null; - final boolean hasSetterSignature = method.getParameterTypes().length == 1 + final boolean hasSetterSignature = method.getParameterCount() == 1 && ( method.getReturnType() == null || method.getReturnType() == void.class ); if ( name.startsWith( "get" ) && hasGetterSignature ) { diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/BlobProxy.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/BlobProxy.java index e041a1fa61..24e73d63b1 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/BlobProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/BlobProxy.java @@ -88,7 +88,7 @@ public class BlobProxy implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); - final int argCount = method.getParameterTypes().length; + final int argCount = method.getParameterCount(); if ( "length".equals( methodName ) && argCount == 0 ) { return getLength(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ClobProxy.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ClobProxy.java index 145d7f374a..5f30ce910e 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ClobProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ClobProxy.java @@ -88,7 +88,7 @@ public class ClobProxy implements InvocationHandler { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); - final int argCount = method.getParameterTypes().length; + final int argCount = method.getParameterCount(); if ( "length".equals( methodName ) && argCount == 0 ) { return getLength(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ResultSetWrapperProxy.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ResultSetWrapperProxy.java index f9027faeb5..75df36b5f5 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ResultSetWrapperProxy.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/ResultSetWrapperProxy.java @@ -103,7 +103,7 @@ public class ResultSetWrapperProxy implements InvocationHandler { } // method should have arguments, and have same number as incoming arguments - if ( ! ( method.getParameterTypes().length > 0 && args.length == method.getParameterTypes().length ) ) { + if ( ! ( method.getParameterCount() > 0 && args.length == method.getParameterCount() ) ) { return false; } @@ -125,14 +125,14 @@ public class ResultSetWrapperProxy implements InvocationHandler { * @throws NoSuchMethodException Should never happen, but... */ private Method locateCorrespondingColumnIndexMethod(Method columnNameMethod) throws NoSuchMethodException { - final Class[] actualParameterTypes = new Class[columnNameMethod.getParameterTypes().length]; + final Class[] actualParameterTypes = new Class[columnNameMethod.getParameterCount()]; actualParameterTypes[0] = int.class; System.arraycopy( columnNameMethod.getParameterTypes(), 1, actualParameterTypes, 1, - columnNameMethod.getParameterTypes().length - 1 + columnNameMethod.getParameterCount() - 1 ); return columnNameMethod.getDeclaringClass().getMethod( columnNameMethod.getName(), actualParameterTypes ); } diff --git a/hibernate-core/src/main/java/org/hibernate/exception/spi/SQLExceptionConverterFactory.java b/hibernate-core/src/main/java/org/hibernate/exception/spi/SQLExceptionConverterFactory.java index 59ea756a0b..ca5917a4f3 100644 --- a/hibernate-core/src/main/java/org/hibernate/exception/spi/SQLExceptionConverterFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/exception/spi/SQLExceptionConverterFactory.java @@ -94,7 +94,7 @@ public class SQLExceptionConverterFactory { // First, try to find a matching constructor accepting a ViolatedConstraintNameExtracter param... final Constructor[] ctors = converterClass.getDeclaredConstructors(); for ( Constructor ctor : ctors ) { - if ( ctor.getParameterTypes() != null && ctor.getParameterTypes().length == 1 ) { + if ( ctor.getParameterTypes() != null && ctor.getParameterCount() == 1 ) { if ( ViolatedConstraintNameExtracter.class.isAssignableFrom( ctor.getParameterTypes()[0] ) ) { try { return (SQLExceptionConverter) ctor.newInstance( violatedConstraintNameExtracter ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java index df0b833fbd..6c5dc5338d 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/ReflectHelper.java @@ -421,7 +421,7 @@ public final class ReflectHelper { private static Method getGetterOrNull(Class containerClass, String propertyName) { for ( Method method : containerClass.getDeclaredMethods() ) { // if the method has parameters, skip it - if ( method.getParameterTypes().length != 0 ) { + if ( method.getParameterCount() != 0 ) { continue; } @@ -555,7 +555,7 @@ public final class ReflectHelper { for ( Method method : theClass.getDeclaredMethods() ) { final String methodName = method.getName(); - if ( method.getParameterTypes().length == 1 && methodName.startsWith( "set" ) ) { + if ( method.getParameterCount() == 1 && methodName.startsWith( "set" ) ) { final String testOldMethod = methodName.substring( 3 ); final String testStdMethod = Introspector.decapitalize( testOldMethod ); if ( testStdMethod.equals( propertyName ) || testOldMethod.equals( propertyName ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java index 3b312ad45d..ab6efa2723 100644 --- a/hibernate-core/src/main/java/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/pojo/javassist/JavassistProxyFactory.java @@ -36,7 +36,7 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable { private static final MethodFilter FINALIZE_FILTER = new MethodFilter() { public boolean isHandled(Method m) { // skip finalize methods - return !( m.getParameterTypes().length == 0 && m.getName().equals( "finalize" ) ); + return !( m.getParameterCount() == 0 && m.getName().equals( "finalize" ) ); } }; diff --git a/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java index 5aaad688af..8dc7db2594 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/internal/AbstractServiceRegistryImpl.java @@ -297,7 +297,7 @@ public abstract class AbstractServiceRegistryImpl @SuppressWarnings({ "unchecked" }) private void processInjection(T service, Method injectionMethod, InjectService injectService) { - if ( injectionMethod.getParameterTypes() == null || injectionMethod.getParameterTypes().length != 1 ) { + if ( injectionMethod.getParameterTypes() == null || injectionMethod.getParameterCount() != 1 ) { throw new ServiceDependencyException( "Encountered @InjectService on method with unexpected number of parameters" ); diff --git a/hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/management/impl/BeanUtils.java b/hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/management/impl/BeanUtils.java index 172027d50d..2a7baf5c75 100644 --- a/hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/management/impl/BeanUtils.java +++ b/hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/management/impl/BeanUtils.java @@ -31,7 +31,7 @@ public class BeanUtils { } final String getterName = sb.toString(); for ( Method m : bean.getClass().getMethods() ) { - if ( getterName.equals( m.getName() ) && m.getParameterTypes().length == 0 ) { + if ( getterName.equals( m.getName() ) && m.getParameterCount() == 0 ) { return m; } } diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/CustomParameterized.java b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/CustomParameterized.java index 04a5415632..5d956f9e79 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/CustomParameterized.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/CustomParameterized.java @@ -136,7 +136,7 @@ public class CustomParameterized extends Suite { for (FrameworkMethod each : methods) { if (each.isPublic()) { if (!each.isStatic()) { - if (getTestClass().getOnlyConstructor().getParameterTypes().length != 0) { + if (getTestClass().getOnlyConstructor().getParameterCount() != 0) { throw new Exception("Method " + each.getMethod() + " is annotated with @Parameters, it is not static and there is no parameter-less constructor!"); } } diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/TestClassMetadata.java b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/TestClassMetadata.java index a0f417077a..93ff200a91 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/TestClassMetadata.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/TestClassMetadata.java @@ -123,7 +123,7 @@ public class TestClassMetadata { } private void validateCallbackMethod(Method method, CallbackType type, List errors) { - if ( method.getParameterTypes().length > 0 ) { + if ( method.getParameterCount() > 0 ) { errors.add( new InvalidMethodForAnnotationException( type.buildTypeMarker() + " callback only valid on no-arg methods : "