aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/jdk
diff options
context:
space:
mode:
authorGravatar cushon <cushon@google.com>2018-01-24 02:52:19 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-24 02:54:07 -0800
commit444fc9fb7b3d967cb392c8a11a0240892aadb2d6 (patch)
tree9aa72da406399241ec6c5a56c1448c62f9af9e88 /tools/jdk
parent344b08c032b5520ba333fae4a4ab9d1d64eec6f8 (diff)
Suppress an unchecked warning
Fixes #4513 PiperOrigin-RevId: 183060664
Diffstat (limited to 'tools/jdk')
-rw-r--r--tools/jdk/DumpPlatformClassPath.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/jdk/DumpPlatformClassPath.java b/tools/jdk/DumpPlatformClassPath.java
index 300e288d88..c63d8c7741 100644
--- a/tools/jdk/DumpPlatformClassPath.java
+++ b/tools/jdk/DumpPlatformClassPath.java
@@ -63,17 +63,7 @@ public class DumpPlatformClassPath {
// this configures the filemanager to use a JDK 8 bootclasspath
compiler.getTask(
null, fileManager, null, Arrays.asList("--release", targetRelease), null, null);
- Iterable<Path> paths;
- try {
- paths =
- (Iterable<Path>)
- StandardJavaFileManager.class
- .getMethod("getLocationAsPaths", Location.class)
- .invoke(fileManager, StandardLocation.PLATFORM_CLASS_PATH);
- } catch (ReflectiveOperationException e) {
- throw new LinkageError(e.getMessage(), e);
- }
- for (Path path : paths) {
+ for (Path path : getLocationAsPaths(fileManager)) {
Files.walkFileTree(
path,
new SimpleFileVisitor<Path>() {
@@ -108,6 +98,18 @@ public class DumpPlatformClassPath {
}
}
+ @SuppressWarnings("unchecked")
+ private static Iterable<Path> getLocationAsPaths(StandardJavaFileManager fileManager) {
+ try {
+ return (Iterable<Path>)
+ StandardJavaFileManager.class
+ .getMethod("getLocationAsPaths", Location.class)
+ .invoke(fileManager, StandardLocation.PLATFORM_CLASS_PATH);
+ } catch (ReflectiveOperationException e) {
+ throw new LinkageError(e.getMessage(), e);
+ }
+ }
+
// Use a fixed timestamp for deterministic jar output.
private static final long FIXED_TIMESTAMP =
new GregorianCalendar(2010, 0, 1, 0, 0, 0).getTimeInMillis();