Java:The hierarchy of the type is inconsistent错误

Posted 话·醉月

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java:The hierarchy of the type is inconsistent错误相关的知识,希望对你有一定的参考价值。

原因一

  • 在继承(extends)/实现(implements) 的某个 类/接口 中,这个类/接口所依赖的其他jar,在本类中不能依赖或者引用。
  • 举例:Class A 继承(extends) Class B ,在Class B中导入了com.jixue.dna.ui.portal.TaskUtil类,而Class A是不能依赖com.jixue.dna.ui.portal.jar包的,所以报错。

原因二

  • 在某个 类/接口 中,所依赖的jar包中依赖另一个jar包,而本类/接口不能依赖另一个jar包,所以出错。
  • 举例:Class A 依赖com.jixue.dna.ui.portal.jar,而com.jixue.dna.ui.portal.jar又依赖com.jixue.dna.service.task.jar,而Class A是不能依赖com.jixue.dna.service.task.jar包的,所以报错。

以上是关于Java:The hierarchy of the type is inconsistent错误的主要内容,如果未能解决你的问题,请参考以下文章