解决java.lang.IncompatibleClassChangeError
目录
解决java.lang.IncompatibleClassChangeError
在做pdf签章的时候遇到了异常:
Caused by: java.lang.IncompatibleClassChangeError: class org.bouncycastle.asn1.DERObject has interface org.bouncycastle.asn1.ASN1Encodable as super class
百度:
参考:
异常的意思很明白,就是说DERObject 以ASN1Encodable 接口作为了超类,继承关系
接口是不能继承的
Your newly packaged library is not backward binary compatible (BC) with old version. For this reason some of the library clients that are not recompiled may throw the exception.
This is a complete list of changes in Java library API that may cause clients built with an old version of the library to throw java.lang.IncompatibleClassChangeError if they run on a new one (i.e. breaking BC):
1.Non-final field become static,
2.Non-constant field become non-static,
3.Class become interface,
4.Interface become class,
5.if you add a new field to class/interface (or add new super-class/super-interface) then a static field from a super-interface of a client class C may hide an added field (with the same name) inherited from the super-class of C (very rare case).
快捷键ctrl+shift+t打开open type
发现ASN1Encodable 确实有个接口类型
打开对应文件位置
不知什么时候手动添加的一个jar包
正常下载的jdk是没有的。
自己挖的坑,跪着也要填完