From 22b0d778accff922620c6c8c1b6dd6392d16533b Mon Sep 17 00:00:00 2001 From: Eduard Minasyan Date: Fri, 30 Aug 2024 15:06:35 +0400 Subject: [PATCH] Introduce 'MustUseReturnValueAttribute.IsFluentBuilderMethod' property --- src/Annotations.cs | 12 ++++++++++++ src/JetBrains.Annotations.csproj | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Annotations.cs b/src/Annotations.cs index 5828fc8..cd2346b 100644 --- a/src/Annotations.cs +++ b/src/Annotations.cs @@ -685,6 +685,18 @@ public MustUseReturnValueAttribute([NotNull] string justification) } [CanBeNull] public string Justification { get; } + + /// + /// Enables the special handling of the "fluent" APIs that perform mutations and return 'this' object. + /// In this case the analysis checks the fluent invocations chain and only warns if the initial receiver value + /// is probably a temporary value - in this case the very last fluent method return assumed to be temporary as well, + /// therefore is a subject of warning if unused. If the initial receiver is a local variable or 'this' reference + /// the analysis assumes that fluent invocations were used to mutate the existing value and warning will not be shown. + /// + /// + /// This property must only be used for methods with the return type matching the receiver type. + /// + public bool IsFluentBuilderMethod { get; set; } } /// diff --git a/src/JetBrains.Annotations.csproj b/src/JetBrains.Annotations.csproj index 126ed4b..769120d 100644 --- a/src/JetBrains.Annotations.csproj +++ b/src/JetBrains.Annotations.csproj @@ -5,8 +5,8 @@ Use 'eap' for EAP builds of annotations MAJOR and MINOR version numbers should match latest ReSharper version (to avoid confusion), PATCH version may vary during development and EAPs --> - 2024.2.0 - + 2024.3.0 + eap1 $(VersionPrefix)-$(VersionSuffix)