Cyclic Dependency occurs when objects form an infinite recurring dependency graph. The head points to the tail and the tail points to the head.
Questions tagged [cyclic-dependency]
123 questions
                    
                    49
                    
            votes
                
                4 answers
            
        How to resolve cyclic dependency in Maven?
How can we resolve a Maven cyclic dependency?
Suppose A is the parent project and B and C are child projects. If B is dependent on C and C is dependent on B, is there any way to resolve the cyclic dependency other than having a different project. 
         
    
    
        user2367460
        
- 499
- 1
- 4
- 3
                    39
                    
            votes
                
                3 answers
            
        Cyclic module dependencies and relative imports in Python
Suppose we have two modules with cyclic dependencies:
# a.py
import b
def f(): return b.y
x = 42
# b.py
import a
def g(): return a.x
y = 43
The two modules are in the directory pkg with an empty __init__.py.  Importing pkg.a or pkg.b works fine,…
         
    
    
        Sven Marnach
        
- 574,206
- 118
- 941
- 841
                    28
                    
            votes
                
                1 answer
            
        How can I use my specs for their intended purposes if they are in a separate namespace?
One of the examples in the clojure.spec Guide is a simple option-parsing spec:
(require '[clojure.spec :as s])
(s/def ::config
  (s/* (s/cat :prop string?
              :val (s/alt :s string? :b boolean?))))
(s/conform ::config ["-server" "foo"…
         
    
    
        Sam Estep
        
- 12,974
- 2
- 37
- 75
                    24
                    
            votes
                
                2 answers
            
        Registering packages in Go without cyclic dependency
I have a central package that provides several interfaces that other packages are dependent on (let us call one Client). Those other packages, provide several implementations of those first interfaces (UDPClient, TCPClient). I instantiate a Client…
         
    
    
        Matt Joiner
        
- 112,946
- 110
- 377
- 526
                    19
                    
            votes
                
                3 answers
            
        Why is Java prohibiting inheritance of inner interfaces?
I.e. why is the following "cyclic dependency" not possible?
public class Something implements Behavior {
    public interface Behavior {
        // ...
    }
}
Since interfaces don't reference the outer class this should be allowed; however, the…
         
    
    
        Philip Kamenarsky
        
- 2,757
- 2
- 24
- 30
                    14
                    
            votes
                
                1 answer
            
        Haskell - resolving cyclical module dependency
Let's say I write the following code:
a game module
module Game where 
import Player
import Card 
data Game = Game {p1 :: Player,
                  p2 :: Player,
                  isP1sTurn :: Bool
                  turnsLeft :: Int
                …
         
    
    
        SolventGren
        
- 145
- 1
- 6
                    12
                    
            votes
                
                1 answer
            
        Cyclic Imports to fix R0401 from pylint
Pylint complains about cyclic import with R0401 error code for a specific file of the NLTK package, e.g. 
nltk/nltk/ccg/lexicon.py:1: [R0401(cyclic-import), ] Cyclic import (nltk -> nltk.internals)
nltk/nltk/ccg/lexicon.py:1: [R0401(cyclic-import),…
         
    
    
        alvas
        
- 115,346
- 109
- 446
- 738
                    9
                    
            votes
                
                1 answer
            
        Cyclic load dependency in Clojure
My project has a simple structure as following:
|- core.clj
|- dialogs.clj
|- dialogs/
   |- name_dialog.clj
name_dialog has a dependency from core, and core should require name_dialog. 
So I have dependencies like this:
core.clj
(ns ddsl.core
 …
         
    
    
        lich
        
- 290
- 1
- 5
- 10
                    9
                    
            votes
                
                4 answers
            
        Cyclic dependency between header files
I'm trying to implement a tree-like structure with two classes: Tree and Node. The problem is that from each class I want to call a function of the other class, so simple forward declarations are not enough.
Let's see an example:
Tree.h:
#ifndef…
         
    
    
        Jabba
        
- 19,598
- 6
- 52
- 45
                    9
                    
            votes
                
                4 answers
            
        How to properly handle a circular module dependency in Python?
Trying to find a good and proper pattern to handle a circular module dependency in Python.  Usually, the solution is to remove it (through refactoring); however, in this particular case we would really like to have the functionality that requires…
         
    
    
        Juan Carlos Coto
        
- 11,900
- 22
- 62
- 102
                    8
                    
            votes
                
                5 answers
            
        Angular 8: Cannot instantiate cyclic dependency - ActivatedRoute
I am trying to integrate the APP_INITIALIZER from Angular in my project in order to do some functionalities before start the application. The problem comes when I use the ActivatedRoute from Angular in my service.
The error is:
Error: Provider parse…
         
    
    
        Jgascona
        
- 1,201
- 2
- 13
- 25
                    7
                    
            votes
                
                3 answers
            
        Angular Circular dependency when inject TranslateService to interceptor
I have a problem with injecting dependencies into the interceptor. I want to inject TranslateService into HttpErrorInterceptor, but I get a cyclic dependency error. When I remove the TranslateService injection it all works.
I have declared…
         
    
    
        lukasbear
        
- 121
- 1
- 5
                    7
                    
            votes
                
                1 answer
            
        How to detect cyclic dependency imports in react native?
Is there any package or solution to detect cyclic dependency imports in react native?
[Or]
Can I get a stack trace for cyclic imports when running the app?
Currently the cyclic dependent imports are returning undefined values, Without telling the…
         
    
    
        Sanyasirao Mopada
        
- 943
- 12
- 31
                    7
                    
            votes
                
                2 answers
            
        Are clojure function cyclic dependencies specifically disallowed by design, or is it just a reader behaviour?
If I do the following in clojure
(defn sub1a [a]
  (cond
    (= a 0) 0
    true (sub1b (- a 1) )))
(defn sub1b [a]
  (cond
    (= a 0) 0
    true (sub1a (- a 1) )))
(println (sub1a 10))
I get the following error:
java.lang.Exception: Unable to…
         
    
    
        hawkeye
        
- 34,745
- 30
- 150
- 304
                    6
                    
            votes
                
                1 answer
            
        Resolve circular dependency in gradle
I recently started developing a java project which has some sub projects within it. All of them are gradle. So let's say there are two projects A and B which is already implemented. And I'm going to introduce another graldle project C. And the…
         
    
    
        Shehan Dhaleesha
        
- 627
- 1
- 10
- 30