diff options
author | corysmith <corysmith@google.com> | 2018-02-15 09:07:29 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-15 09:09:17 -0800 |
commit | e722c79d380c8a70d628deed7d0cbc5fe4609715 (patch) | |
tree | be4a9ef5a1b9c026abfae4a5c2bc48df784f831a /src/tools/android/java/com/google/devtools | |
parent | f264c987c02f644d63676c05da210dfb94784da3 (diff) |
Remove unused DataKey attribute.
RELNOTES: None
PiperOrigin-RevId: 185847904
Diffstat (limited to 'src/tools/android/java/com/google/devtools')
5 files changed, 11 insertions, 13 deletions
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<DataKey, DataValue> 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<DataValue, DataSource> VALUE_TO_SOURCE = - new Function<DataValue, DataSource>() { - @Override - public DataSource apply(DataValue input) { - return input.source(); - } - }; + private static final Function<DataValue, DataSource> VALUE_TO_SOURCE = DataValue::source; private final Map<DataSource, Integer> sourceTable = new LinkedHashMap<>(); private DataSource[] idToSource; @@ -73,7 +67,10 @@ class DataSourceTable { throws IOException { int sourceNumber = 0; LinkedList<DataSource> 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(); |