Skip to content

Commit 14e9019

Browse files
committed
re-format in java stype
Signed-off-by: Alexander Bezzubov <[email protected]>
1 parent 218768b commit 14e9019

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

native/src/main/java/bblfsh/CompilationUnitSerializer.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public void serialize(CompilationUnit cu, JsonGenerator jG, SerializerProvider p
4040
jG.writeEndObject();
4141
}
4242

43-
private void serializeAll(CompilationUnit cu, ASTNode node, JsonGenerator jG,
44-
SerializerProvider provider) throws IOException {
43+
private void serializeAll(CompilationUnit cu, ASTNode node, JsonGenerator jG, SerializerProvider provider)
44+
throws IOException {
4545
List<StructuralPropertyDescriptor> descriptorList = node.structuralPropertiesForType();
4646
jG.writeStartObject();
4747

@@ -72,9 +72,10 @@ private void serializeAll(CompilationUnit cu, ASTNode node, JsonGenerator jG,
7272
jG.writeFieldName("comments");
7373
jG.writeStartArray();
7474

75-
for (Comment c: (List<Comment>) cu.getCommentList()) {
76-
if (c.getParent() != null)
75+
for (Comment c : cl) {
76+
if (c.getParent() != null) {
7777
continue;
78+
}
7879

7980
CommentVisitor visitor = new CommentVisitor(cu, contentLines);
8081
c.accept(visitor);
@@ -86,7 +87,7 @@ private void serializeAll(CompilationUnit cu, ASTNode node, JsonGenerator jG,
8687
jG.writeString(name);
8788
jG.writeFieldName("text");
8889
jG.writeString(visitor.getCommentText());
89-
serializePosition(cu, (ASTNode)c, jG);
90+
serializePosition(cu, (ASTNode) c, jG);
9091
jG.writeEndObject();
9192
}
9293
jG.writeEndArray();
@@ -96,10 +97,8 @@ private void serializeAll(CompilationUnit cu, ASTNode node, JsonGenerator jG,
9697
jG.writeEndObject();
9798
}
9899

99-
private void serializeChildList(CompilationUnit cu, List<ASTNode> children,
100-
JsonGenerator jG,
101-
StructuralPropertyDescriptor descriptor,
102-
SerializerProvider provider) throws IOException {
100+
private void serializeChildList(CompilationUnit cu, List<ASTNode> children, JsonGenerator jG,
101+
StructuralPropertyDescriptor descriptor, SerializerProvider provider) throws IOException {
103102
jG.writeFieldName(descriptor.getId());
104103
if (children.size() < 1) {
105104
jG.writeNull();
@@ -112,7 +111,8 @@ private void serializeChildList(CompilationUnit cu, List<ASTNode> children,
112111
jG.writeEndArray();
113112
}
114113

115-
private void serializeChild(CompilationUnit cu, ASTNode child, JsonGenerator jG, StructuralPropertyDescriptor descriptor, SerializerProvider provider) throws IOException {
114+
private void serializeChild(CompilationUnit cu, ASTNode child, JsonGenerator jG,
115+
StructuralPropertyDescriptor descriptor, SerializerProvider provider) throws IOException {
116116
jG.writeFieldName(descriptor.getId());
117117
serializeAll(cu, child, jG, provider);
118118
}
@@ -133,7 +133,8 @@ private void serializePosition(CompilationUnit cu, ASTNode node, JsonGenerator j
133133
jG.writeEndObject();
134134
}
135135

136-
private void serializePositionFields(CompilationUnit cu, JsonGenerator jG, int pos, String name) throws IOException {
136+
private void serializePositionFields(CompilationUnit cu, JsonGenerator jG, int pos, String name)
137+
throws IOException {
137138
jG.writeFieldName(name);
138139
jG.writeStartObject();
139140

native/src/main/java/bblfsh/Driver.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
import org.eclipse.jdt.core.dom.Message;
44

5-
import sun.reflect.annotation.ExceptionProxy;
6-
75
import java.io.IOException;
86

97
import java.util.ArrayList;
108
import java.util.Arrays;
11-
import java.util.stream.Stream;
129
import java.util.stream.Collectors;
1310

1411
public class Driver {
@@ -70,9 +67,8 @@ private Response processRequest(final Request request) {
7067
} catch (IOException e) {
7168
return createFatalResponse(e);
7269
}
73-
response.errors = Arrays.stream(response.ast.getMessages())
74-
.map(Message::getMessage)
75-
.collect(Collectors.toCollection(ArrayList::new));
70+
response.errors = Arrays.stream(response.ast.getMessages()).map(Message::getMessage)
71+
.collect(Collectors.toCollection(ArrayList::new));
7672
response.status = response.errors.isEmpty() ? "ok" : "error";
7773
return response;
7874
}

native/src/test/java/bblfsh/DriverTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void process() throws DriverException, CloseException {
2222
final Driver driver = new Driver(reader, writer);
2323
driver.processOne();
2424
driver.processOne();
25-
//TODO: check output
25+
// TODO: check output
2626
}
2727

2828
@Test
@@ -37,7 +37,8 @@ public void exitOnCloseIn() throws DriverException, CloseException {
3737
final Driver driver = new Driver(reader, writer);
3838
try {
3939
driver.run();
40-
} catch (CloseException ex) { }
40+
} catch (CloseException ex) {
41+
}
4142
}
4243

4344
@Test
@@ -67,7 +68,8 @@ public void processInvalid() throws DriverException, CloseException {
6768
driver.processOne();
6869

6970
final String result = new String(out.toByteArray());
70-
assertThat(result).isEqualTo("{\"status\":\"fatal\",\"errors\":[\"Unrecognized token 'garbage': was expecting ('true', 'false' or 'null')\\n at [Source: (String)\\\"garbage\\\"; line: 1, column: 15]\"]}\n");
71+
assertThat(result).isEqualTo(
72+
"{\"status\":\"fatal\",\"errors\":[\"Unrecognized token 'garbage': was expecting ('true', 'false' or 'null')\\n at [Source: (String)\\\"garbage\\\"; line: 1, column: 15]\"]}\n");
7173
}
7274

7375
@Test
@@ -81,6 +83,6 @@ public void processComment() throws DriverException, CloseException {
8183

8284
final Driver driver = new Driver(reader, writer);
8385
driver.processOne();
84-
//TODO: check output
86+
// TODO: check output
8587
}
8688
}

0 commit comments

Comments
 (0)