circular-dependency

Intra-package imports do not always work

陌路散爱 提交于 2019-12-10 13:49:26
问题 I have a Django project structured like so: appname/ models/ __init__.py a.py base.py c.py ... where appname/models/__init__.py contains only statements like so: from appname.models.base import Base from appname.models.a import A from appname.models.c import C ... and where appname/models/base.py contains: import django.db.models class Base(django.db.models.Model): ... and where appname/models/a.py contains: import appname.models as models class A(models.Base): .... ...and similarly for

WARNING in Circular dependency detected - Angular Cli

可紊 提交于 2019-12-10 12:55:23
问题 https://github.com/angular/angular-cli/pull/6813 Added warnings for circular dependencies, and I know I can turn off all warnings using "showCircularDependencies": false . But I would rather keep the circular dependency warnings on. Is there a pattern that will let me fix the use case below, or is there a way to specifically disable the circular dependency plugin on a particular file? The simplest scenario is if I have 3 files: forms.model.ts import { CustomModel } from './custom.model';

Database Design: Circular dependency

别来无恙 提交于 2019-12-10 02:42:49
问题 Imagine the following database: Table 'companies' has fields id, name and flagship_product_id. Table 'products' have fields id, name and company_id. A company must have a flagship product (1:1 relationship) and all products have one company (1:N relationship). When using a storage engine such as MyISM, there shouldn't be any problem with the above scenario, but when using an engine such as InnoDB, problems result when INSERTing new data. What is a good solution except allowing a NULL

How to solve Boost::BGL template<->class circular dependency?

一曲冷凌霜 提交于 2019-12-09 20:08:41
问题 I have a problem with using the adjacency-list of the Boost Graphics Library. It seems to be a circular dependency problem: I have a typedef T of a template which uses some class A. Additionally A stores a pointer to an object of type T. Now the compiler tells me, that T does not name a type. Here are excerptions of my more concrete files: //graphdefinitions.hpp #include "lane.hpp" #include "tie.hpp" typedef boost::adjacency_list<boost::listS, boost::listS, boost::directedS, Tie, Lane> Map;

Why is there no cyclic layout issue for classes in C#?

有些话、适合烂在心里 提交于 2019-12-09 16:29:13
问题 public struct Unit { Unit u; } Causes: Struct member 'Unit.u' of type 'Unit' causes a cycle in the struct layout. But public class Unit { Unit u; } compiles. I understand the problem I suppose. An endless cycle will be formed when referencing a Unit object since it will have to initialize another member Unit and so on. But why does the compiler restrict the problem just for structs ? Doesn't the issue persist for class too? Am I missing something? 回答1: The problem is in terms of layout . When

How to resolve a circular dependency while still using Dagger2?

筅森魡賤 提交于 2019-12-09 14:46:03
问题 I have two classes, Foo<T> and Bar , which depend on each other, as well as various other classes. I am using Dagger-2 for dependency injection, but if I naively add the circular dependency, Dagger hits a stack overflow at runtime. What's a good way to refactor the classes to fix this, while still using Dagger to inject all the other dependencies, and with minimal duplication and changes to existing calls? 回答1: The easy way out is to use Lazy<T> on one side. Lazy<Foo> foo; @Inject Bar(Lazy

Can I avoid a dependency cycle with one edge being a test dependency?

自作多情 提交于 2019-12-09 06:37:09
问题 Consider a testCycle parent with modules DummyCore and TestFramework . TestFramework depends on DummyCore , and DummyCore has a test dedepency on TestFramework . Building and testing each module independently maven has no problems. But mvn test the parents testCycle results in: The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='com.mysimpatico:TestFramework:1.0-SNAPSHOT'}' and 'Vertex{label='org.apache:DummyCore:1.0-SNAPSHOT'}' introduces to cycle in the graph

Compiler error C4430: missing type specifier - int assumed [duplicate]

谁说我不能喝 提交于 2019-12-09 05:26:12
问题 This question already has answers here : Resolve build errors due to circular dependency amongst classes (11 answers) Closed 5 years ago . I have this error: "error C4430: missing type specifier - int assumed. Note: C++ does not support default-int" with this code example : //A.h #include "B.h" class A{ B* b; .. }; //B.h #include "A.h" class B{ A* a; // error error C4430: missing type specifier - int assumed. }; 回答1: This is a circular dependency issue. For declaring a pointer to some class,

C++ circular header includes [duplicate]

痴心易碎 提交于 2019-12-08 22:10:07
问题 This question already has answers here : Resolve build errors due to circular dependency amongst classes (11 answers) Closed 4 years ago . I know that similar questions to this have been asked before but after doing my research I still have questions about circular header includes. //FooA.h #ifndef H_FOOA #define H_FOOA #include "foob.h" class FooA{ public: FooB *fooB; }; //FooB.h #ifndef H_FOOB #define H_FOOB class FooA; class FooB{ public: FooA *fooA; }; Now if I have two circular

Rails 4 Runtime error in controller: Circular dependency detected while autoloading constant

痴心易碎 提交于 2019-12-08 16:15:15
问题 Let me know if I left anything out. I can't figure out why my views/references/ folder isn't accessible. neither new.html.erb nor index.html.erb is available. When I go to localhost:3000/references my error is: RuntimeError in ReferencesController#index Circular dependency detected while autoloading constant ReferencesController I believe this is setup, and It shouldn't be a Rails issue because my other controllers are working fine. My routes file has resources :references in it, my rake