Skip to content

Commit 9de155f

Browse files
committed
Fix generator formatting to pass checkstyle
1 parent 95c163f commit 9de155f

2 files changed

Lines changed: 14 additions & 21 deletions

File tree

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/DeletedBlockLogStateManagerInvoker.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ public Object invokeLocal(String methodName, Object[] p) throws Exception {
143143
public Class<?> getReturnType(String methodName, Class<?>[] parameterTypes) {
144144
switch (methodName) {
145145
case "addTransactionsToDB":
146-
if (Arrays.equals(parameterTypes, new Class<?>[]{ArrayList.class})) {
146+
if (Arrays.equals(parameterTypes,
147+
new Class<?>[]{ArrayList.class})) {
147148
return void.class;
148149
}
149-
if (Arrays.equals(parameterTypes, new Class<?>[]{ArrayList.class, DeletedBlocksTransactionSummary.class})) {
150+
if (Arrays.equals(parameterTypes,
151+
new Class<?>[]{ArrayList.class, DeletedBlocksTransactionSummary.class})) {
150152
return void.class;
151153
}
152154
break;
@@ -164,16 +166,19 @@ public Class<?> getReturnType(String methodName, Class<?>[] parameterTypes) {
164166
break;
165167

166168
case "reinitialize":
167-
if (Arrays.equals(parameterTypes, new Class<?>[]{Table.class, Table.class})) {
169+
if (Arrays.equals(parameterTypes,
170+
new Class<?>[]{Table.class, Table.class})) {
168171
return void.class;
169172
}
170173
break;
171174

172175
case "removeTransactionsFromDB":
173-
if (Arrays.equals(parameterTypes, new Class<?>[]{ArrayList.class})) {
176+
if (Arrays.equals(parameterTypes,
177+
new Class<?>[]{ArrayList.class})) {
174178
return void.class;
175179
}
176-
if (Arrays.equals(parameterTypes, new Class<?>[]{ArrayList.class, DeletedBlocksTransactionSummary.class})) {
180+
if (Arrays.equals(parameterTypes,
181+
new Class<?>[]{ArrayList.class, DeletedBlocksTransactionSummary.class})) {
177182
return void.class;
178183
}
179184
break;

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/invoker/ScmInvokerCodeGenerator.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -508,22 +508,10 @@ void printReturnTypeIf(Method method) {
508508
return;
509509
}
510510

511-
final String condition =
512-
String.format("Arrays.equals(parameterTypes, new Class<?>[]{%s})", params);
513-
514-
if ((indentation + "if (" + condition + ")").length() <= LINE_LENGTH) {
515-
printf("if (%s)", condition);
516-
try (UncheckedAutoCloseable ignore = printScope()) {
517-
println("return %s.class;", getClassname(method.getReturnType()));
518-
}
519-
} else {
520-
println("if (Arrays.equals(parameterTypes,");
521-
try (UncheckedAutoCloseable ignore = printScope(false, 1)) {
522-
println("new Class<?>[]{%s}))", params);
523-
}
524-
try (UncheckedAutoCloseable ignore = printScope()) {
525-
println("return %s.class;", getClassname(method.getReturnType()));
526-
}
511+
println("if (Arrays.equals(parameterTypes,");
512+
printf(true, " new Class<?>[]{%s}))", params);
513+
try (UncheckedAutoCloseable ignore = printScope()) {
514+
println("return %s.class;", getClassname(method.getReturnType()));
527515
}
528516
}
529517

0 commit comments

Comments
 (0)