Skip to content

Commit 22c62ad

Browse files
author
Andriy Onyshchuk
committed
format code
1 parent c4ceffc commit 22c62ad

5 files changed

Lines changed: 20 additions & 28 deletions

File tree

dataenum-processor/src/main/java/com/spotify/dataenum/processor/data/OutputSpec.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ public class OutputSpec extends Spec {
3131
private final Iterable<OutputValue> outputValues;
3232

3333
public OutputSpec(Spec input, ClassName outputClass, Iterable<OutputValue> outputValues) {
34-
super(input.specClass(), input.typeVariables(), input.superInterfaces(), input.values(), input.methods());
34+
super(
35+
input.specClass(),
36+
input.typeVariables(),
37+
input.superInterfaces(),
38+
input.values(),
39+
input.methods());
3540
this.outputClass = outputClass;
3641
this.outputValues = outputValues;
3742
}

dataenum-processor/src/main/java/com/spotify/dataenum/processor/generator/method/MethodMethods.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ public static MethodSpec.Builder builderFrom(
4141

4242
public static CodeBlock codeBlockFrom(ExecutableElement el, Trees trees) {
4343
final MethodTree methodTree = MethodLookup.lookupTree(el, trees);
44-
return methodTree
45-
.getBody()
46-
.getStatements()
47-
.stream()
44+
return methodTree.getBody().getStatements().stream()
4845
.map(x -> CodeBlock.of(x.toString()))
4946
.reduce(CodeBlock.of(""), (a, b) -> a.toBuilder().add(b).build());
5047
}

dataenum-processor/src/main/java/com/spotify/dataenum/processor/parser/MembersParser.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ static Pair<List<Value>, List<MethodSpec>> parse(TypeElement enumElement, Proces
8080
+ "Method spec must be marked as `default`, but found (%s) "
8181
+ "Element: %s",
8282
element.getReturnType(),
83-
element
84-
.getModifiers()
85-
.stream()
83+
element.getModifiers().stream()
8684
.map(Modifier::toString)
8785
.collect(Collectors.joining(", ")),
8886
element),
@@ -113,9 +111,7 @@ static Pair<List<Value>, List<MethodSpec>> parse(TypeElement enumElement, Proces
113111
? null
114112
: new Pair<>(
115113
values,
116-
classified
117-
.adtMethods()
118-
.stream()
114+
classified.adtMethods().stream()
119115
.map(x -> MethodParser.parse(x, ctx.trees))
120116
.collect(Collectors.toList()));
121117
}
@@ -137,8 +133,7 @@ public ClassifiedElements get(List<? extends Element> elements) {
137133
x -> x.getModifiers().contains(Modifier.DEFAULT);
138134

139135
final Map<String, ? extends List<? extends Element>> xs =
140-
elements
141-
.stream()
136+
elements.stream()
142137
.collect(
143138
Collectors.groupingBy(
144139
e -> {
@@ -180,9 +175,7 @@ boolean containsNotSupportedMethods() {
180175

181176
List<ExecutableElement> notSupportedMethods() {
182177
if (elements.containsKey(NOT_SUPPORTED_METHOD)) {
183-
return elements
184-
.get(NOT_SUPPORTED_METHOD)
185-
.stream()
178+
return elements.get(NOT_SUPPORTED_METHOD).stream()
186179
.map(x -> (ExecutableElement) x)
187180
.collect(Collectors.toList());
188181
} else return Collections.emptyList();
@@ -194,9 +187,7 @@ boolean containsValues() {
194187

195188
List<ExecutableElement> values() {
196189
if (elements.containsKey(VALUE)) {
197-
return elements
198-
.get(VALUE)
199-
.stream()
190+
return elements.get(VALUE).stream()
200191
.map(x -> (ExecutableElement) x)
201192
.collect(Collectors.toList());
202193
} else return Collections.emptyList();
@@ -208,9 +199,7 @@ boolean containsAdtMethods() {
208199

209200
List<ExecutableElement> adtMethods() {
210201
if (elements.containsKey(ADT_METHOD)) {
211-
return elements
212-
.get(ADT_METHOD)
213-
.stream()
202+
return elements.get(ADT_METHOD).stream()
214203
.map(x -> (ExecutableElement) x)
215204
.collect(Collectors.toList());
216205
} else return Collections.emptyList();

dataenum-processor/src/main/java/com/spotify/dataenum/processor/parser/SpecParser.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ public static Spec parse(Element element, ProcessingContext ctx) {
6363
}
6464

6565
List<ClassName> interfaces =
66-
dataEnum.getInterfaces().stream()
67-
.map(x -> ClassName.get((TypeElement) ((DeclaredType) x).asElement()))
68-
.collect(Collectors.toList());
69-
66+
dataEnum.getInterfaces().stream()
67+
.map(x -> ClassName.get((TypeElement) ((DeclaredType) x).asElement()))
68+
.collect(Collectors.toList());
69+
7070
ClassName enumInterface = ClassName.get(dataEnum);
7171

72-
return new Spec(enumInterface, typeVariableNames, interfaces, valuesAndMethods.fst, valuesAndMethods.snd);
72+
return new Spec(
73+
enumInterface, typeVariableNames, interfaces, valuesAndMethods.fst, valuesAndMethods.snd);
7374
}
7475
}

dataenum-processor/src/test/java/com/spotify/dataenum/processor/IntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public void shouldCopyAnnotationsFromCaseSourceToFactoryMethod() {
286286
public void methodsAndValuesEnum() throws Exception {
287287
assertThatEnumGeneratedMatchingFile("MethodsAndValues");
288288
}
289-
289+
290290
public void superInterfaces() {
291291
assertThatEnumGeneratedMatchingFile("SuperInterfaces");
292292
}

0 commit comments

Comments
 (0)