-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New Error Prone 'IgnoredPureGetter' diagnostic #16996
Copy link
Copy link
Closed
Labels
Description
After 248ff0d, using Bazel and java_tools at head to build Bazel fails:
ERROR: external/com_google_protobuf/java/core/BUILD:112:13: Building external/com_google_protobuf/java/core/liblite_runtime_only.jar (89 source files) [for tool] failed: (Exit 1): java failed: error executing command (from target @com_google_protobuf//java/core:lite_runtime_only) external/remotejdk17_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 17 arguments skipped)
external/com_google_protobuf/java/core/src/main/java/com/google/protobuf/ArrayDecoders.java:785: error: [IgnoredPureGetter] Getters on AutoValues, AutoBuilders, and Protobuf Messages are side-effect free, so there is no point in calling them if the return value is ignored. While there are no side effects from the getter, the receiver may have side effects.
((GeneratedMessageLite.ExtendableMessage<?, ?>) message).ensureExtensionsAreMutable();
^
(see https://errorprone.info/bugpattern/IgnoredPureGetter)
Did you mean to remove this line?
This diagnostic should probably not be an error.
Reactions are currently unavailable