Skip to content

Commit 8599370

Browse files
committed
Fix indentation in generated code
1 parent 88d2190 commit 8599370

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

blackbox-test-inject/src/main/java/org/example/myapp/lazy/LazyBean.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class LazyBean {
1717

1818
@Inject @Nullable AtomicBoolean initialized;
1919

20+
public LazyBean() throws Exception {}
21+
2022
@PostConstruct
2123
void init(BeanScope scope) {
2224
// note that nested test scopes will not be lazy

blackbox-test-inject/src/main/java/org/example/myapp/lazy/LazyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class LazyFactory {
1414

1515
@Bean
1616
@Named("factory")
17-
LazyBean lazyInt(@Nullable AtomicBoolean initialized) {
17+
LazyBean lazyInt(@Nullable AtomicBoolean initialized) throws Exception {
1818

1919
// note that nested test scopes will not be lazy
2020
if (initialized != null) initialized.set(true);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ void addLifecycleCallbacks(Append writer, String indent) {
337337
void prototypePostConstruct(Append writer, String indent) {
338338
if (postConstructMethod != null) {
339339
var postConstruct = (ExecutableElement) postConstructMethod;
340-
writer.append("%s bean.%s(", indent, postConstructMethod.getSimpleName());
340+
writer.indent(indent).append(" bean.%s(", postConstructMethod.getSimpleName());
341341
if (postConstruct.getParameters().isEmpty()) {
342342
writer.append(");").eol();
343343
} else {

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ private void writeAddFor(MethodReader constructor) {
208208
}
209209

210210
writer.append(" }");
211-
212211
writer.eol();
213212
}
214213

@@ -226,13 +225,13 @@ private void writeCreateBean(MethodReader constructor) {
226225

227226
private void writeExtraInjection() {
228227
if (!beanReader.registerProvider()) {
229-
writer.indent(" ").append("builder.addInjector(b -> {").eol();
230-
writer.indent(" ").append(" // field and method injection").eol();
228+
writer.indent(indent).append(" builder.addInjector(b -> {").eol();
229+
writer.indent(indent).append(" // field and method injection").eol();
231230
}
232231
injectFields();
233232
injectMethods();
234233
if (!beanReader.registerProvider()) {
235-
writer.indent(" });").eol();
234+
writer.indent(indent).append(" });").eol();
236235
}
237236
}
238237

0 commit comments

Comments
 (0)