From: <fab...@us...> - 2009-07-05 16:52:07
|
Revision: 4582 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4582&view=rev Author: fabiomaulo Date: 2009-07-05 16:52:07 +0000 (Sun, 05 Jul 2009) Log Message: ----------- Partially Fix NH-1867 (when the user send us a valid mapping, perhaps, we can fix the other part) Modified Paths: -------------- branches/2.1.x/nhibernate/src/NHibernate/Util/TypeNameParser.cs branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs Modified: branches/2.1.x/nhibernate/src/NHibernate/Util/TypeNameParser.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate/Util/TypeNameParser.cs 2009-07-05 04:45:50 UTC (rev 4581) +++ branches/2.1.x/nhibernate/src/NHibernate/Util/TypeNameParser.cs 2009-07-05 16:52:07 UTC (rev 4582) @@ -65,7 +65,8 @@ { throw new ParserException("Invalid generic fully-qualified type name:" + type); } - string cardinalityString = type.Substring(genericTypeCardinalityIdx + 1, genericTypeArgsStartIdx - genericTypeCardinalityIdx - 1); + // the follow will fail with a generic class with more the 9 type-args (I would see that entity class) + string cardinalityString = type.Substring(genericTypeCardinalityIdx + 1, 1); int genericTypeCardinality = int.Parse(cardinalityString); // get the FullName of the non-generic type Modified: branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs =================================================================== --- branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs 2009-07-05 04:45:50 UTC (rev 4581) +++ branches/2.1.x/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs 2009-07-05 16:52:07 UTC (rev 4582) @@ -265,5 +265,34 @@ var a = TypeNameParser.Parse(typeName); Assert.That(a.ToString(), Is.EqualTo(expected)); } + + private class A<T> + { + public class B { } + } + + private class Aa<T> + { + public class Bb<TX, TJ, TZ> + { + public class C { } + } + } + + [Test] + [Description("Parser multiple nested classes with a generic in the middle.")] + public void ParseNestedWithinGeneric() + { + // NH-1867 + CheckInput(typeof(A<int>.B).FullName, typeof(A<int>.B).FullName, null); + } + + [Test] + [Description("Parser multiple nested classes with a generics.")] + public void ComplexNestedWithGeneric() + { + CheckInput(typeof(Aa<int>.Bb<int, short, string>).FullName, typeof(Aa<int>.Bb<int, short, string>).FullName, null); + CheckInput(typeof(Aa<int>.Bb<int, short, string>.C).FullName, typeof(Aa<int>.Bb<int, short, string>.C).FullName, null); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |