Skip to content

Commit

Permalink
2023.3.0-eap1
Browse files Browse the repository at this point in the history
  • Loading branch information
controlflow committed Aug 3, 2023
1 parent 453ef10 commit 8437ec3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
32 changes: 18 additions & 14 deletions src/Annotations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,16 +647,20 @@ public MustUseReturnValueAttribute([NotNull] string justification)
}

/// <summary>
/// Indicates that the resulting resource of the constructor or method invocation must be disposed after use.
/// Indicates that the resource disposal must be handled by the use site,
/// meaning that the resource ownership is transferred to the callee.
/// This annotation can be used to annotate disposable types or their constructors individually to enable
/// the resource disposal IDE code analysis in every context where the new instance of this type is created.
/// Factory methods and 'out' parameters can also be annotated to indicate that the return value of disposable type
/// needs handling.
/// </summary>
/// <remarks>
/// Annotating input parameters with this attribute is meaningless. <br/>
/// Constructors inherit this attribute from their class, if it is decorated. <br/>
/// Because of attribute inheritance, you should explicitly decorate constructors which are
/// calling base constructor that is already decorated with this attribute. <br/>
/// Disposing is expected to be performed via either <c>using (resource)</c> statement, <c>using var</c> declaration,
/// or call to a method with kind of <see cref="HandlesResourceDisposalAttribute"/> decoration,
/// usually <c>IDisposable.Dispose()</c> implementation.
/// Annotation of input parameters with this attribute is meaningless.<br/>
/// Constructors inherit this attribute from their type, if it is annotated,
/// but not from the base constructors they delegate to (if any).<br/>
/// Resource disposal is expected to be expressed via either <c>using (resource)</c> statement,
/// <c>using var</c> declaration, explicit 'Dispose' method call, or an argument passing
/// to a parameter with the <see cref="HandlesResourceDisposalAttribute"/> attribute applied.
/// </remarks>
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Parameter)]
Expand All @@ -668,14 +672,13 @@ public MustDisposeResourceAttribute()
Value = true;
}

/// <param name="value"><inheritdoc cref="Value" path="/summary"/></param>
public MustDisposeResourceAttribute(bool value)
{
Value = value;
}

/// <summary>
/// When set to <c>false</c>, disposing of the resource is not obligatory and will be performed during garbage collection.
/// When set to <c>false</c>, disposing of the resource is not obligatory.
/// The main use-case for explicit <c>[MustDisposeResource(false)]</c> annotation is to loosen inherited annotation.
/// </summary>
public bool Value { get; }
Expand All @@ -685,10 +688,11 @@ public MustDisposeResourceAttribute(bool value)
/// Indicates that method or class instance acquires resource ownership and will dispose it after use.
/// </summary>
/// <remarks>
/// Decorating an out parameter with this attribute is meaningless. <br/>
/// When a method itself is decorated with this attribute, its call disposes instance resource. <br/>
/// When a field or a property is decorated with this attribute, it shows that this class owns the resource in it
/// and will dispose it properly (e.g. in own Dispose method).
/// Annotation of 'out' parameter with this attribute is meaningless.<br/>
/// When a instance method is annotated with this attribute,
/// it means that it is handling the resource disposal of the corresponding resource instance.<br/>
/// When a field or a property is annotated with this attribute, it means that this type owns the resource
/// and will handle the resource disposal properly (e.g. in own IDisposable implementation).
/// </remarks>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
Expand Down
4 changes: 2 additions & 2 deletions src/JetBrains.Annotations.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Use 'eap' <VersionSuffix> 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 -->
<VersionPrefix>2023.2.0</VersionPrefix>
<!-- <VersionSuffix>eap4</VersionSuffix>-->
<VersionPrefix>2023.3.0</VersionPrefix>
<VersionSuffix>eap1</VersionSuffix>

<!-- versioning -->
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
Expand Down
3 changes: 1 addition & 2 deletions src/JetBrains.Annotations.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ JetBrains.Annotations help reduce false positive warnings, explicitly declare pu
All usages of JetBrains.Annotations attributes are erased from metadata by default, which means no actual binary reference to 'JetBrains.Annotations.dll' assembly is produced. If you need to preserve these attributes in metadata, just define 'JETBRAINS_ANNOTATIONS' conditional compilation symbol in your projects.
</description>
<releaseNotes>
&#8226; Added AspMvcViewComponentViewLocationFormatAttribute and AspMvcAreaViewComponentViewLocationFormatAttribute for ASP.NET Core ViewComponent views support
&#8226; Added TestSubjectAttribute and MeansTestSubjectAttribute for Unit Testing IDE features
&#8226; Added MustDisposeResourceAttribute and HandlesResourceDisposalAttribute attributes for resource disposal analysis.
</releaseNotes>
<tags>jetbrains resharper rider annotations canbenull notnull</tags>
<dependencies>
Expand Down

0 comments on commit 8437ec3

Please sign in to comment.