Minimise scope of @SuppressWarnings

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@983569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-08-09 10:04:51 +00:00
parent 2c0e67621a
commit 2f66e0fdf8
1 changed files with 1 additions and 1 deletions

View File

@ -244,7 +244,6 @@ public class ConstructorUtils {
* @param parameterTypes find method with compatible parameters
* @return a valid Constructor object. If there's no matching constructor, returns <code>null</code>.
*/
@SuppressWarnings("unchecked")
public static <T> Constructor<T> getMatchingAccessibleConstructor(Class<T> cls,
Class<?>... parameterTypes) {
// see if we can find the constructor directly
@ -263,6 +262,7 @@ public class ConstructorUtils {
if (ClassUtils.isAssignable(parameterTypes, ctors[i]
.getParameterTypes(), true)) {
// get accessible version of method
@SuppressWarnings("unchecked") // TODO is this OK? If so, why?
Constructor<T> ctor = getAccessibleConstructor((Constructor<T>) ctors[i]);
if (ctor != null) {
MemberUtils.setAccessibleWorkaround(ctor);