Skip to content

Commit c4c561f

Browse files
committed
Remove spurious line breaks from generated code
1 parent 6d537c6 commit c4c561f

File tree

9 files changed

+13
-21
lines changed

9 files changed

+13
-21
lines changed

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoDeleteMethodGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,8 @@ public Optional<MethodSpec> generate() {
279279
}
280280
}
281281

282-
createStatementBlock
283-
.add("\n")
284-
.addStatement("$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
282+
createStatementBlock.addStatement(
283+
"$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
285284

286285
return crudMethod(createStatementBlock, returnType, helperFieldName);
287286
}

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoIncrementMethodGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ public Optional<MethodSpec> generate() {
217217
context,
218218
false);
219219

220-
updateStatementBlock
221-
.add("\n")
222-
.addStatement("$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
220+
updateStatementBlock.addStatement(
221+
"$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
223222

224223
return crudMethod(updateStatementBlock, returnType, helperFieldName);
225224
}

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoInsertMethodGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,8 @@ public Optional<MethodSpec> generate() {
176176
}
177177
}
178178

179-
createStatementBlock
180-
.add("\n")
181-
.addStatement("$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
179+
createStatementBlock.addStatement(
180+
"$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
182181

183182
return crudMethod(createStatementBlock, returnType, helperFieldName);
184183
}

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoQueryMethodGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ public Optional<MethodSpec> generate() {
125125
GeneratedCodePatterns.bindParameters(
126126
parameters, createStatementBlock, enclosingClass, context, true);
127127

128-
createStatementBlock
129-
.add("\n")
130-
.addStatement("$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
128+
createStatementBlock.addStatement(
129+
"$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
131130

132131
return crudMethod(createStatementBlock, returnType, helperFieldName);
133132
} else {

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoSelectMethodGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,8 @@ public Optional<MethodSpec> generate() {
202202
}
203203
}
204204

205-
createStatementBlock
206-
.add("\n")
207-
.addStatement("$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
205+
createStatementBlock.addStatement(
206+
"$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
208207

209208
return crudMethod(createStatementBlock, returnType, helperFieldName);
210209
}

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/dao/DaoUpdateMethodGenerator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ public Optional<MethodSpec> generate() {
187187
}
188188
}
189189

190-
createStatementBlock
191-
.add("\n")
192-
.addStatement("$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
190+
createStatementBlock.addStatement(
191+
"$T boundStatement = boundStatementBuilder.build()", BoundStatement.class);
193192

194193
return crudMethod(createStatementBlock, returnType, helperFieldName);
195194
}

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/entity/EntityHelperGetMethodGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public Optional<MethodSpec> generate() {
7575
String setterName = property.getSetterName();
7676
String propertyValueName = enclosingClass.getNameIndex().uniqueField("propertyValue");
7777
propertyValueNames.add(propertyValueName);
78-
getBuilder.addCode("\n");
7978
if (type instanceof PropertyType.Simple) {
8079
TypeName typeName = ((PropertyType.Simple) type).typeName;
8180
String primitiveAccessor = GeneratedCodePatterns.PRIMITIVE_ACCESSORS.get(typeName);

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/entity/EntityHelperSetMethodGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Optional<MethodSpec> generate() {
7373
enclosingClass,
7474
true);
7575
}
76-
injectBodyBuilder.add("\n").addStatement("return target");
76+
injectBodyBuilder.addStatement("return target");
7777
return Optional.of(injectBuilder.addCode(injectBodyBuilder.build()).build());
7878
}
7979
}

mapper-processor/src/main/java/com/datastax/oss/driver/internal/mapper/processor/util/generation/GeneratedCodePatterns.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public static void setValue(
225225
CodeBlock.Builder methodBuilder,
226226
BindableHandlingSharedCode enclosingClass,
227227
boolean useNullSavingStrategy) {
228-
methodBuilder.add("\n");
229228

230229
if (type instanceof PropertyType.Simple) {
231230
TypeName typeName = ((PropertyType.Simple) type).typeName;

0 commit comments

Comments
 (0)