Skip to content

Commit ab4d163

Browse files
committed
Test for #19 @factory fails with types implementing interfaces
Plus bump generator to SNAPSHOT with the fix (will be in 1.3 generator)
1 parent 030abf7 commit ab4d163

File tree

7 files changed

+71
-1
lines changed

7 files changed

+71
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<dependency>
3737
<groupId>io.dinject</groupId>
3838
<artifactId>dinject-generator</artifactId>
39-
<version>1.2</version>
39+
<version>1.3-SNAPSHOT</version>
4040
<scope>test</scope>
4141
</dependency>
4242

src/test/java/org/example/coffee/factory/MyFactory.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.dinject.Bean;
44
import io.dinject.Factory;
5+
import org.example.coffee.factory.other.Something;
56

67
@Factory
78
public class MyFactory {
@@ -10,4 +11,9 @@ public class MyFactory {
1011
CFact buildCFact() {
1112
return new CFact();
1213
}
14+
15+
@Bean
16+
Something buildSomething() {
17+
return new SomeImpl();
18+
}
1319
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.example.coffee.factory;
2+
3+
import org.example.coffee.factory.other.Something;
4+
5+
public class SomeImpl implements Something {
6+
7+
@Override
8+
public void doStuff() {
9+
10+
}
11+
12+
@Override
13+
public void otherThing() {
14+
15+
}
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.example.coffee.factory;
2+
3+
import org.example.coffee.factory.other.Something;
4+
5+
import javax.inject.Singleton;
6+
7+
@Singleton
8+
public class SomeImplBean implements Something {
9+
10+
@Override
11+
public void doStuff() {
12+
13+
}
14+
15+
@Override
16+
public void otherThing() {
17+
18+
}
19+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.example.coffee.factory;
2+
3+
import org.example.coffee.factory.other.Something;
4+
5+
import javax.inject.Inject;
6+
import javax.inject.Singleton;
7+
8+
@Singleton
9+
public class Unused {
10+
11+
private final Something something;
12+
13+
@Inject
14+
public Unused(Something something) {
15+
this.something = something;
16+
}
17+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.example.coffee.factory.other;
2+
3+
public interface SomeOtherThing {
4+
5+
void otherThing();
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.example.coffee.factory.other;
2+
3+
public interface Something extends SomeOtherThing {
4+
5+
void doStuff();
6+
}

0 commit comments

Comments
 (0)