From e722c79d380c8a70d628deed7d0cbc5fe4609715 Mon Sep 17 00:00:00 2001 From: corysmith Date: Thu, 15 Feb 2018 09:07:29 -0800 Subject: Remove unused DataKey attribute. RELNOTES: None PiperOrigin-RevId: 185847904 --- .../devtools/build/android/AndroidDataSerializer.java | 2 +- .../google/devtools/build/android/DataResourceXml.java | 2 +- .../google/devtools/build/android/DataSourceTable.java | 15 ++++++--------- .../java/com/google/devtools/build/android/DataValue.java | 3 ++- .../com/google/devtools/build/android/DataValueFile.java | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/tools/android/java/com/google/devtools/build') diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidDataSerializer.java b/src/tools/android/java/com/google/devtools/build/android/AndroidDataSerializer.java index cb19f78dca..2304f3cb67 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidDataSerializer.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidDataSerializer.java @@ -98,7 +98,7 @@ public class AndroidDataSerializer { ByteArrayOutputStream valuesOutputStream = new ByteArrayOutputStream(2048); for (Map.Entry entry : entries) { orderedValueSizes[valueSizeIndex++] = - entry.getValue().serializeTo(entry.getKey(), sourceTable, valuesOutputStream); + entry.getValue().serializeTo(sourceTable, valuesOutputStream); } // Serialize all the keys in sorted order valueSizeIndex = 0; diff --git a/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java b/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java index 62993e35c6..2b39c449e6 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java @@ -391,7 +391,7 @@ public class DataResourceXml implements DataResource { } @Override - public int serializeTo(DataKey key, DataSourceTable sourceTable, OutputStream outStream) + public int serializeTo(DataSourceTable sourceTable, OutputStream outStream) throws IOException { return xml.serializeTo(sourceTable.getSourceId(source), namespaces, outStream); } diff --git a/src/tools/android/java/com/google/devtools/build/android/DataSourceTable.java b/src/tools/android/java/com/google/devtools/build/android/DataSourceTable.java index 53be389d9f..ac953da711 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataSourceTable.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataSourceTable.java @@ -14,7 +14,6 @@ package com.google.devtools.build.android; import com.google.common.base.Function; -import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.android.proto.SerializeFormat; @@ -29,6 +28,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.NavigableMap; +import java.util.stream.Collectors; /** * Tracks mappings from resource source paths (/foo/bar/res/values/colors.xml) to an ID for a more @@ -36,13 +36,7 @@ import java.util.NavigableMap; */ class DataSourceTable { - private static final Function VALUE_TO_SOURCE = - new Function() { - @Override - public DataSource apply(DataValue input) { - return input.source(); - } - }; + private static final Function VALUE_TO_SOURCE = DataValue::source; private final Map sourceTable = new LinkedHashMap<>(); private DataSource[] idToSource; @@ -73,7 +67,10 @@ class DataSourceTable { throws IOException { int sourceNumber = 0; LinkedList sourceQueue = - new LinkedList<>(Collections2.transform(map.values(), VALUE_TO_SOURCE)); + map.values() + .stream() + .map(VALUE_TO_SOURCE) + .collect(Collectors.toCollection(LinkedList::new)); while (!sourceQueue.isEmpty()) { DataSource source = sourceQueue.pop(); if (!sourceTable.containsKey(source)) { diff --git a/src/tools/android/java/com/google/devtools/build/android/DataValue.java b/src/tools/android/java/com/google/devtools/build/android/DataValue.java index ce86664a09..de9574508b 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataValue.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataValue.java @@ -29,7 +29,8 @@ public interface DataValue { DataSource source(); /** Serializes to a supplied stream and returns the number of bytes written. */ - int serializeTo(DataKey key, DataSourceTable sourceTable, OutputStream output) throws IOException; + int serializeTo( + DataSourceTable sourceTable, OutputStream output) throws IOException; DataValue update(DataSource source); diff --git a/src/tools/android/java/com/google/devtools/build/android/DataValueFile.java b/src/tools/android/java/com/google/devtools/build/android/DataValueFile.java index e45545f97a..3270e3ced0 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataValueFile.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataValueFile.java @@ -85,7 +85,7 @@ public class DataValueFile implements DataResource, DataAsset { } @Override - public int serializeTo(DataKey key, DataSourceTable sourceTable, OutputStream output) + public int serializeTo(DataSourceTable sourceTable, OutputStream output) throws IOException { SerializeFormat.DataValue.Builder builder = SerializeFormat.DataValue.newBuilder(); SerializeFormat.DataValue value = builder.setSourceId(sourceTable.getSourceId(source)).build(); -- cgit v1.2.3