Skip to content

Commit 2a5f1d0

Browse files
tjgqcopybara-github
authored andcommitted
Convert to new-style arrow switch.
PiperOrigin-RevId: 792533001 Change-Id: Id9bcb6fda32207c0a8f78ee6f1abd4b95c92ee94
1 parent 8d3831d commit 2a5f1d0

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/main/java/com/google/devtools/build/lib/vfs/PathFragment.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,15 @@ private static PathFragment createInternal(String path, OsPathPolicy osPathPolic
143143
}
144144

145145
private static PathFragment makePathFragment(String normalizedPath, int driveStrLength) {
146-
switch (driveStrLength) {
147-
case 0:
148-
return new RelativePathFragment(normalizedPath);
149-
case 1:
150-
return new UnixStyleAbsolutePathFragment(normalizedPath);
151-
case 3:
152-
return new WindowsStyleAbsolutePathFragment(normalizedPath);
153-
default:
154-
throw new IllegalStateException(
155-
String.format(
156-
"normalizedPath: %s, driveStrLength: %s", normalizedPath, driveStrLength));
157-
}
146+
return switch (driveStrLength) {
147+
case 0 -> new RelativePathFragment(normalizedPath);
148+
case 1 -> new UnixStyleAbsolutePathFragment(normalizedPath);
149+
case 3 -> new WindowsStyleAbsolutePathFragment(normalizedPath);
150+
default ->
151+
throw new IllegalStateException(
152+
String.format(
153+
"normalizedPath: %s, driveStrLength: %s", normalizedPath, driveStrLength));
154+
};
158155
}
159156

160157
/**

0 commit comments

Comments
 (0)