IncompatibleClassChangeError,
IncompatibleClassChangeError,
IncompatibleClassChangeError
0x01. 规范
Java Language and Virtual Machine Specifications
The Java Language Specification, Java SE 9 Edition
The Java Virtual Machine Specification, Java SE 9 Edition
0x02. 堆栈
java.lang.IncompatibleClassChangeError
Couldn't find xxxxx
libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:659)
libcore.reflect.AnnotationAccess.toAnnotationInstance(AnnotationAccess.java:641)
libcore.reflect.AnnotationAccess.getDeclaredAnnotation(AnnotationAccess.java:170)
libcore.reflect.AnnotationAccess.getAnnotation(AnnotationAccess.java:72)
java.lang.Class.getAnnotation(Class.java:343)
0x03. 查找java规范中异常的定义
该异常发生的时机:
12.3.3 Resolution of Symbolic References
可能引起该异常的错误:
- 0x01. IllegalAccessError
- 0x02. InstantiationError
- 0x03. NoSuchFieldError
- 0x04. NoSuchMethodError
从java规范上看UnsatisfiedLinkError也可能会导致这个问题.
0x04. 具体相关的信息
13.4.10 static Fields
eclared static , or vice versa, then a linkage error, specifically an
IncompatibleClassChangeError , will result if the field is used by a pre-existing
binary which expected a field of the other kind. Such changes are not recommended
in code that has been widely distributed.13.4.19 static Methods
If a method that is not declared private is also declared static (that is, a class
method) and is changed to not be declared static (that is, to an instance method),
or vice versa, then compatibility with pre-existing binaries may be broken, resulting
in a linkage time error, namely an IncompatibleClassChangeError , if these
methods are used by the pre-existing binaries. Such changes are not recommended
in code that has been widely distributed.13.5.5 Field Declarations
13.5.6 Interface Method Declarations
接口中方法的增加或者删除,也会导致这个异常.
0x05. 分析
实际上我们自己的代码完全不存在java规范上提到的那几个场景,发生异常的地方是一个私有成员也就是规范中说的Feild. 这个成员是几百年都不会变动的,因此不存在上面提到的问题.
那么既然如此,也不可能凭空出来一个IncompatibleClassChangeError! 但是这个问题也仅仅在金融App中报出,金融App试用了360的插件框架,因此怀疑和插件框架相关.
思路:
捕获这个异常,然后把异常时候的classloader打印出来,并且上传埋点.
相关文章
- 暂无相关文章
用户点评