diff options
author | 2017-06-30 00:32:04 +0200 | |
---|---|---|
committer | 2017-06-30 13:00:58 +0200 | |
commit | 3d2a68c6da2a50a9e1bcf6615e83a43701cdf95d (patch) | |
tree | 31692a985d316e33733ab6993e529b8a08c206b6 /src/main/java/com/google/devtools/build/lib/windows | |
parent | 2d5eeab381713f99c8c8b7b80f3d447be847b548 (diff) |
Automated conversion to Java 8
With a few manual fixes for readability.
RELNOTES: None.
PiperOrigin-RevId: 160582556
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/windows')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java | 22 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/windows/WindowsSubprocess.java | 11 |
2 files changed, 11 insertions, 22 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java b/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java index 893a563c3e..e1eb08fc3b 100644 --- a/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java +++ b/src/main/java/com/google/devtools/build/lib/windows/WindowsFileSystem.java @@ -69,19 +69,15 @@ public class WindowsFileSystem extends JavaIoFileSystem { /** Resolves DOS-style, shortened path names, returning the last segment's long form. */ private static final Function<String, String> WINDOWS_SHORT_PATH_RESOLVER = - new Function<String, String>() { - @Override - @Nullable - public String apply(String path) { - try { - // Since Path objects are created hierarchically, we know for sure that every segment of - // the path, except the last one, is already canonicalized, so we can return just that. - // Plus the returned value is passed to Path.getChild so we must not return a full - // path here. - return PathFragment.create(WindowsFileOperations.getLongPath(path)).getBaseName(); - } catch (IOException e) { - return null; - } + path -> { + try { + // Since Path objects are created hierarchically, we know for sure that every segment of + // the path, except the last one, is already canonicalized, so we can return just that. + // Plus the returned value is passed to Path.getChild so we must not return a full + // path here. + return PathFragment.create(WindowsFileOperations.getLongPath(path)).getBaseName(); + } catch (IOException e) { + return null; } }; diff --git a/src/main/java/com/google/devtools/build/lib/windows/WindowsSubprocess.java b/src/main/java/com/google/devtools/build/lib/windows/WindowsSubprocess.java index 16f05e47e6..0aea491bd3 100644 --- a/src/main/java/com/google/devtools/build/lib/windows/WindowsSubprocess.java +++ b/src/main/java/com/google/devtools/build/lib/windows/WindowsSubprocess.java @@ -145,15 +145,8 @@ public class WindowsSubprocess implements Subprocess { waitLatch = new CountDownLatch(1); // Every Windows process we start consumes a thread here. This is suboptimal, but seems to be // the sanest way to reconcile WaitForMultipleObjects() and Java-style interruption. - @SuppressWarnings("unused") - Future<?> possiblyIgnoredError = - WAITER_POOL.submit( - new Runnable() { - @Override - public void run() { - waiterThreadFunc(); - } - }); + @SuppressWarnings("unused") + Future<?> possiblyIgnoredError = WAITER_POOL.submit(this::waiterThreadFunc); } private void waiterThreadFunc() { |