|
From: <fab...@us...> - 2008-09-03 20:57:14
|
Revision: 3743
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3743&view=rev
Author: fabiomaulo
Date: 2008-09-03 20:57:21 +0000 (Wed, 03 Sep 2008)
Log Message:
-----------
Merge r3742 (Fix NH-1464)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Proxy/ProxyTypeValidator.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1464/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1464/Fixture.cs
Modified: trunk/nhibernate/src/NHibernate/Proxy/ProxyTypeValidator.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Proxy/ProxyTypeValidator.cs 2008-09-03 20:48:55 UTC (rev 3742)
+++ trunk/nhibernate/src/NHibernate/Proxy/ProxyTypeValidator.cs 2008-09-03 20:57:21 UTC (rev 3743)
@@ -91,8 +91,8 @@
private static void CheckMethodIsVirtual(System.Type type, MethodInfo method, IList errors)
{
- if (method.DeclaringType != typeof(object) &&
- (method.IsPublic || method.IsAssembly || method.IsFamilyOrAssembly))
+ if (method.DeclaringType != typeof(object) && !IsDisposeMethod(method) &&
+ method.IsPublic || method.IsAssembly || method.IsFamilyOrAssembly)
{
if (!method.IsVirtual || method.IsFinal)
{
@@ -101,6 +101,11 @@
}
}
+ private static bool IsDisposeMethod(MethodBase method)
+ {
+ return method.Name.Equals("Dispose") && method.MemberType == MemberTypes.Method && method.GetParameters().Length == 0;
+ }
+
private static bool HasVisibleDefaultConstructor(System.Type type)
{
ConstructorInfo constructor = type.GetConstructor(
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1464/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1464/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1464/Fixture.cs 2008-09-03 20:57:21 UTC (rev 3743)
@@ -0,0 +1,72 @@
+using System;
+using System.Collections;
+using NHibernate.Proxy;
+using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace NHibernate.Test.NHSpecificTest.NH1464
+{
+ [TestFixture]
+ public class Fixture
+ {
+ public class CPPMimicBase
+ {
+ public virtual void Dispose()
+ {
+
+ }
+ }
+ public class CPPMimic : CPPMimicBase
+ {
+ public sealed override void Dispose()
+ {
+
+ }
+ }
+
+ public class Another: IDisposable
+ {
+ protected void Dispose(bool disposing)
+ {
+
+ }
+
+ public void Dispose()
+ {
+ }
+
+ ~Another()
+ {
+
+ }
+ }
+
+ public class OneMore : IDisposable
+ {
+ public void Dispose(bool disposing)
+ {
+
+ }
+
+ public void Dispose()
+ {
+ }
+
+ ~OneMore()
+ {
+
+ }
+ }
+
+ [Test]
+ public void NoExceptionForDispose()
+ {
+ ICollection errs = ProxyTypeValidator.ValidateType(typeof (CPPMimic));
+ Assert.That(errs, Is.Null);
+ errs = ProxyTypeValidator.ValidateType(typeof(Another));
+ Assert.That(errs, Is.Null);
+ errs = ProxyTypeValidator.ValidateType(typeof(OneMore));
+ Assert.That(errs.Count, Is.EqualTo(1));
+ }
+ }
+}
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-09-03 20:48:55 UTC (rev 3742)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-09-03 20:57:21 UTC (rev 3743)
@@ -464,6 +464,7 @@
<Compile Include="NHSpecificTest\NH1419\Blog.cs" />
<Compile Include="NHSpecificTest\NH1419\Entry.cs" />
<Compile Include="NHSpecificTest\NH1419\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH1464\Fixture.cs" />
<Compile Include="NHSpecificTest\NH280\Fixture.cs" />
<Compile Include="NHSpecificTest\NH280\Foo.cs" />
<Compile Include="NHSpecificTest\NH1018\Employee.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|