Skip to content

Commit 1593ff2

Browse files
Post rebase fixes
1 parent 5bf7e66 commit 1593ff2

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

error-prone-contrib/src/test/resources/tech/picnic/errorprone/refasterrules/StreamRulesTestInput.java

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public ImmutableSet<Object> elidedTypesAndStaticImports() {
5050
identity(),
5151
ImmutableList.class,
5252
ImmutableMap.class,
53+
List.class,
5354
Map.class,
5455
mapping(null, null),
5556
maxBy(null),

refaster-test-support/src/main/java/tech/picnic/errorprone/refaster/test/RefasterRuleCollection.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import static java.util.stream.Collectors.joining;
1313
import static tech.picnic.errorprone.refaster.runner.Refaster.INCLUDED_RULES_PATTERN_FLAG;
1414

15+
import com.google.common.collect.ImmutableList;
1516
import com.google.common.collect.ImmutableListMultimap;
1617
import com.google.common.collect.ImmutableMap;
1718
import com.google.common.collect.ImmutableRangeMap;
@@ -241,17 +242,13 @@ private void reportUnSortedElidedTypesAndStaticImports(
241242
}
242243

243244
private static String getArgumentName(ExpressionTree arg, VisitorState state) {
244-
switch (arg.getKind()) {
245-
case MEMBER_SELECT:
246-
return state.getSourceForNode(((MemberSelectTree) arg).getExpression());
247-
case METHOD_INVOCATION:
248-
return state.getSourceForNode(((MethodInvocationTree) arg).getMethodSelect());
249-
case STRING_LITERAL:
250-
case INT_LITERAL:
251-
return ((LiteralTree) arg).getValue().toString();
252-
default:
253-
return "";
254-
}
245+
return switch (arg.getKind()) {
246+
case MEMBER_SELECT -> state.getSourceForNode(((MemberSelectTree) arg).getExpression());
247+
case METHOD_INVOCATION ->
248+
state.getSourceForNode(((MethodInvocationTree) arg).getMethodSelect());
249+
case STRING_LITERAL, INT_LITERAL -> ((LiteralTree) arg).getValue().toString();
250+
default -> "";
251+
};
255252
}
256253

257254
private static ImmutableRangeMap<Integer, String> indexRuleMatches(

0 commit comments

Comments
 (0)