Skip to content

Commit 0280a5e

Browse files
committed
target .net 8 and seal more classes
1 parent 2314ed6 commit 0280a5e

24 files changed

+42
-25
lines changed

src/AutoMapper/ApiCompatBaseline.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,25 @@ CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMappe
3939
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.UseExistingValueAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
4040
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.ValueConverterAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
4141
CannotChangeAttribute : Attribute 'System.AttributeUsageAttribute' on 'AutoMapper.Configuration.Annotations.ValueResolverAttribute' changed from '[AttributeUsageAttribute(384)]' in the contract to '[AttributeUsageAttribute(AttributeTargets.Field | AttributeTargets.Property)]' in the implementation.
42+
CannotSealType : Type 'AutoMapper.Internal.Mappers.AssignableMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
43+
CannotSealType : Type 'AutoMapper.Internal.Mappers.CollectionMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
44+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ConstructorMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
45+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ConversionOperatorMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
46+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ConvertMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
47+
CannotSealType : Type 'AutoMapper.Internal.Mappers.EnumToEnumMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
48+
CannotSealType : Type 'AutoMapper.Internal.Mappers.FromDynamicMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
49+
CannotSealType : Type 'AutoMapper.Internal.Mappers.FromStringDictionaryMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
50+
CannotSealType : Type 'AutoMapper.Internal.Mappers.KeyValueMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
4251
CannotSealType : Type 'AutoMapper.Internal.Mappers.MultidimensionalArrayFiller' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
4352
TypeCannotChangeClassification : Type 'AutoMapper.Internal.Mappers.MultidimensionalArrayFiller' is a 'struct' in the implementation but is a 'class' in the contract.
53+
CannotSealType : Type 'AutoMapper.Internal.Mappers.NullableDestinationMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
54+
CannotSealType : Type 'AutoMapper.Internal.Mappers.NullableSourceMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
55+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ParseStringMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
56+
CannotSealType : Type 'AutoMapper.Internal.Mappers.StringToEnumMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
57+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ToDynamicMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
58+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ToStringDictionaryMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
59+
CannotSealType : Type 'AutoMapper.Internal.Mappers.ToStringMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
60+
CannotSealType : Type 'AutoMapper.Internal.Mappers.UnderlyingTypeEnumMapper' is actually (has the sealed modifier) sealed in the implementation but not sealed in the contract.
4461
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableContextAttribute' exists on 'AutoMapper.QueryableExtensions.Extensions.ProjectTo(System.Linq.IQueryable, System.Type, AutoMapper.IConfigurationProvider)' in the contract but not the implementation.
4562
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableContextAttribute' exists on 'AutoMapper.QueryableExtensions.Extensions.ProjectTo(System.Linq.IQueryable, System.Type, AutoMapper.IConfigurationProvider, System.Collections.Generic.IDictionary<System.String, System.Object>, System.String[])' in the contract but not the implementation.
4663
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableAttribute' exists on parameter 'parameters' on member 'AutoMapper.QueryableExtensions.Extensions.ProjectTo(System.Linq.IQueryable, System.Type, AutoMapper.IConfigurationProvider, System.Collections.Generic.IDictionary<System.String, System.Object>, System.String[])' in the contract but not the implementation.
@@ -52,4 +69,4 @@ CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableAttri
5269
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableContextAttribute' exists on 'AutoMapper.QueryableExtensions.Extensions.ProjectTo<TDestination>(System.Linq.IQueryable, AutoMapper.IConfigurationProvider, System.Object, System.Linq.Expressions.Expression<System.Func<TDestination, System.Object>>[])' in the contract but not the implementation.
5370
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableAttribute' exists on parameter 'parameters' on member 'AutoMapper.QueryableExtensions.Extensions.ProjectTo<TDestination>(System.Linq.IQueryable, AutoMapper.IConfigurationProvider, System.Object, System.Linq.Expressions.Expression<System.Func<TDestination, System.Object>>[])' in the contract but not the implementation.
5471
CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.NullableAttribute' exists on generic param 'TDestination' on member 'AutoMapper.QueryableExtensions.Extensions.ProjectTo<TDestination>(System.Linq.IQueryable, AutoMapper.IConfigurationProvider, System.Object, System.Linq.Expressions.Expression<System.Func<TDestination, System.Object>>[])' in the contract but not the implementation.
55-
Total Issues: 53
72+
Total Issues: 70

src/AutoMapper/AutoMapper.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Summary>A convention-based object-object mapper.</Summary>
55
<Description>A convention-based object-object mapper.</Description>
6-
<TargetFrameworks>net6.0</TargetFrameworks>
6+
<TargetFrameworks>net8.0</TargetFrameworks>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<AssemblyName>AutoMapper</AssemblyName>
99
<AssemblyOriginatorKeyFile>..\..\AutoMapper.snk</AssemblyOriginatorKeyFile>
@@ -38,7 +38,7 @@
3838
</ItemGroup>
3939

4040
<ItemGroup>
41-
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
41+
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.0" />
4242
<PackageReference Include="MinVer" Version="4.3.0" PrivateAssets="All" />
4343
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4444
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.22074.1" PrivateAssets="All" />

src/AutoMapper/Mappers/AssignableMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.Internal.Mappers;
22

3-
public class AssignableMapper : IObjectMapper
3+
public sealed class AssignableMapper : IObjectMapper
44
{
55
public bool IsMatch(TypePair context) => context.DestinationType.IsAssignableFrom(context.SourceType);
66
public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap,

src/AutoMapper/Mappers/CollectionMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Collections.Specialized;
44
namespace AutoMapper.Internal.Mappers;
55
using static ReflectionHelper;
6-
public class CollectionMapper : IObjectMapper
6+
public sealed class CollectionMapper : IObjectMapper
77
{
88
static readonly MethodInfo IListAdd = typeof(IList).GetMethod(nameof(IList.Add));
99
public TypePair? GetAssociatedTypes(TypePair context) => new(GetElementType(context.SourceType), GetElementType(context.DestinationType));

src/AutoMapper/Mappers/ConstructorMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class ConstructorMapper : IObjectMapper
2+
public sealed class ConstructorMapper : IObjectMapper
33
{
44
public bool IsMatch(TypePair context) => GetConstructor(context.SourceType, context.DestinationType) != null;
55
private static ConstructorInfo GetConstructor(Type sourceType, Type destinationType) =>

src/AutoMapper/Mappers/ConversionOperatorMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class ConversionOperatorMapper : IObjectMapper
2+
public sealed class ConversionOperatorMapper : IObjectMapper
33
{
44
private readonly string _operatorName;
55
public ConversionOperatorMapper(string operatorName) => _operatorName = operatorName;

src/AutoMapper/Mappers/ConvertMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class ConvertMapper : IObjectMapper
2+
public sealed class ConvertMapper : IObjectMapper
33
{
44
public static bool IsPrimitive(Type type) => type.IsPrimitive || type == typeof(string) || type == typeof(decimal);
55
public bool IsMatch(TypePair types) => (types.SourceType == typeof(string) && types.DestinationType == typeof(DateTime)) ||

src/AutoMapper/Mappers/EnumToEnumMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class EnumToEnumMapper : IObjectMapper
2+
public sealed class EnumToEnumMapper : IObjectMapper
33
{
44
private static readonly MethodInfo TryParseMethod = typeof(Enum).StaticGenericMethod("TryParse", parametersCount: 3);
55
public bool IsMatch(TypePair context) => context.IsEnumToEnum();

src/AutoMapper/Mappers/FromDynamicMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Microsoft.CSharp.RuntimeBinder;
33
using Binder = Microsoft.CSharp.RuntimeBinder.Binder;
44
namespace AutoMapper.Internal.Mappers;
5-
public class FromDynamicMapper : IObjectMapper
5+
public sealed class FromDynamicMapper : IObjectMapper
66
{
77
private static readonly MethodInfo MapMethodInfo = typeof(FromDynamicMapper).GetStaticMethod(nameof(Map));
88
private static object Map(object source, object destination, Type destinationType, ResolutionContext context, ProfileMap profileMap)

src/AutoMapper/Mappers/FromStringDictionaryMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using StringDictionary = System.Collections.Generic.IDictionary<string, object>;
22
namespace AutoMapper.Internal.Mappers;
3-
public class FromStringDictionaryMapper : IObjectMapper
3+
public sealed class FromStringDictionaryMapper : IObjectMapper
44
{
55
private static readonly MethodInfo MapDynamicMethod = typeof(FromStringDictionaryMapper).GetStaticMethod(nameof(MapDynamic));
66
public bool IsMatch(TypePair context) => typeof(StringDictionary).IsAssignableFrom(context.SourceType);

src/AutoMapper/Mappers/KeyValueMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class KeyValueMapper : IObjectMapper
2+
public sealed class KeyValueMapper : IObjectMapper
33
{
44
public bool IsMatch(TypePair context) => IsKeyValue(context.SourceType) && IsKeyValue(context.DestinationType);
55
public static bool IsKeyValue(Type type) => type.IsGenericType(typeof(KeyValuePair<,>));

src/AutoMapper/Mappers/NullableDestinationMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.Internal.Mappers;
22

3-
public class NullableDestinationMapper : IObjectMapper
3+
public sealed class NullableDestinationMapper : IObjectMapper
44
{
55
public bool IsMatch(TypePair context) => context.DestinationType.IsNullableType();
66
public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) =>

src/AutoMapper/Mappers/NullableSourceMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.Internal.Mappers;
22

3-
public class NullableSourceMapper : IObjectMapper
3+
public sealed class NullableSourceMapper : IObjectMapper
44
{
55
public bool IsMatch(TypePair context) => context.SourceType.IsNullableType();
66
public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression) =>

src/AutoMapper/Mappers/ParseStringMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.Internal.Mappers;
22

3-
public class ParseStringMapper : IObjectMapper
3+
public sealed class ParseStringMapper : IObjectMapper
44
{
55
public bool IsMatch(TypePair context) => context.SourceType == typeof(string) && HasParse(context.DestinationType);
66
static bool HasParse(Type type) => type == typeof(Guid) || type == typeof(TimeSpan) || type == typeof(DateTimeOffset);

src/AutoMapper/Mappers/StringToEnumMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Runtime.Serialization;
22
namespace AutoMapper.Internal.Mappers;
3-
public class StringToEnumMapper : IObjectMapper
3+
public sealed class StringToEnumMapper : IObjectMapper
44
{
55
private static readonly MethodInfo EqualsMethod = typeof(StringToEnumMapper).GetMethod(nameof(StringCompareOrdinalIgnoreCase));
66
private static readonly MethodInfo ParseMethod = typeof(Enum).StaticGenericMethod("Parse", parametersCount: 2);

src/AutoMapper/Mappers/ToDynamicMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Microsoft.CSharp.RuntimeBinder;
33
using Binder = Microsoft.CSharp.RuntimeBinder.Binder;
44
namespace AutoMapper.Internal.Mappers;
5-
public class ToDynamicMapper : IObjectMapper
5+
public sealed class ToDynamicMapper : IObjectMapper
66
{
77
private static readonly MethodInfo MapMethodInfo = typeof(ToDynamicMapper).GetStaticMethod(nameof(Map));
88
private static object Map(object source, object destination, Type destinationType, ResolutionContext context, ProfileMap profileMap)

src/AutoMapper/Mappers/ToStringDictionaryMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class ToStringDictionaryMapper : IObjectMapper
2+
public sealed class ToStringDictionaryMapper : IObjectMapper
33
{
44
private static readonly MethodInfo MembersDictionaryMethodInfo = typeof(ToStringDictionaryMapper).GetStaticMethod(nameof(MembersDictionary));
55
public bool IsMatch(TypePair context) => typeof(IDictionary<string, object>).IsAssignableFrom(context.DestinationType);

src/AutoMapper/Mappers/ToStringMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.Internal.Mappers;
2-
public class ToStringMapper : IObjectMapper
2+
public sealed class ToStringMapper : IObjectMapper
33
{
44
public bool IsMatch(TypePair context) => context.DestinationType == typeof(string);
55
public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap, MemberMap memberMap, Expression sourceExpression, Expression destExpression)

src/AutoMapper/Mappers/UnderlyingEnumTypeMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.Internal.Mappers;
22

3-
public class UnderlyingTypeEnumMapper : IObjectMapper
3+
public sealed class UnderlyingTypeEnumMapper : IObjectMapper
44
{
55
public bool IsMatch(TypePair context) => context.IsEnumToUnderlyingType() || context.IsUnderlyingTypeToEnum();
66
public Expression MapExpression(IGlobalConfiguration configuration, ProfileMap profileMap,

src/AutoMapper/QueryableExtensions/ProjectionMappers/AssignableProjectionMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.QueryableExtensions.Impl;
22
[EditorBrowsable(EditorBrowsableState.Never)]
3-
public class AssignableProjectionMapper : IProjectionMapper
3+
public sealed class AssignableProjectionMapper : IProjectionMapper
44
{
55
public bool IsMatch(TypePair context) => context.DestinationType.IsAssignableFrom(context.SourceType);
66
public Expression Project(IGlobalConfiguration configuration, in ProjectionRequest request, Expression resolvedSource, LetPropertyMaps letPropertyMaps)

src/AutoMapper/QueryableExtensions/ProjectionMappers/EnumProjectionMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace AutoMapper.QueryableExtensions.Impl;
22
[EditorBrowsable(EditorBrowsableState.Never)]
3-
public class EnumProjectionMapper : IProjectionMapper
3+
public sealed class EnumProjectionMapper : IProjectionMapper
44
{
55
public Expression Project(IGlobalConfiguration configuration, in ProjectionRequest request, Expression resolvedSource, LetPropertyMaps letPropertyMaps)
66
=> Convert(resolvedSource, request.DestinationType);

src/AutoMapper/QueryableExtensions/ProjectionMappers/EnumerableProjectionMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace AutoMapper.QueryableExtensions.Impl;
22
using static ReflectionHelper;
33
[EditorBrowsable(EditorBrowsableState.Never)]
4-
public class EnumerableProjectionMapper : IProjectionMapper
4+
public sealed class EnumerableProjectionMapper : IProjectionMapper
55
{
66
private static readonly MethodInfo SelectMethod = typeof(Enumerable).StaticGenericMethod("Select", parametersCount: 2);
77
private static readonly MethodInfo ToArrayMethod = typeof(Enumerable).GetStaticMethod("ToArray");

src/AutoMapper/QueryableExtensions/ProjectionMappers/NullableSourceProjectionMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespace AutoMapper.QueryableExtensions.Impl;
2-
internal class NullableSourceProjectionMapper : IProjectionMapper
2+
public sealed class NullableSourceProjectionMapper : IProjectionMapper
33
{
44
public Expression Project(IGlobalConfiguration configuration, in ProjectionRequest request, Expression resolvedSource, LetPropertyMaps letPropertyMaps) =>
55
Coalesce(resolvedSource, New(request.DestinationType));

src/AutoMapper/QueryableExtensions/ProjectionMappers/StringProjectionMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace AutoMapper.QueryableExtensions.Impl;
22

33
[EditorBrowsable(EditorBrowsableState.Never)]
4-
public class StringProjectionMapper : IProjectionMapper
4+
public sealed class StringProjectionMapper : IProjectionMapper
55
{
66
public bool IsMatch(TypePair context) => context.DestinationType == typeof(string);
77
public Expression Project(IGlobalConfiguration configuration, in ProjectionRequest request, Expression resolvedSource, LetPropertyMaps letPropertyMaps)

0 commit comments

Comments
 (0)