Skip to content

Commit 88c3673

Browse files
committed
Remove more use on non-generic persistent collections in tests.
1 parent 016c97b commit 88c3673

File tree

15 files changed

+87
-89
lines changed

15 files changed

+87
-89
lines changed

src/NHibernate.DomainModel/Contained.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
using System.Collections;
2+
using System.Collections.Generic;
33

44
namespace NHibernate.DomainModel
55
{
@@ -10,8 +10,8 @@ public class Contained
1010
{
1111
private Container _container;
1212
private long _id;
13-
private IList _bag = new ArrayList();
14-
private IList _lazyBag = new ArrayList();
13+
private IList<Container> _bag = new List<Container>();
14+
private IList<Container> _lazyBag = new List<Container>();
1515

1616
# region object overrides
1717

@@ -41,13 +41,13 @@ public virtual long Id
4141
set { _id = value; }
4242
}
4343

44-
public virtual IList Bag
44+
public virtual IList<Container> Bag
4545
{
4646
get { return _bag; }
4747
set { _bag = value; }
4848
}
4949

50-
public virtual IList LazyBag
50+
public virtual IList<Container> LazyBag
5151
{
5252
get { return _lazyBag; }
5353
set { _lazyBag = value; }

src/NHibernate.DomainModel/Container.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using System.Collections.Generic;
43

54
namespace NHibernate.DomainModel
@@ -82,33 +81,33 @@ public Glarch Glarch
8281
}
8382

8483

85-
private IList _oneToMany;
86-
private IList _components;
87-
private IList _manyToMany;
84+
private IList<Simple> _oneToMany;
85+
private IList<ContainerInnerClass> _components;
86+
private IList<Simple> _manyToMany;
8887
// <set> mapping
8988
private ISet<ContainerInnerClass> _composites;
90-
private IList _cascades;
89+
private IList<ContainerInnerClass> _cascades;
9190
private long _id;
92-
private IList _bag;
93-
private IList _lazyBag = new ArrayList();
94-
private IDictionary _ternaryMap;
91+
private IList<Contained> _bag;
92+
private IList<Contained> _lazyBag = new List<Contained>();
93+
private IDictionary<string, Ternary> _ternaryMap;
9594
//<set> mapping
9695
private ISet<Ternary> _ternarySet;
9796

9897

99-
public virtual IList OneToMany
98+
public virtual IList<Simple> OneToMany
10099
{
101100
get { return _oneToMany; }
102101
set { _oneToMany = value; }
103102
}
104103

105-
public virtual IList ManyToMany
104+
public virtual IList<Simple> ManyToMany
106105
{
107106
get { return _manyToMany; }
108107
set { _manyToMany = value; }
109108
}
110109

111-
public virtual IList Components
110+
public virtual IList<ContainerInnerClass> Components
112111
{
113112
get { return _components; }
114113
set { _components = value; }
@@ -120,7 +119,7 @@ public virtual ISet<ContainerInnerClass> Composites
120119
set { _composites = value; }
121120
}
122121

123-
public virtual IList Cascades
122+
public virtual IList<ContainerInnerClass> Cascades
124123
{
125124
get { return _cascades; }
126125
set { _cascades = value; }
@@ -132,19 +131,19 @@ public virtual long Id
132131
set { _id = value; }
133132
}
134133

135-
public virtual IList Bag
134+
public virtual IList<Contained> Bag
136135
{
137136
get { return _bag; }
138137
set { _bag = value; }
139138
}
140139

141-
public virtual IList LazyBag
140+
public virtual IList<Contained> LazyBag
142141
{
143142
get { return _lazyBag; }
144143
set { _lazyBag = value; }
145144
}
146145

147-
public virtual IDictionary TernaryMap
146+
public virtual IDictionary<string, Ternary> TernaryMap
148147
{
149148
get { return _ternaryMap; }
150149
set { _ternaryMap = value; }

src/NHibernate.DomainModel/Glarch.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ public class Glarch : Super, GlarchProxy, ILifecycle, INamed
1111
private int _version;
1212
private GlarchProxy _next;
1313
private short _order;
14-
private IList _strings;
14+
private IList<string> _strings;
1515
private ISet<string> _stringSets;
16-
private IList _fooComponents;
16+
private IList<FooComponent> _fooComponents;
1717
private GlarchProxy[] _proxyArray;
1818
private ISet<GlarchProxy> _proxySet;
1919

@@ -62,7 +62,7 @@ public short Order
6262
/// <summary>
6363
/// Gets or sets the _strings
6464
/// </summary>
65-
public IList Strings
65+
public IList<string> Strings
6666
{
6767
get { return _strings; }
6868
set { _strings = value; }
@@ -83,7 +83,7 @@ public ISet<string> StringSets
8383
/// <summary>
8484
/// Gets or sets the _fooComponents
8585
/// </summary>
86-
public IList FooComponents
86+
public IList<FooComponent> FooComponents
8787
{
8888
get { return _fooComponents; }
8989
set { _fooComponents = value; }
@@ -126,7 +126,7 @@ public void OnLoad(ISession s, object id)
126126

127127
public LifecycleVeto OnSave(ISession s)
128128
{
129-
_dynaBean = new Hashtable();
129+
_dynaBean = new Dictionary<string, object>();
130130
_dynaBean["foo"] = "foo";
131131
_dynaBean["bar"] = 66;
132132
_immutable = "never changes!";

src/NHibernate.DomainModel/GlarchProxy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ public interface GlarchProxy
1515

1616
short Order { get; set; }
1717

18-
IList Strings { get; set; }
18+
IList<string> Strings { get; set; }
1919

2020
IDictionary DynaBean { get; set; }
2121

2222
ISet<string> StringSets { get; set; }
23-
IList FooComponents { get; set; }
23+
IList<FooComponent> FooComponents { get; set; }
2424
GlarchProxy[] ProxyArray { get; set; }
2525
ISet<GlarchProxy> ProxySet { get; set; }
2626
Multiplicity Multiple { get; set; }

src/NHibernate.DomainModel/Holder.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections;
32
using System.Collections.Generic;
43

54
namespace NHibernate.DomainModel
@@ -10,7 +9,7 @@ namespace NHibernate.DomainModel
109
public class Holder : INamed
1110
{
1211
private string _id;
13-
private IList _ones;
12+
private IList<One> _ones;
1413
private Foo[] _fooArray;
1514
private ISet<Foo> _foos; // <set> mapping
1615
private string _name;
@@ -31,7 +30,7 @@ public string Id
3130
set { _id = value; }
3231
}
3332

34-
public IList Ones
33+
public IList<One> Ones
3534
{
3635
get { return _ones; }
3736
set { _ones = value; }

src/NHibernate.DomainModel/MoreStuff.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Collections;
3-
2+
using System.Collections.Generic;
3+
44
namespace NHibernate.DomainModel
55
{
66
/// <summary>
@@ -12,7 +12,7 @@ public class MoreStuff
1212
private string _stringId;
1313
private int _intId;
1414
// <bag> mapping
15-
private IList _stuffs;
15+
private IList<Stuff> _stuffs;
1616
private string _name;
1717

1818

@@ -28,7 +28,7 @@ public int IntId
2828
set { _intId = value; }
2929
}
3030

31-
public IList Stuffs
31+
public IList<Stuff> Stuffs
3232
{
3333
get { return _stuffs; }
3434
set { _stuffs = value; }

src/NHibernate.Test/CompositeId/Customer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using System.Collections;
21
using System;
2+
using System.Collections.Generic;
33

44
namespace NHibernate.Test.CompositeId
55
{
@@ -8,7 +8,7 @@ public class Customer
88
private string customerId;
99
private string name;
1010
private string address;
11-
private IList orders = new ArrayList();
11+
private IList<Order> orders = new List<Order>();
1212

1313
public virtual string CustomerId
1414
{
@@ -28,7 +28,7 @@ public virtual string Address
2828
set { address = value; }
2929
}
3030

31-
public virtual IList Orders
31+
public virtual IList<Order> Orders
3232
{
3333
get { return orders; }
3434
set { orders = value; }

src/NHibernate.Test/FilterTest/DynamicFilterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ public TestData(DynamicFilterTest outer)
506506
this.outer = outer;
507507
}
508508

509-
public IList entitiesToCleanUp = new ArrayList();
509+
public IList<object> entitiesToCleanUp = new List<object>();
510510

511511
public void Prepare()
512512
{

src/NHibernate.Test/Legacy/FooBarTest.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using NHibernate.DomainModel;
1515
using NHibernate.Criterion;
1616
using NHibernate.Proxy;
17+
using NHibernate.Test.NHSpecificTest.NH1914;
1718
using NHibernate.Type;
1819
using NHibernate.Util;
1920
using NUnit.Framework;
@@ -89,7 +90,7 @@ public void ForCertain()
8990
{
9091
Glarch g = new Glarch();
9192
Glarch g2 = new Glarch();
92-
IList strings = new ArrayList();
93+
IList<string> strings = new List<string>();
9394
strings.Add("foo");
9495
g2.Strings = strings;
9596

@@ -1906,10 +1907,7 @@ public void NamedParams()
19061907
"left join bar.Baz baz left join baz.CascadingBars b " +
19071908
"where (bar.Name in (:nameList) or bar.Name in (:nameList)) and bar.String = :stringVal");
19081909

1909-
IList nameList = new ArrayList();
1910-
nameList.Add("bar");
1911-
nameList.Add("Bar");
1912-
nameList.Add("Bar Two");
1910+
var nameList = new List<string> {"bar", "Bar", "Bar Two"};
19131911
q.SetParameterList("nameList", nameList);
19141912
q.SetParameter("stringVal", "a string");
19151913
list = q.List();
@@ -2253,8 +2251,7 @@ public void AssociationId()
22532251
more.StringId = "id";
22542252
Stuff stuf = new Stuff();
22552253
stuf.MoreStuff = more;
2256-
more.Stuffs = new ArrayList();
2257-
more.Stuffs.Add(stuf);
2254+
more.Stuffs = new List<Stuff> {stuf};
22582255
stuf.Foo = bar;
22592256
stuf.Id = 1234;
22602257

@@ -2953,7 +2950,7 @@ public void UpdateCollections()
29532950
Foo f2 = new Foo();
29542951
Foo f3 = new Foo();
29552952
One o = new One();
2956-
baz.Ones = new ArrayList();
2953+
baz.Ones = new List<One>();
29572954
baz.Ones.Add(o);
29582955
Foo[] foos = new Foo[] {f1, null, f2};
29592956
baz.FooArray = foos;
@@ -3703,7 +3700,7 @@ public void VersionedCollections()
37033700
s.Save(g);
37043701
g.ProxyArray = new GlarchProxy[] {g};
37053702
string gid = (string) s.GetIdentifier(g);
3706-
ArrayList list = new ArrayList();
3703+
IList<string> list = new List<string>();
37073704
list.Add("foo");
37083705
g.Strings = list;
37093706
// <sets> in h2.0.3
@@ -3750,7 +3747,7 @@ public void VersionedCollections()
37503747
g = (GlarchProxy) s.Load(typeof(Glarch), gid);
37513748
Assert.AreEqual(4, g.Version, "versioned collection after");
37523749
Assert.AreEqual(0, g.ProxyArray.Length, "version collection after");
3753-
g.FooComponents = new ArrayList();
3750+
g.FooComponents = new List<FooComponent>();
37543751
g.ProxyArray = null;
37553752
s.Flush();
37563753
s.Close();

0 commit comments

Comments
 (0)