diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java index 1b7f7706c1aece..8f4143b0d41907 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AarImportBaseRule.java @@ -22,7 +22,6 @@ import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; import com.google.devtools.build.lib.analysis.config.HostTransition; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType; import com.google.devtools.build.lib.packages.SkylarkProviderIdentifier; import com.google.devtools.build.lib.rules.android.AndroidRuleClasses.AndroidBaseRule; @@ -39,7 +38,7 @@ public class AarImportBaseRule implements RuleDefinition { static final String ZIPPER = "$zipper"; @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment env) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { return builder /* The .aar file to provide to the Android targets that depend on this target. diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java index 672130407eb4f4..eed11af544fcb1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java @@ -48,7 +48,6 @@ import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg; import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction; import com.google.devtools.build.lib.analysis.actions.SpawnAction; -import com.google.devtools.build.lib.analysis.actions.SpawnAction.Builder; import com.google.devtools.build.lib.analysis.actions.SpawnActionTemplate; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode; import com.google.devtools.build.lib.collect.nestedset.NestedSet; @@ -539,7 +538,7 @@ public static RuleConfiguredTargetBuilder createAndroidBinary( AndroidRuleClasses.INSTRUMENTATION_TEST_CHECK_RESULTS); SpawnAction.Builder checkAction = - new Builder() + new SpawnAction.Builder() .setExecutable(checker) .addInput(targetManifest) .addInput(instrumentationManifest) diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceScriptFixtureRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceScriptFixtureRule.java index 9904978c4c0690..7ce97cb833f126 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceScriptFixtureRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidDeviceScriptFixtureRule.java @@ -23,7 +23,6 @@ import com.google.devtools.build.lib.analysis.RuleDefinition; import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.util.FileType; /** Rule definition for the {@code android_device_script_fixture} rule. */ @@ -32,7 +31,7 @@ public class AndroidDeviceScriptFixtureRule implements RuleDefinition { static final FileType DEVICE_SCRIPT_FIXTURE = FileType.of(".sh"); @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) { return builder .setUndocumented() .add( diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java index 9338cd0c96adce..04de0b7cbe1b18 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidHostServiceFixtureRule.java @@ -24,12 +24,11 @@ import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; import com.google.devtools.build.lib.analysis.config.HostTransition; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; /** Rule definition for the {@code android_host_service_fixture} rule. */ public class AndroidHostServiceFixtureRule implements RuleDefinition { @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment env) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { return builder .setUndocumented() .add(attr("executable", LABEL) diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java index 2cf5aa14786966..41cb498ec588d0 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidIdlHelper.java @@ -39,7 +39,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import javax.annotation.Nullable; @@ -299,7 +298,7 @@ private static void generateAndroidIdlCompilationActions( preprocessedArgs.add("-p" + idlPreprocessed.getExecPathString()); } - for (Entry entry : translatedIdlSources.entrySet()) { + for (Map.Entry entry : translatedIdlSources.entrySet()) { createAndroidIdlAction( ruleContext, entry.getKey(), diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestRule.java index 4ee64896aa0b97..a9f6fe48261e88 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidInstrumentationTestRule.java @@ -22,7 +22,6 @@ import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; import com.google.devtools.build.lib.analysis.config.HostTransition; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType; import com.google.devtools.build.lib.util.FileTypeSet; @@ -30,7 +29,7 @@ public class AndroidInstrumentationTestRule implements RuleDefinition { @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) { return builder /* The android_binary target containing the test classes. diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java index fa6074ea33f36e..9d06625b0e54d0 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidLocalTestBaseRule.java @@ -25,7 +25,6 @@ import com.google.devtools.build.lib.analysis.RuleDefinitionEnvironment; import com.google.devtools.build.lib.analysis.config.HostTransition; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType; import com.google.devtools.build.lib.rules.config.ConfigFeatureFlagProvider; import com.google.devtools.build.lib.rules.java.JavaConfiguration; @@ -35,7 +34,7 @@ public class AndroidLocalTestBaseRule implements RuleDefinition { @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) { return builder .requiresConfigurationFragments( JavaConfiguration.class, AndroidLocalTestConfiguration.class) diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java index 0b664d1385c944..93a20a2b551735 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidResourcesProcessorBuilder.java @@ -20,7 +20,6 @@ import com.google.devtools.build.lib.actions.ParameterFile.ParameterFileType; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; -import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.Builder; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode; @@ -504,7 +503,7 @@ private void configureCommonFlags( StampedAndroidManifest primaryManifest, List outs, NestedSetBuilder inputs, - Builder builder) { + CustomCommandLine.Builder builder) { // Add data builder.add( diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java index b40413e1167ffb..2035a7908f1fbf 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidRuleClasses.java @@ -45,7 +45,6 @@ import com.google.devtools.build.lib.packages.AttributeMap; import com.google.devtools.build.lib.packages.ImplicitOutputsFunction.SafeImplicitOutputsFunction; import com.google.devtools.build.lib.packages.RuleClass; -import com.google.devtools.build.lib.packages.RuleClass.Builder; import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType; import com.google.devtools.build.lib.packages.SkylarkProviderIdentifier; import com.google.devtools.build.lib.packages.TriState; @@ -367,7 +366,7 @@ public Iterable getImplicitOutputs( /** Definition of the {@code android_sdk} rule. */ public static final class AndroidSdkRule implements RuleDefinition { @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) { return builder .requiresConfigurationFragments(JavaConfiguration.class, AndroidConfiguration.class) .setUndocumented() @@ -1071,7 +1070,7 @@ public AndroidToolsDefaultsJarRule(Label... compatibleWithAndroidEnvironments) { } @Override - public RuleClass build(Builder builder, RuleDefinitionEnvironment environment) { + public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment environment) { builder .setUndocumented() .add( diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java index bf09dc916505ff..6b8514b0a2ad21 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java @@ -41,7 +41,6 @@ import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.analysis.WrappingProvider; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; -import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.Builder; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine.VectorArg; import com.google.devtools.build.lib.analysis.actions.SpawnAction; import com.google.devtools.build.lib.analysis.config.HostTransition; @@ -437,7 +436,7 @@ static Artifact createDexArchiveAction( Set incrementalDexopts, Artifact dexArchive) { CustomCommandLine args = - new Builder() + new CustomCommandLine.Builder() .addExecPath("--input_jar", jar) .addExecPath("--output_zip", dexArchive) .addAll(ImmutableList.copyOf(incrementalDexopts)) diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java index 41d27443a2ecf2..860b1294870d8a 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/ManifestMergerActionBuilder.java @@ -30,7 +30,6 @@ import com.google.devtools.build.lib.util.OS; import java.util.Iterator; import java.util.Map; -import java.util.Map.Entry; /** Builder for creating manifest merger actions. */ public class ManifestMergerActionBuilder { @@ -175,9 +174,9 @@ private String mapToDictionaryString( } StringBuilder sb = new StringBuilder(); - Iterator> iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); while (iter.hasNext()) { - Entry entry = iter.next(); + Map.Entry entry = iter.next(); sb.append(Functions.compose(ESCAPER, keyConverter).apply(entry.getKey())); sb.append(':'); sb.append(Functions.compose(ESCAPER, valueConverter).apply(entry.getValue())); diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java b/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java index 9cf70c409fdec4..8cc58853c23d7a 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidCompiledDataDeserializer.java @@ -30,10 +30,8 @@ import com.android.aapt.ConfigurationOuterClass.Configuration.UiModeType; import com.android.aapt.Resources; import com.android.aapt.Resources.ConfigValue; -import com.android.aapt.Resources.Entry; import com.android.aapt.Resources.Package; import com.android.aapt.Resources.ResourceTable; -import com.android.aapt.Resources.Type; import com.android.aapt.Resources.Value; import com.android.aapt.Resources.Visibility.Level; import com.android.ide.common.resources.configuration.CountryCodeQualifier; @@ -269,7 +267,7 @@ private void readPackages(KeyValueConsumers consumers, ResourceTable resourceTab resolver.resolveFor(resourceTablePackage.getPackageName()); String packageName = resourceTablePackage.getPackageName(); - for (Type resourceFormatType : resourceTablePackage.getTypeList()) { + for (Resources.Type resourceFormatType : resourceTablePackage.getTypeList()) { ResourceType resourceType = ResourceType.getEnum(resourceFormatType.getName()); for (Resources.Entry resource : resourceFormatType.getEntryList()) { @@ -390,7 +388,7 @@ private FullyQualifiedName createAndRecordFqn( ReferenceResolver packageResolver, String packageName, ResourceType resourceType, - Entry resource, + Resources.Entry resource, List qualifiers) { final FullyQualifiedName fqn = FullyQualifiedName.of( diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidDataMerger.java b/src/tools/android/java/com/google/devtools/build/android/AndroidDataMerger.java index 8874ff9ff1cc09..021f7877b98376 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidDataMerger.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidDataMerger.java @@ -26,7 +26,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; @@ -301,7 +300,7 @@ private UnwrittenMergedAndroidData doMerge( } // overwriting resources - for (Entry entry : parsedPrimary.iterateOverwritableEntries()) { + for (Map.Entry entry : parsedPrimary.iterateOverwritableEntries()) { if (direct.containsOverwritable(entry.getKey())) { primaryConsumers.overwritingConsumer.accept( entry.getKey(), entry.getValue().overwrite(direct.getOverwritable(entry.getKey()))); @@ -338,7 +337,7 @@ private UnwrittenMergedAndroidData doMerge( } // combining resources - for (Entry entry : parsedPrimary.iterateCombiningEntries()) { + for (Map.Entry entry : parsedPrimary.iterateCombiningEntries()) { primaryConsumers.combiningConsumer.accept(entry.getKey(), entry.getValue()); } for (Map.Entry entry : direct.iterateCombiningEntries()) { @@ -359,7 +358,7 @@ private UnwrittenMergedAndroidData doMerge( } // assets - for (Entry entry : parsedPrimary.iterateAssetEntries()) { + for (Map.Entry entry : parsedPrimary.iterateAssetEntries()) { if (direct.containsAsset(entry.getKey())) { primaryConsumers.assetConsumer.accept( entry.getKey(), entry.getValue().overwrite(direct.getAsset(entry.getKey()))); 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 2304f3cb671f50..a1910cb8cb585d 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 @@ -24,7 +24,6 @@ import java.nio.file.Path; import java.nio.file.StandardOpenOption; import java.util.Map; -import java.util.Map.Entry; import java.util.NavigableMap; import java.util.Set; import java.util.TreeMap; @@ -89,7 +88,7 @@ private void writeKeyValuesTo( DataSourceTable sourceTable, byte[] sourceTableBytes) throws IOException { - Set> entries = map.entrySet(); + Set> entries = map.entrySet(); int[] orderedValueSizes = new int[entries.size()]; int valueSizeIndex = 0; // Serialize all the values in sorted order to a intermediate buffer, so that the keys diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidDataWriter.java b/src/tools/android/java/com/google/devtools/build/android/AndroidDataWriter.java index 38d38f3aa0783a..ce0bf71d3ffabf 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidDataWriter.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidDataWriter.java @@ -50,7 +50,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; @@ -271,7 +270,7 @@ private void copy(final Path sourcePath, final Path destinationPath) { /** Finalizes all operations and flushes the buffers. */ @Override public void flush() throws IOException { - for (Entry entry : valueTags.entrySet()) { + for (Map.Entry entry : valueTags.entrySet()) { writeTasks.add( executorService.submit( entry.getValue().createWritingTask(resourceDirectory().resolve(entry.getKey())))); @@ -345,14 +344,14 @@ public Boolean call() throws Exception { StandardOpenOption.WRITE)) { writer.write(PRELUDE); writer.write(START_RESOURCES_TAG); - for (Entry prefixToUri : namespaces) { + for (Map.Entry prefixToUri : namespaces) { writer.write(" xmlns:"); writer.write(prefixToUri.getKey()); writer.write("=\""); writer.write(prefixToUri.getValue()); writer.write("\""); } - for (Entry attribute : attributes.entrySet()) { + for (Map.Entry attribute : attributes.entrySet()) { writer.write(" "); writer.write(attribute.getKey()); writer.write("=\""); @@ -537,9 +536,9 @@ public StartTag named(String name) { } @Override - public StartTag addAttributesFrom(Iterable> entries) { + public StartTag addAttributesFrom(Iterable> entries) { StartTag tag = this; - for (Entry entry : entries) { + for (Map.Entry entry : entries) { tag = tag.attribute(entry.getKey()).setTo(entry.getValue()); } return tag; diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidDataWritingVisitor.java b/src/tools/android/java/com/google/devtools/build/android/AndroidDataWritingVisitor.java index 1ada80c1c1008c..2019aa6a133192 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidDataWritingVisitor.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidDataWritingVisitor.java @@ -20,6 +20,7 @@ import java.io.Flushable; import java.io.IOException; import java.nio.file.Path; +import java.util.Map; import java.util.Map.Entry; import javax.annotation.CheckReturnValue; import javax.xml.namespace.QName; @@ -138,7 +139,7 @@ interface StartTag { /** Adds "name" attribute to the {@link StartTag}. */ StartTag named(String key); /** Adds all the {@link Entry} as key="value" to the {@link StartTag}. */ - StartTag addAttributesFrom(Iterable> entries); + StartTag addAttributesFrom(Iterable> entries); /** Starts an attribute of prefix:name. */ Attribute attribute(String prefix, String name); /** Starts an attribute of name. */ diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidManifestProcessor.java b/src/tools/android/java/com/google/devtools/build/android/AndroidManifestProcessor.java index c65bc98880ddcc..70cbf74482a490 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidManifestProcessor.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidManifestProcessor.java @@ -43,7 +43,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLEventReader; @@ -145,7 +144,7 @@ public Path mergeManifest( // Add mergee manifests List> libraryManifests = new ArrayList<>(); - for (Entry mergeeManifest : mergeeManifests.entrySet()) { + for (Map.Entry mergeeManifest : mergeeManifests.entrySet()) { libraryManifests.add(Pair.of(mergeeManifest.getValue(), mergeeManifest.getKey().toFile())); } manifestMerger.addLibraryManifests(libraryManifests); diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidParsedDataDeserializer.java b/src/tools/android/java/com/google/devtools/build/android/AndroidParsedDataDeserializer.java index e704c0655224ca..317c4be3e1501f 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidParsedDataDeserializer.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidParsedDataDeserializer.java @@ -20,7 +20,6 @@ import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import com.google.devtools.build.android.AndroidResourceMerger.MergingException; -import com.google.devtools.build.android.ParsedAndroidData.Builder; import com.google.devtools.build.android.ParsedAndroidData.KeyValueConsumer; import com.google.devtools.build.android.proto.SerializeFormat; import com.google.devtools.build.android.proto.SerializeFormat.Header; @@ -35,7 +34,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.concurrent.Callable; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -48,11 +46,13 @@ static final class Deserialize implements Callable { private final Path symbolPath; - private final Builder finalDataBuilder; + private final ParsedAndroidData.Builder finalDataBuilder; private final AndroidParsedDataDeserializer deserializer; private Deserialize( - AndroidParsedDataDeserializer deserializer, Path symbolPath, Builder finalDataBuilder) { + AndroidParsedDataDeserializer deserializer, + Path symbolPath, + ParsedAndroidData.Builder finalDataBuilder) { this.deserializer = deserializer; this.symbolPath = symbolPath; this.finalDataBuilder = finalDataBuilder; @@ -60,7 +60,7 @@ private Deserialize( @Override public Boolean call() throws Exception { - final Builder parsedDataBuilder = ParsedAndroidData.Builder.newBuilder(); + final ParsedAndroidData.Builder parsedDataBuilder = ParsedAndroidData.Builder.newBuilder(); deserializer.read(symbolPath, parsedDataBuilder.consumers()); // The builder isn't threadsafe, so synchronize the copyTo call. synchronized (finalDataBuilder) { @@ -145,7 +145,7 @@ private void readEntriesSegment( DataSourceTable sourceTable = DataSourceTable.read(in, currentFileSystem, header); // TODO(corysmith): Make this a lazy read of the values. - for (Entry> entry : keys.entrySet()) { + for (Map.Entry> entry : keys.entrySet()) { SerializeFormat.DataValue protoValue = SerializeFormat.DataValue.parseDelimitedFrom(in); DataSource source = sourceTable.sourceFromId(protoValue.getSourceId()); // Compose the `shortPath` manually to ensure it uses a forward slash. @@ -178,13 +178,17 @@ private void readEntriesSegment( } } - /** Deserializes a list of serialized resource paths to a {@link ParsedAndroidData}. */ + /** + * Deserializes a list of serialized resource paths to a {@link + * com.google.devtools.build.android.ParsedAndroidData}. + */ public static ParsedAndroidData deserializeSymbolsToData(List symbolPaths) throws IOException { AndroidParsedDataDeserializer deserializer = create(); final ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(15)); - final Builder deserializedDataBuilder = ParsedAndroidData.Builder.newBuilder(); + final ParsedAndroidData.Builder deserializedDataBuilder = + ParsedAndroidData.Builder.newBuilder(); try (Closeable closeable = ExecutorServiceCloser.createWith(executorService)) { List> deserializing = new ArrayList<>(); for (final Path symbolPath : symbolPaths) { diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessor.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessor.java index ddbfa18a6ccda3..02b9a5e310c710 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessor.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessor.java @@ -61,7 +61,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.logging.Logger; @@ -557,7 +556,7 @@ public ResourceSymbols loadResourceSymbolTable( ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(numThreads)); try (Closeable closeable = ExecutorServiceCloser.createWith(executorService)) { - for (Entry> entry : + for (Map.Entry> entry : ResourceSymbols.loadFrom(libraries, executorService, appPackageName).entries()) { libMap.put(entry.getKey(), entry.getValue().get()); } diff --git a/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java b/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java index b859904daab1b3..1df76b3f27f157 100644 --- a/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java +++ b/src/tools/android/java/com/google/devtools/build/android/GenerateRobolectricResourceSymbolsAction.java @@ -39,7 +39,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.concurrent.Callable; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -53,11 +52,12 @@ public class GenerateRobolectricResourceSymbolsAction { Logger.getLogger(GenerateRobolectricResourceSymbolsAction.class.getName()); private static final class WriteLibraryRClass implements Callable { - private final Entry>> librarySymbolEntry; + private final Map.Entry>> + librarySymbolEntry; private final RClassGenerator generator; private WriteLibraryRClass( - Entry>> librarySymbolEntry, + Map.Entry>> librarySymbolEntry, RClassGenerator generator) { this.librarySymbolEntry = librarySymbolEntry; this.generator = generator; @@ -185,8 +185,9 @@ public void acceptStyleableResource( libraries.add(library); } List> writeSymbolsTask = new ArrayList<>(); - for (final Entry>> librarySymbolEntry : - ResourceSymbols.loadFrom(libraries, executorService, null).asMap().entrySet()) { + for (final Map.Entry>> + librarySymbolEntry : + ResourceSymbols.loadFrom(libraries, executorService, null).asMap().entrySet()) { writeSymbolsTask.add( executorService.submit(new WriteLibraryRClass(librarySymbolEntry, generator))); } diff --git a/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java b/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java index a0fb3e36da973e..18040ea6a6710f 100644 --- a/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java +++ b/src/tools/android/java/com/google/devtools/build/android/ManifestMergerAction.java @@ -35,7 +35,6 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.util.Map; -import java.util.Map.Entry; import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -200,7 +199,7 @@ public static void main(String[] args) throws Exception { Path tmp = Files.createTempDirectory("manifest_merge_tmp"); tmp.toFile().deleteOnExit(); ImmutableMap.Builder mergeeManifests = ImmutableMap.builder(); - for (Entry mergeeManifest : options.mergeeManifests.entrySet()) { + for (Map.Entry mergeeManifest : options.mergeeManifests.entrySet()) { mergeeManifests.put( removePermissions(mergeeManifest.getKey(), tmp), mergeeManifest.getValue()); } diff --git a/src/tools/android/java/com/google/devtools/build/android/ParsedAndroidData.java b/src/tools/android/java/com/google/devtools/build/android/ParsedAndroidData.java index fcc674d7f6d1df..83020c433ed05c 100644 --- a/src/tools/android/java/com/google/devtools/build/android/ParsedAndroidData.java +++ b/src/tools/android/java/com/google/devtools/build/android/ParsedAndroidData.java @@ -41,7 +41,6 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Objects; import java.util.Set; import java.util.concurrent.Callable; @@ -112,13 +111,13 @@ ParsedAndroidData build() throws MergingException { /** Copies the data to the targetBuilder from the current builder. */ public void copyTo(Builder targetBuilder) { KeyValueConsumers consumers = targetBuilder.consumers(); - for (Entry entry : overwritingResources.entrySet()) { + for (Map.Entry entry : overwritingResources.entrySet()) { consumers.overwritingConsumer.accept(entry.getKey(), entry.getValue()); } - for (Entry entry : combiningResources.entrySet()) { + for (Map.Entry entry : combiningResources.entrySet()) { consumers.combiningConsumer.accept(entry.getKey(), entry.getValue()); } - for (Entry entry : assets.entrySet()) { + for (Map.Entry entry : assets.entrySet()) { consumers.assetConsumer.accept(entry.getKey(), entry.getValue()); } targetBuilder.conflicts.addAll(conflicts); @@ -565,36 +564,36 @@ public DataResource getOverwritable(DataKey name) { } void writeResourcesTo(AndroidResourceSymbolSink writer) { - for (Entry resource : iterateDataResourceEntries()) { + for (Map.Entry resource : iterateDataResourceEntries()) { resource.getValue().writeResourceToClass((FullyQualifiedName) resource.getKey(), writer); } } void writeResourcesTo(AndroidDataWriter writer) throws MergingException { - for (Entry resource : iterateDataResourceEntries()) { + for (Map.Entry resource : iterateDataResourceEntries()) { resource.getValue().writeResource((FullyQualifiedName) resource.getKey(), writer); } } void serializeResourcesTo(AndroidDataSerializer serializer) { - for (Entry resource : iterateDataResourceEntries()) { + for (Map.Entry resource : iterateDataResourceEntries()) { serializer.queueForSerialization(resource.getKey(), resource.getValue()); } } void writeAssetsTo(AndroidDataWriter writer) throws IOException { - for (Entry resource : iterateAssetEntries()) { + for (Map.Entry resource : iterateAssetEntries()) { resource.getValue().writeAsset((RelativeAssetPath) resource.getKey(), writer); } } void serializeAssetsTo(AndroidDataSerializer serializer) { - for (Entry resource : iterateAssetEntries()) { + for (Map.Entry resource : iterateAssetEntries()) { serializer.queueForSerialization(resource.getKey(), resource.getValue()); } } - Iterable> iterateOverwritableEntries() { + Iterable> iterateOverwritableEntries() { return overwritingResources.entrySet(); } @@ -635,7 +634,7 @@ private static void overwrite( ParsedAndroidData combine(ParsedAndroidData other) { Map combinedResources = new LinkedHashMap<>(); CombiningConsumer consumer = new CombiningConsumer(combinedResources); - for (Entry entry : + for (Map.Entry entry : Iterables.concat(combiningResources.entrySet(), other.combiningResources.entrySet())) { consumer.accept(entry.getKey(), entry.getValue()); } @@ -665,11 +664,11 @@ ParsedAndroidData union(ParsedAndroidData other) { ImmutableMap.copyOf(Iterables.concat(assets.entrySet(), other.assets.entrySet()))); } - private Iterable> iterateDataResourceEntries() { + private Iterable> iterateDataResourceEntries() { return Iterables.concat(overwritingResources.entrySet(), combiningResources.entrySet()); } - public Iterable> iterateCombiningEntries() { + public Iterable> iterateCombiningEntries() { return combiningResources.entrySet(); } @@ -677,7 +676,7 @@ boolean containsAsset(DataKey name) { return assets.containsKey(name); } - Iterable> iterateAssetEntries() { + Iterable> iterateAssetEntries() { return assets.entrySet(); } diff --git a/src/tools/android/java/com/google/devtools/build/android/UnwrittenMergedAndroidData.java b/src/tools/android/java/com/google/devtools/build/android/UnwrittenMergedAndroidData.java index 7b0c04edf9021c..1ba0d4c0ec2af4 100644 --- a/src/tools/android/java/com/google/devtools/build/android/UnwrittenMergedAndroidData.java +++ b/src/tools/android/java/com/google/devtools/build/android/UnwrittenMergedAndroidData.java @@ -22,7 +22,7 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import java.util.Map.Entry; +import java.util.Map; import java.util.Objects; import java.util.Set; @@ -137,7 +137,7 @@ ParsedAndroidData getTransitive() { } public void serializeTo(AndroidDataSerializer serializer) { - for (Entry entry : primary.iterateAssetEntries()) { + for (Map.Entry entry : primary.iterateAssetEntries()) { serializer.queueForSerialization(entry.getKey(), entry.getValue()); } primary.serializeAssetsTo(serializer);