Skip to content

Commit

Permalink
Remove Jetbrains nullability attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Mar 17, 2021
1 parent 49b8bb9 commit 809fe7a
Show file tree
Hide file tree
Showing 1,581 changed files with 12,049 additions and 13,488 deletions.
3 changes: 1 addition & 2 deletions src/EFCore.Abstractions/BackingFieldAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore
Expand All @@ -17,7 +16,7 @@ public sealed class BackingFieldAttribute : Attribute
/// Initializes a new instance of the <see cref="BackingFieldAttribute" /> class.
/// </summary>
/// <param name="name"> The name of the backing field. </param>
public BackingFieldAttribute([NotNull] string name)
public BackingFieldAttribute(string name)
{
Check.NotEmpty(name, nameof(name));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.ChangeTracking.Internal
Expand All @@ -31,7 +30,7 @@ public class ObservableBackedBindingList<T> : SortableBindingList<T>
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public ObservableBackedBindingList([NotNull] ICollection<T> observableCollection)
public ObservableBackedBindingList(ICollection<T> observableCollection)
: base(observableCollection.ToList())
{
_observableCollection = observableCollection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SortableBindingList<T> : BindingList<T>
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public SortableBindingList([NotNull] List<T> list)
public SortableBindingList(List<T> list)
: base(list)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ObservableCollectionListSource()
/// contains elements copied from the specified collection.
/// </summary>
/// <param name="collection"> The collection from which the elements are copied. </param>
public ObservableCollectionListSource([NotNull] IEnumerable<T> collection)
public ObservableCollectionListSource(IEnumerable<T> collection)
: base(collection)
{
}
Expand All @@ -50,7 +50,7 @@ public ObservableCollectionListSource([NotNull] IEnumerable<T> collection)
/// contains elements copied from the specified list.
/// </summary>
/// <param name="list"> The list from which the elements are copied. </param>
public ObservableCollectionListSource([NotNull] List<T> list)
public ObservableCollectionListSource(List<T> list)
: base(list)
{
}
Expand Down
3 changes: 1 addition & 2 deletions src/EFCore.Abstractions/CommentAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore
Expand All @@ -17,7 +16,7 @@ public sealed class CommentAttribute : Attribute
/// Initializes a new instance of the <see cref="CommentAttribute" /> class.
/// </summary>
/// <param name="comment"> The comment. </param>
public CommentAttribute([NotNull] string comment)
public CommentAttribute(string comment)
{
Check.NotEmpty(comment, nameof(comment));

Expand Down
6 changes: 2 additions & 4 deletions src/EFCore.Abstractions/DbFunctionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;
using CA = System.Diagnostics.CodeAnalysis;

Expand Down Expand Up @@ -35,7 +34,7 @@ public DbFunctionAttribute()
/// </summary>
/// <param name="name">The name of the function in the database.</param>
/// <param name="schema">The schema of the function in the database.</param>
public DbFunctionAttribute([NotNull] string name, [CanBeNull] string? schema = null)
public DbFunctionAttribute(string name, string? schema = null)
{
Check.NotEmpty(name, nameof(name));

Expand All @@ -50,7 +49,6 @@ public DbFunctionAttribute([NotNull] string name, [CanBeNull] string? schema = n
public virtual string? Name
{
get => _name;
[param: NotNull]
set
{
Check.NotEmpty(value, nameof(value));
Expand All @@ -65,7 +63,7 @@ public virtual string? Name
public virtual string? Schema
{
get => _schema;
[param: CanBeNull] set => _schema = value;
set => _schema = value;
}

/// <summary>
Expand Down
9 changes: 4 additions & 5 deletions src/EFCore.Abstractions/IndexAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Utilities;
using CA = System.Diagnostics.CodeAnalysis;

namespace Microsoft.EntityFrameworkCore
{
Expand All @@ -23,7 +22,7 @@ public sealed class IndexAttribute : Attribute
/// Initializes a new instance of the <see cref="IndexAttribute" /> class.
/// </summary>
/// <param name="propertyNames"> The properties which constitute the index, in order (there must be at least one). </param>
public IndexAttribute([NotNull] params string[] propertyNames)
public IndexAttribute(params string[] propertyNames)
{
Check.NotEmpty(propertyNames, nameof(propertyNames));
Check.HasNoEmptyElements(propertyNames, nameof(propertyNames));
Expand All @@ -39,11 +38,11 @@ public IndexAttribute([NotNull] params string[] propertyNames)
/// <summary>
/// The name of the index.
/// </summary>
[CA.DisallowNull]
[DisallowNull]
public string? Name
{
get => _name;
[param: NotNull] set => _name = Check.NotNull(value, nameof(value));
set => _name = Check.NotNull(value, nameof(value));
}

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions src/EFCore.Abstractions/Infrastructure/ILazyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ public interface ILazyLoader : IDisposable
/// <param name="navigationName"> The navigation property name. </param>
/// <param name="loaded"> Determines whether the navigation is set as loaded or not. </param>
void SetLoaded(
[NotNull] object entity,
[NotNull] [CallerMemberName] string navigationName = "",
object entity,
[CallerMemberName] string navigationName = "",
bool loaded = true);

/// <summary>
/// Loads a navigation property if it has not already been loaded.
/// </summary>
/// <param name="entity"> The entity on which the navigation property is located. </param>
/// <param name="navigationName"> The navigation property name. </param>
void Load([NotNull] object entity, [NotNull] [CallerMemberName] string navigationName = "");
void Load(object entity, [CallerMemberName] string navigationName = "");

/// <summary>
/// Loads a navigation property if it has not already been loaded.
Expand All @@ -53,8 +53,8 @@ void SetLoaded(
#pragma warning disable CA1068 // CancellationToken parameters must come last
Task LoadAsync(
#pragma warning restore CA1068 // CancellationToken parameters must come last
[NotNull] object entity,
object entity,
CancellationToken cancellationToken = default,
[NotNull] [CallerMemberName] string navigationName = "");
[CallerMemberName] string navigationName = "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public static class LazyLoaderExtensions
/// The loaded navigation property value, or the navigation property value unchanged if the loader is <see langword="null" />.
/// </returns>
public static TRelated? Load<TRelated>(
[CanBeNull] this ILazyLoader? loader,
[NotNull] object entity,
[CanBeNull] ref TRelated? navigationField,
[NotNull] [CallerMemberName] string navigationName = "")
this ILazyLoader? loader,
object entity,
ref TRelated? navigationField,
[CallerMemberName] string navigationName = "")
where TRelated : class
{
loader?.Load(entity, navigationName);
Expand Down
3 changes: 1 addition & 2 deletions src/EFCore.Abstractions/ObservableCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Collections.ObjectModel;
using System.ComponentModel;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Utilities;

Expand All @@ -21,7 +20,7 @@ public static class ObservableCollectionExtensions
/// <typeparam name="T"> The element type. </typeparam>
/// <param name="source"> The collection that the binding list will stay in sync with. </param>
/// <returns> The binding list. </returns>
public static BindingList<T> ToBindingList<T>([NotNull] this ObservableCollection<T> source)
public static BindingList<T> ToBindingList<T>(this ObservableCollection<T> source)
where T : class
{
Check.NotNull(source, nameof(source));
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/EFCore.Cosmos/Diagnostics/CosmosQueryEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public class CosmosQueryEventData : EventData
/// <param name="querySql"> The SQL representing the query. </param>
/// <param name="logSensitiveData"> Indicates whether or not the application allows logging of sensitive data. </param>
public CosmosQueryEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] string containerId,
[CanBeNull] string? partitionKey,
[NotNull] IReadOnlyList<(string Name, object? Value)> parameters,
[NotNull] string querySql,
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
string containerId,
string? partitionKey,
IReadOnlyList<(string Name, object? Value)> parameters,
string querySql,
bool logSensitiveData)
: base(eventDefinition, messageGenerator)
{
Expand Down
10 changes: 5 additions & 5 deletions src/EFCore.Cosmos/Diagnostics/CosmosReadItemEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public class CosmosReadItemEventData : EventData
/// <param name="partitionKey"> The key of the Cosmos partition that the query is using. </param>
/// <param name="logSensitiveData"> Indicates whether or not the application allows logging of sensitive data. </param>
public CosmosReadItemEventData(
[NotNull] EventDefinitionBase eventDefinition,
[NotNull] Func<EventDefinitionBase, EventData, string> messageGenerator,
[NotNull] string resourceId,
[NotNull] string containerId,
[CanBeNull] string? partitionKey,
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
string resourceId,
string containerId,
string? partitionKey,
bool logSensitiveData)
: base(eventDefinition, messageGenerator)
{
Expand Down
17 changes: 8 additions & 9 deletions src/EFCore.Cosmos/Diagnostics/Internal/CosmosLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Globalization;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
using Microsoft.EntityFrameworkCore.Cosmos.Storage.Internal;
using Microsoft.EntityFrameworkCore.Diagnostics;
Expand All @@ -31,10 +30,10 @@ public static class CosmosLoggerExtensions
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static void ExecutingSqlQuery(
[NotNull] this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics,
[NotNull] string containerId,
[CanBeNull] string? partitionKey,
[NotNull] CosmosSqlQuery cosmosSqlQuery)
this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics,
string containerId,
string? partitionKey,
CosmosSqlQuery cosmosSqlQuery)
{
var definition = CosmosResources.LogExecutingSqlQuery(diagnostics);

Expand Down Expand Up @@ -85,10 +84,10 @@ private static string ExecutingSqlQuery(EventDefinitionBase definition, EventDat
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static void ExecutingReadItem(
[NotNull] this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics,
[NotNull] string containerId,
[CanBeNull] string? partitionKey,
[NotNull] string resourceId)
this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics,
string containerId,
string? partitionKey,
string resourceId)
{
var definition = CosmosResources.LogExecutingReadItem(diagnostics);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using JetBrains.Annotations;
using Microsoft.Azure.Cosmos;
using Microsoft.EntityFrameworkCore.Cosmos.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Cosmos.Internal;
Expand All @@ -25,7 +24,7 @@ public static class CosmosDatabaseFacadeExtensions
/// </summary>
/// <param name="databaseFacade"> The <see cref="DatabaseFacade" /> for the context. </param>
/// <returns> The <see cref="CosmosClient" /> </returns>
public static CosmosClient GetCosmosClient([NotNull] this DatabaseFacade databaseFacade)
public static CosmosClient GetCosmosClient(this DatabaseFacade databaseFacade)
=> GetService<ISingletonCosmosClientWrapper>(databaseFacade).Client;

private static TService GetService<TService>(IInfrastructure<IServiceProvider> databaseFacade)
Expand Down Expand Up @@ -54,7 +53,7 @@ private static TService GetService<TService>(IInfrastructure<IServiceProvider> d
/// </summary>
/// <param name="database"> The facade from <see cref="DbContext.Database" />. </param>
/// <returns> <see langword="true" /> if the Cosmos provider is being used. </returns>
public static bool IsCosmos([NotNull] this DatabaseFacade database)
public static bool IsCosmos(this DatabaseFacade database)
=> database.ProviderName == typeof(CosmosOptionsExtension).Assembly.GetName().Name;
}
}
Loading

0 comments on commit 809fe7a

Please sign in to comment.