From e2385124b26690c30b152aace860dade774844ea Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 31 Oct 2023 07:35:46 -0700 Subject: [PATCH] Mark native java providers that are also `StarlarkValue`s immutable Fixes https://github.com/bazelbuild/bazel/issues/19999 PiperOrigin-RevId: 578178718 Change-Id: I2713a4f28d3ed248e7e0e4d67bc3c489f937a8e5 --- .../devtools/build/lib/rules/java/JavaGenJarsProvider.java | 5 +++++ .../build/lib/rules/java/JavaModuleFlagsProvider.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaGenJarsProvider.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaGenJarsProvider.java index 8db0107fac32c1..53b2e5041a8824 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaGenJarsProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaGenJarsProvider.java @@ -130,6 +130,11 @@ && getTransitiveGenClassJars().isEmpty() @AutoValue abstract class NativeJavaGenJarsProvider implements JavaGenJarsProvider { + @Override + public boolean isImmutable() { + return true; + } + @Override public abstract boolean usesAnnotationProcessing(); diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaModuleFlagsProvider.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaModuleFlagsProvider.java index c7f31334e5b8f4..eebf49f345fed2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaModuleFlagsProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaModuleFlagsProvider.java @@ -45,6 +45,11 @@ abstract class JavaModuleFlagsProvider implements JavaInfoInternalProvider, JavaModuleFlagsProviderApi { + @Override + public boolean isImmutable() { + return true; + } + public abstract NestedSet addExports(); public abstract NestedSet addOpens();