in src/main/java/org/apache/commons/ognl/enhance/ExpressionCompiler.java [333:405]
public boolean containsMethod( Method m, Class<?> clazz )
{
Method[] methods = clazz.getMethods();
if ( methods == null )
{
return false;
}
for ( Method method : methods )
{
if ( method.getName().equals( m.getName() ) && method.getReturnType() == m.getReturnType() )
{
Class<?>[] parms = m.getParameterTypes();
if ( parms == null )
{
continue;
}
Class<?>[] mparms = method.getParameterTypes();
if ( mparms == null || mparms.length != parms.length )
{
continue;
}
boolean parmsMatch = true;
for ( int p = 0; p < parms.length; p++ )
{
if ( parms[p] != mparms[p] )
{
parmsMatch = false;
break;
}
}
if ( !parmsMatch )
{
continue;
}
Class<?>[] exceptions = m.getExceptionTypes();
if ( exceptions == null )
{
continue;
}
Class<?>[] mexceptions = method.getExceptionTypes();
if ( mexceptions == null || mexceptions.length != exceptions.length )
{
continue;
}
boolean exceptionsMatch = true;
for ( int e = 0; e < exceptions.length; e++ )
{
if ( exceptions[e] != mexceptions[e] )
{
exceptionsMatch = false;
break;
}
}
if ( !exceptionsMatch )
{
continue;
}
return true;
}
}
return false;
}