From 9b12936ca96aa7f3e169add0a2620fa16069be94 Mon Sep 17 00:00:00 2001 From: Luca Di Grazia Date: Sun, 4 Sep 2022 20:09:41 +0200 Subject: [PATCH] Replace stream usage to reduce garbage creation on hot codepaths. RELNOTES: None. PiperOrigin-RevId: 240765715 --- .../com/google/devtools/build/lib/rules/java/JavaCommon.java | 2 +- .../build/lib/rules/java/JavaPackageConfigurationProvider.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java index e163582ea8b..37a580e3d26 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java @@ -422,7 +422,7 @@ public final void initializeJavacOpts() { /** Computes javacopts for the current rule. */ private ImmutableList computeJavacOpts(Collection extraRuleJavacOpts) { return ImmutableList.builder() - .addAll(javaToolchain.getJavacOptions(ruleContext)) + .addAll(javaToolchain.getJavacOptions()) .addAll(extraRuleJavacOpts) .addAll(computePerPackageJavacOpts(ruleContext, javaToolchain)) .addAll(ruleContext.getExpander().withDataLocations().tokenized("javacopts")) diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationProvider.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationProvider.java index 4115add30c8..1c81e6d83a3 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationProvider.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaPackageConfigurationProvider.java @@ -55,7 +55,7 @@ public static JavaPackageConfigurationProvider create( public boolean matches(Label label) { // Do not use streams here as they create excessive garbage. for (PackageSpecificationProvider provider : packageSpecifications()) { - for (PackageGroupContents specifications : provider.getPackageSpecifications().toList()) { + for (PackageGroupContents specifications : provider.getPackageSpecifications()) { if (specifications.containsPackage(label.getPackageIdentifier())) { return true; }