Skip to content

Commit

Permalink
Guard against ClassCastException in UpgradeTransitiveDependencyVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
jkschneider committed Mar 1, 2024
1 parent 0adc655 commit cf38d64
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
.withMarkers(Markers.EMPTY);

return autoFormat(m.withArguments(ListUtils.mapFirst(m.getArguments(), arg -> {
if(!(arg instanceof J.Lambda)) {
return arg;
}
J.Lambda dependencies = (J.Lambda) arg;
if (!(dependencies.getBody() instanceof J.Block)) {
return m;
Expand Down Expand Up @@ -360,6 +363,9 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
.withMarkers(Markers.EMPTY);

m = autoFormat(m.withArguments(ListUtils.mapFirst(m.getArguments(), arg -> {
if(!(arg instanceof J.Lambda)) {
return arg;
}
J.Lambda dependencies = (J.Lambda) arg;
if (!(dependencies.getBody() instanceof J.Block)) {
return arg;
Expand Down

0 comments on commit cf38d64

Please sign in to comment.