Skip to content

Support .NET Core 3 #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 1.0.{build}
image: Visual Studio 2017
image: Visual Studio 2019
services:
- mssql2017
- msmq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<ProjectReference Include="..\Spring.NmsQuickStart.Common\Spring.NmsQuickStart.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Apache.NMS.ActiveMQ" Version="1.7.2" />
<PackageReference Include="Common.Logging" Version="$(CommonLoggingVersion)" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net452</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Apache.NMS" Version="1.8.0" />
<PackageReference Include="Apache.NMS.ActiveMQ" Version="1.7.2" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<ProjectReference Include="..\Spring.NmsQuickStart.Common\Spring.NmsQuickStart.Common.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Apache.NMS.ActiveMQ" Version="1.7.2" />
<PackageReference Include="Common.Logging" Version="$(CommonLoggingVersion)" />
</ItemGroup>
<ItemGroup>
Expand Down
16 changes: 12 additions & 4 deletions src/Spring/Spring.Aop/Aop/Framework/AdvisedSupport.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#region License

/*
* Copyright © 2002-2011 the original author or authors.
*
Expand All @@ -14,8 +16,9 @@
* limitations under the License.
*/

#endregion

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
Expand Down Expand Up @@ -368,13 +371,18 @@ protected void SetInterfacesInternal(IList<Type> value)
/// <see cref="System.Type"/>s to their delegates.
/// </value>
/// <seealso cref="Spring.Aop.Framework.IAdvised.InterfaceMap"/>
public virtual IDictionary InterfaceMap
public virtual IDictionary<Type, object> InterfaceMap
{
get
{
lock (this.SyncRoot)
lock (SyncRoot)
{
return new Hashtable(this.interfaceMap);
var dictionary = new Dictionary<Type, object>(interfaceMap.Count);
foreach (var entry in interfaceMap)
{
dictionary[entry.Key] = entry.Value;
}
return dictionary;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@

#endregion

#region Imports

using System;
using System.Collections;
using System.Collections.Generic;
using Common.Logging;

Expand All @@ -31,8 +28,6 @@

using System.Linq;

#endregion

namespace Spring.Aop.Framework.AutoProxy
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#region License

/*
* Copyright 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,18 +18,14 @@

#endregion

#region Imports

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;

using Spring.Proxy;

#endregion

namespace Spring.Aop.Framework.DynamicProxy
{
/// <summary>
Expand All @@ -39,8 +35,6 @@ namespace Spring.Aop.Framework.DynamicProxy
/// <author>Bruno Baia</author>
public abstract class AbstractAopProxyMethodBuilder : AbstractProxyMethodBuilder
{
#region Fields

/// <summary>
/// The <see cref="IAopProxyTypeGenerator"/> implementation to use.
/// </summary>
Expand All @@ -50,13 +44,13 @@ public abstract class AbstractAopProxyMethodBuilder : AbstractProxyMethodBuilder
/// The dictionary to cache the list of target
/// <see cref="System.Reflection.MethodInfo"/>s.
/// </summary>
protected IDictionary targetMethods;
protected IDictionary<string, MethodInfo> targetMethods;

/// <summary>
/// The dictionary to cache the list of target
/// <see cref="System.Reflection.MethodInfo"/>s defined on the proxy.
/// </summary>
protected IDictionary onProxyTargetMethods;
protected IDictionary<string, MethodInfo> onProxyTargetMethods;

// variables

Expand Down Expand Up @@ -112,15 +106,11 @@ public abstract class AbstractAopProxyMethodBuilder : AbstractProxyMethodBuilder

// private fields

private static IDictionary ldindOpCodes;

#endregion

#region Constructor(s) / Destructor
private static Dictionary<Type, OpCode> ldindOpCodes;

static AbstractAopProxyMethodBuilder()
{
ldindOpCodes = new Hashtable();
ldindOpCodes = new Dictionary<Type, OpCode>();
ldindOpCodes[typeof(sbyte)] = OpCodes.Ldind_I1;
ldindOpCodes[typeof(short)] = OpCodes.Ldind_I2;
ldindOpCodes[typeof(int)] = OpCodes.Ldind_I4;
Expand Down Expand Up @@ -152,8 +142,8 @@ static AbstractAopProxyMethodBuilder()
/// </param>
protected AbstractAopProxyMethodBuilder(
TypeBuilder typeBuilder, IAopProxyTypeGenerator aopProxyGenerator,
bool explicitImplementation, IDictionary targetMethods)
: this(typeBuilder, aopProxyGenerator, explicitImplementation, targetMethods, new Hashtable())
bool explicitImplementation, IDictionary<string, MethodInfo> targetMethods)
: this(typeBuilder, aopProxyGenerator, explicitImplementation, targetMethods, new Dictionary<string, MethodInfo>())
{
}

Expand All @@ -178,18 +168,14 @@ protected AbstractAopProxyMethodBuilder(
/// </param>
protected AbstractAopProxyMethodBuilder(
TypeBuilder typeBuilder, IAopProxyTypeGenerator aopProxyGenerator,
bool explicitImplementation, IDictionary targetMethods, IDictionary onProxyTargetMethods)
bool explicitImplementation, IDictionary<string, MethodInfo> targetMethods, IDictionary<string, MethodInfo> onProxyTargetMethods)
: base(typeBuilder, aopProxyGenerator, explicitImplementation)
{
this.aopProxyGenerator = aopProxyGenerator;
this.targetMethods = targetMethods;
this.onProxyTargetMethods = onProxyTargetMethods;
}

#endregion

#region Protected Members

/// <summary>
/// Generates the proxy method.
/// </summary>
Expand Down Expand Up @@ -235,7 +221,7 @@ protected virtual void GenerateTargetMethodCacheField(
targetMethods.Add(methodId, method);

targetMethodCacheField = typeBuilder.DefineField(methodId, typeof(MethodInfo),
FieldAttributes.Private | FieldAttributes.Static | FieldAttributes.InitOnly);
FieldAttributes.Private | FieldAttributes.Static);

MakeGenericMethod(il, method, targetMethodCacheField, genericTargetMethod);
}
Expand Down Expand Up @@ -362,7 +348,7 @@ protected virtual void PushOnProxyTargetMethodInfo(ILGenerator il, MethodInfo me
/// <param name="method">The method to proxy.</param>
protected virtual void DeclareLocals(ILGenerator il, MethodInfo method)
{
interceptors = il.DeclareLocal(typeof(IList));
interceptors = il.DeclareLocal(typeof(System.Collections.IList));
targetType = il.DeclareLocal(typeof(Type));
arguments = il.DeclareLocal(typeof(Object[]));

Expand Down Expand Up @@ -604,10 +590,6 @@ protected virtual void EndMethod(ILGenerator il, MethodInfo method)
il.Emit(OpCodes.Ldloc, returnValue);
}
}

#endregion

#region Reflection.Emit utility methods

/// <summary>
/// Emits MSIL instructions to load a value of the specified <paramref name="type"/>
Expand Down Expand Up @@ -675,12 +657,8 @@ protected static void EmitUnboxIfNeeded(ILGenerator il, Type type)
il.Emit(OpCodes.Unbox_Any, type);
}
}

#endregion
}

#region References helper class definition

internal struct References
{
// fields
Expand Down Expand Up @@ -723,7 +701,7 @@ internal struct References
typeof(AopContext).GetMethod("PopProxy", BindingFlags.Static | BindingFlags.Public, null, Type.EmptyTypes, null);

public static readonly MethodInfo InvokeMethod =
typeof(AdvisedProxy).GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(Object), typeof(Object), typeof(Type), typeof(MethodInfo), typeof(MethodInfo), typeof(Object[]), typeof(IList) }, null);
typeof(AdvisedProxy).GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(Object), typeof(Object), typeof(Type), typeof(MethodInfo), typeof(MethodInfo), typeof(Object[]), typeof(System.Collections.IList) }, null);

public static readonly MethodInfo GetInterceptorsMethod =
typeof(AdvisedProxy).GetMethod("GetInterceptors", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(Type), typeof(MethodInfo) }, null);
Expand Down Expand Up @@ -757,8 +735,6 @@ internal struct References
typeof(IAdvised).GetProperty("ExposeProxy", typeof(Boolean)).GetGetMethod();

public static readonly MethodInfo CountProperty =
typeof(ICollection).GetProperty("Count", typeof(Int32)).GetGetMethod();
typeof(System.Collections.ICollection).GetProperty("Count", typeof(Int32)).GetGetMethod();
}

#endregion
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -247,7 +247,7 @@ IList<Type> IAdvised.Interfaces
get { return m_advised.Interfaces; }
}

IDictionary IAdvised.InterfaceMap
IDictionary<Type, object> IAdvised.InterfaceMap
{
get { return m_advised.InterfaceMap; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#region License

/*
* Copyright 2002-2011 the original author or authors.
* Copyright © 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,16 +18,12 @@

#endregion

#region Imports

using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;

using Spring.Util;

#endregion

namespace Spring.Aop.Framework.DynamicProxy
{
/// <summary>
Expand All @@ -37,8 +33,6 @@ namespace Spring.Aop.Framework.DynamicProxy
/// <author>Bruno Baia</author>
public class BaseAopProxyMethodBuilder : AbstractAopProxyMethodBuilder
{
#region Constructor(s) / Destructor

/// <summary>
/// Creates a new instance of the method builder.
/// </summary>
Expand All @@ -56,15 +50,11 @@ public class BaseAopProxyMethodBuilder : AbstractAopProxyMethodBuilder
/// </param>
public BaseAopProxyMethodBuilder(
TypeBuilder typeBuilder, IAopProxyTypeGenerator aopProxyGenerator,
IDictionary targetMethods, IDictionary onProxyTargetMethods)
IDictionary<string, MethodInfo> targetMethods, IDictionary<string, MethodInfo> onProxyTargetMethods)
: base(typeBuilder, aopProxyGenerator, false, targetMethods, onProxyTargetMethods)
{
}

#endregion

#region Protected Methods

/// <summary>
/// Create static field that will cache target method when defined on the proxy.
/// </summary>
Expand Down Expand Up @@ -101,7 +91,7 @@ protected override void GenerateOnProxyTargetMethodCacheField(
onProxyTargetMethods.Add(methodId, method);

onProxyTargetMethodCacheField = typeBuilder.DefineField(
methodId, typeof(MethodInfo), FieldAttributes.Private | FieldAttributes.Static | FieldAttributes.InitOnly);
methodId, typeof(MethodInfo), FieldAttributes.Private | FieldAttributes.Static);

MakeGenericMethod(il, method, onProxyTargetMethodCacheField, genericOnProxyTargetMethod);
}
Expand All @@ -120,7 +110,5 @@ protected override void CallDirectProxiedMethod(
{
CallDirectBaseMethod(il, method);
}

#endregion
}
}
Loading