From: <fab...@us...> - 2009-07-05 16:55:23
|
Revision: 4583 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4583&view=rev Author: fabiomaulo Date: 2009-07-05 16:55:21 +0000 (Sun, 05 Jul 2009) Log Message: ----------- Merge r4582 (partial fix NH-1867) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs Modified: trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs 2009-07-05 16:52:07 UTC (rev 4582) +++ trunk/nhibernate/src/NHibernate/Util/TypeNameParser.cs 2009-07-05 16:55:21 UTC (rev 4583) @@ -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: trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs 2009-07-05 16:52:07 UTC (rev 4582) +++ trunk/nhibernate/src/NHibernate.Test/UtilityTest/TypeNameParserFixture.cs 2009-07-05 16:55:21 UTC (rev 4583) @@ -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. |