在迁移到Java 1.8时,我在项目中升级了许多依赖项.它是基于4.3版本的应用程序,具有许多外部依赖性,例如:JMS,HTTP客户端,FTP,XML等.
当应用程序启动时,我现在在控制台中收到以下消息:
两种方法具有相同的方法签名但不提供可分配的类?"public final int java.util.concurrent.ConcurrentHashMap $ CollectionView.size()"和"public abstract int java.util.Set.size()"请报告!
知道这个错误信息是什么以及如何查找导致问题的jar?
另外,我可以在控制台上打印一些关于哪个类/线程/堆栈正在打印此错误的其他数据.
我设法查看了 github 链接提供的代码,并找出了为什么没有获得堆栈跟踪的原因。它没有抛出异常。
来源: 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;
}
Run Code Online (Sandbox Code Playgroud)
我已经剪掉了一堆围绕它的代码。您的代码在字面上有注释表明这种情况不应该发生的地方失败了。
哎呀。
无论如何,它不会导致失败,因为它实际上没有分配任何内容failure
,并且如果它在其他地方失败,它会抛出实际的堆栈跟踪。
我不知道为什么会触发这个声明,因为我不是反思专家。
!m.getDeclaringClass().isAssignableFrom(mm.mMethod.getDeclaringClass())
Run Code Online (Sandbox Code Playgroud)
然而,它只是跳过并继续执行 for 循环,而不添加异常或执行任何其他操作。我认为它会保留第一个参数并继续评估。
如果您仍然持怀疑态度,请使用 Maven 将依赖关系树映射到该库,并查看是否有不会破坏内容的更新版本。
归档时间: |
|
查看次数: |
840 次 |
最近记录: |