Intellij viewer and package round robin

My whole programming life. I thought that circular dependency is as follows: GIVEN

  • package1
  • package2
    • subpackage2
  • package3

IF

  • A class from package1 refers to a class from package2
  • A class from package2 refers to a class from package3
  • A class from package3 refers to a class from package1

THEN
The project contains a circular dependency package1> package2> package3> package1.

It was a pretty big surprise when an Intellij dependent viewer told me that:

IF

  • A class from package1 refers to a class from package2
  • A class from subpackage2 refers to a class from package3
  • A class from package3 refers to a class from package1

THEN
The project contains a circular dependency package1> package2> package3> package1.

Can someone please explain to me what a strict definition of cyclic dependence is and why Intellij shows such strange results? Thanks.

+5
source share
1 answer

The dependencies are transitive, therefore, due to the dependence on subpackage2, which, in turn, depends on package3, package2 itself depends on package3, thereby forming the same graph as in example 1. I am more surprised that other tools do not see this as circle since IntelliJ is right here.

+3
source

Source: https://habr.com/ru/post/1243944/


All Articles