File tree Expand file tree Collapse file tree 4 files changed +27
-2
lines changed
blackbox-test-inject/src/main/java/org/example/myapp
inject-generator/src/main/java/io/avaje/inject/generator Expand file tree Collapse file tree 4 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ public Builder newBuilder() {
48
48
return new Builder ();
49
49
}
50
50
51
+ @ Prototype
52
+ @ Bean
53
+ public BuilderThrows newBuilderThrows () throws Exception {
54
+ return new BuilderThrows ();
55
+ }
56
+
51
57
@ Bean
52
58
Generated newGenerated () {
53
59
return new Generated ();
@@ -59,6 +65,12 @@ public MySecType generalSecondary() {
59
65
return new MySecType ();
60
66
}
61
67
68
+ @ Secondary
69
+ @ Bean
70
+ public MySecTypeThrows generalSecondaryThrows () throws Exception {
71
+ return new MySecTypeThrows ();
72
+ }
73
+
62
74
@ Secondary
63
75
@ Bean
64
76
public Optional <MySecOptType > optionalSecondary () {
@@ -100,12 +112,18 @@ MyAbstract myAbstract() {
100
112
public static class Builder {
101
113
}
102
114
115
+ public static class BuilderThrows {
116
+ }
117
+
103
118
public static class Generated {
104
119
}
105
120
106
121
public static class MySecType {
107
122
}
108
123
124
+ public static class MySecTypeThrows {
125
+ }
126
+
109
127
public static class MySecOptType {
110
128
}
111
129
Original file line number Diff line number Diff line change @@ -20,4 +20,10 @@ LazyBean lazyInt(@Nullable AtomicBoolean initialized) {
20
20
if (initialized != null ) initialized .set (true );
21
21
return new LazyBean ();
22
22
}
23
+
24
+ @ Bean
25
+ @ Named ("factoryThrows" )
26
+ LazyBean lazyIntThrows (@ Nullable AtomicBoolean initialized ) throws Exception {
27
+ return lazyInt (initialized );
28
+ }
23
29
}
Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ void builderAddBeanProvider(Append writer) {
205
205
206
206
writer .indent (String .format (".%s(() -> {" , lazy ? "registerLazy" : "registerProvider" )).eol ();
207
207
208
+ startTry (writer );
208
209
writer .indent (indent ).append (" return " );
209
210
writer .append ("factory.%s(" , methodName );
210
211
for (int i = 0 ; i < params .size (); i ++) {
@@ -214,6 +215,7 @@ void builderAddBeanProvider(Append writer) {
214
215
params .get (i ).builderGetDependency (writer , "builder" );
215
216
}
216
217
writer .append (");" ).eol ();
218
+ endTry (writer );
217
219
writer .indent (indent ).append (" });" ).eol ();
218
220
writer .indent (indent ).append ("}" ).eol ();
219
221
}
Original file line number Diff line number Diff line change @@ -144,11 +144,10 @@ private void writeFactoryBeanMethod(MethodReader method) {
144
144
method .buildConditional (writer );
145
145
method .buildAddFor (writer );
146
146
method .builderGetFactory (writer , beanReader .hasConditions ());
147
- method .startTry (writer );
148
147
if (method .isLazy () || method .isProtoType () || method .isUseProviderForSecondary ()) {
149
148
method .builderAddBeanProvider (writer );
150
- method .endTry (writer );
151
149
} else {
150
+ method .startTry (writer );
152
151
method .builderBuildBean (writer );
153
152
method .builderBuildAddBean (writer );
154
153
method .endTry (writer );
You can’t perform that action at this time.
0 commit comments