I managed to look at the code provided a little by the github link and figured out why you are not getting a stack trace. This is no exception.
Source: https://github.com/jkuhnert/ognl/blob/master/src/java/ognl/OgnlRuntime.java
private static MatchingMethod findBestMethod(List methods, Class typeClass, String name, Class[] argClasses) { MatchingMethod mm = null; IllegalArgumentException failure = null; for (int i = 0, icount = methods.size(); i < icount; i++) { // ... if (mm == null || mm.score > score) { mm = new MatchingMethod(m, score, report, mParameterTypes); failure = null; } else if (mm.score == score) { if (Arrays.equals(mm.mMethod.getParameterTypes(), m.getParameterTypes()) && mm.mMethod.getName().equals(m.getName())) { if (mm.mMethod.getDeclaringClass().isAssignableFrom(m.getDeclaringClass())) { if (!retsAreEqual && !mm.mMethod.getReturnType().isAssignableFrom(m.getReturnType())) System.err.println("Two methods with same method signature but return types conflict? \""+mm.mMethod+"\" and \""+m+"\" please report!"); mm = new MatchingMethod(m, score, report, mParameterTypes); failure = null; } else if (!m.getDeclaringClass().isAssignableFrom(mm.mMethod.getDeclaringClass())) { // this should't happen System.err.println("Two methods with same method signature but not providing classes assignable? \""+mm.mMethod+"\" and \""+m+"\" please report!"); } else if (!retsAreEqual && !m.getReturnType().isAssignableFrom(mm.mMethod.getReturnType())) System.err.println("Two methods with same method signature but return types conflict? \""+mm.mMethod+"\" and \""+m+"\" please report!"); } else { // ... cut out } } } if (failure != null) throw failure; return mm; }
I cut a bunch of code around it. Your code does not work in the place where there is literally a comment in which it is indicated , this should not happen .
Unfortunately.
In any case, this does not cause a crash, since it does not actually assign anything to failure
, and it would have thrown the actual stack if it had not worked somewhere else.
I have no idea why this statement works, as I am not a reflection expert.
!m.getDeclaringClass().isAssignableFrom(mm.mMethod.getDeclaringClass())
However, it just jumps and continues execution through the for loop without adding an exception or doing anything else. I would suggest that it retains all the initial arguments and continues to evaluate.
If you are still suspicious, use Maven to map the dependency tree to this library and see if there is an updated version that does not break.