Java msg in console - two methods with the same method signature, but not providing assignable classes?

When migrating to java 1.8, I updated many dependencies in my project. This application is based on spring 4.3, with many external dependencies, for example: JMS, HTTP client, FTP, XML, etc.

When the application starts, now I get the following messages in the console:

Two methods with the same method signature but not providing classes assignable? "public final int java.util.concurrent.ConcurrentHashMap $ CollectionView.size ()" and "public abstract int java.util.Set.size ()" report it!

Any idea what this error message is, and how to look for which of the cans caused the problem?

Also in any way I can print some additional data on the console about which the class / stream / stack prints this error.

+6
source share
1 answer

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.

+3
source

Source: https://habr.com/ru/post/1014033/


All Articles