mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Leverage basic Java 17 features (#451)
- Refactor code to use the following basic Java 17 features: - pattern matching for instanceof - @Serial annotation - switch expressions - enhanced switch statements - StringBuilder.isEmpty() - Replace two switch statements with simpler if statements. - Rename a few local variables.
This commit is contained in:
@@ -111,10 +111,10 @@ public class ListSort {
|
||||
// append `.length` to avoid rendering the list
|
||||
new ReplRequest.Eval("sort", "nums.sortWith(cmp).length", false, false))
|
||||
.get(0);
|
||||
if (!(response instanceof ReplResponse.EvalSuccess)) {
|
||||
if (!(response instanceof ReplResponse.EvalSuccess success)) {
|
||||
throw new AssertionError(response);
|
||||
}
|
||||
return ((ReplResponse.EvalSuccess) response).getResult();
|
||||
return success.getResult();
|
||||
}
|
||||
|
||||
// note that this is an uneven comparison
|
||||
|
||||
Reference in New Issue
Block a user