简体   繁体   中英

Intellij dependency viewer and package cyclic dependency

All my programming life I have been thinking that the cyclic dependency is the following:
GIVEN

  • package1
  • package2
    • subpackage2
  • package3

IF

  1. Class from package1 references class from package2
  2. Class from package2 references class from package3
  3. Class from package3 references class from package1

THEN
Project contains cyclic dependency package1 > package2 > package3 > package1.

This was a pretty huge surprise when Intellij's dependency viewer told me, that:

IF

  1. Class from package1 references class from package2
  2. Class from subpackage2 references class from package3
  3. Class from package3 references class from package1

THEN
Project contains cyclic dependency package1 > package2 > package3 > package1.

Could anybody, please, explain me what is the strict definition for cyclic dependency and why does Intellij show such weird results? Thanks.

依赖关系是传递性的,因此依赖于subpackage2,而subpackage2依赖于package3,package2本身依赖于package3,从而形成与示例1完全相同的图形。我更惊讶的是其他工具不会将其视为一个圆圈,因为IntelliJ在这里是正确的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM