Skip to content

Commit

Permalink
Converted to ImmutableList.
Browse files Browse the repository at this point in the history
  • Loading branch information
nimakarimipour committed Jan 25, 2022
1 parent 255bc60 commit 0c89e5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
Expand Down Expand Up @@ -360,7 +361,7 @@ void reportInitializerError(
String message,
VisitorState state,
Description.Builder descriptionBuilder,
List<Symbol> nonNullFields) {
ImmutableList<Symbol> nonNullFields) {
// Check needed here, despite check in hasPathSuppression because initialization
// checking happens at the class-level (meaning state.getPath() might not include the
// method itself).
Expand Down
16 changes: 10 additions & 6 deletions nullaway/src/main/java/com/uber/nullaway/NullAway.java
Original file line number Diff line number Diff line change
Expand Up @@ -1517,12 +1517,16 @@ private void checkFieldInitialization(ClassTree tree, VisitorState state) {
}
}
for (Element constructorElement : errorFieldsForInitializer.keySet()) {
List<Symbol> fieldSymbols =
errorFieldsForInitializer
.get(constructorElement)
.stream()
.map(element -> ASTHelpers.getSymbol(getTreesInstance(state).getTree(element)))
.collect(Collectors.toList());
ImmutableList<Symbol> fieldSymbols =
ImmutableList.<Symbol>builder()
.addAll(
errorFieldsForInitializer
.get(constructorElement)
.stream()
.map(
element -> ASTHelpers.getSymbol(getTreesInstance(state).getTree(element)))
.collect(Collectors.toList()))
.build();
errorBuilder.reportInitializerError(
(Symbol.MethodSymbol) constructorElement,
errMsgForInitializer(errorFieldsForInitializer.get(constructorElement), state),
Expand Down

0 comments on commit 0c89e5e

Please sign in to comment.