Skip to content

Commit 0750325

Browse files
committed
#146 - Module code isn't constructing in topologically sorted order?
1 parent 004d91b commit 0750325

File tree

6 files changed

+55
-1
lines changed

6 files changed

+55
-1
lines changed

inject-generator/src/main/java/io/avaje/inject/generator/MetaDataOrdering.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ private boolean allDependenciesWired(MetaData queuedMeta) {
175175
// check non-provider dependency is satisfied
176176
ProviderList providerList = providers.get(dependency);
177177
if (providerList == null) {
178-
return scopeInfo.providedByOtherModule(dependency);
178+
if (!scopeInfo.providedByOtherModule(dependency)) {
179+
return false;
180+
}
179181
} else {
180182
if (!providerList.isAllWired()) {
181183
return false;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.example.custom3;
2+
3+
import org.example.custom2.OcsOne;
4+
5+
@MyThreeScope
6+
public class TcsA {
7+
8+
final OcsOne one;
9+
final TcsRed red;
10+
11+
/**
12+
* Other module supplied dependency is first (Issue #146)
13+
*/
14+
public TcsA(OcsOne one, TcsRed red) {
15+
this.one = one;
16+
this.red = red;
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.example.custom3;
2+
3+
@MyThreeScope
4+
public class TcsArt {
5+
6+
final TcsBart bart;
7+
8+
public TcsArt(TcsBart bart) {
9+
this.bart = bart;
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.example.custom3;
2+
3+
@MyThreeScope
4+
public class TcsBart {
5+
6+
final TcsCart cart;
7+
8+
public TcsBart(TcsCart cart) {
9+
this.cart = cart;
10+
}
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.example.custom3;
2+
3+
@MyThreeScope
4+
public class TcsCart {
5+
6+
}

inject-test/src/test/java/org/example/custom3/TcsRed.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@
66
@OciMarker
77
@MyThreeScope
88
public class TcsRed implements OciRock {
9+
10+
final TcsArt art;
11+
12+
public TcsRed(TcsArt art) {
13+
this.art = art;
14+
}
915
}

0 commit comments

Comments
 (0)