Skip to content

Commit 549e685

Browse files
committed
NH-3807 - Replace use of System.Collections.ArrayList with System.Collections.Generic.List<>.
System.Collections.ArrayList has been removed from CoreClr.
1 parent 21c8825 commit 549e685

File tree

9 files changed

+41
-36
lines changed

9 files changed

+41
-36
lines changed

src/NHibernate.Test/Component/Basic/ComponentTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected override void Configure(Configuration configuration)
3434
{
3535
string mapping = reader.ReadToEnd();
3636

37-
IList args = new ArrayList();
37+
IList args = new List<object>();
3838
args.Add("dob");
3939
// We don't have a session factory yet... is there some way to get one sooner?
4040
string replacement = Dialect.Functions["year"].Render(args, null).ToString().Replace("\"", "&quot;");
@@ -435,4 +435,4 @@ public void TestMergeComponent()
435435
}
436436
}
437437
}
438-
}
438+
}

src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using System.Collections;
3-
3+
using System.Collections.Generic;
44
using NUnit.Framework;
55

66
using NHibernate.Criterion;
@@ -43,7 +43,7 @@ public void SqlOperators()
4343
.Add(Restrictions.Not(Restrictions.Between("personAlias.Age", 10, 20)))
4444
.Add(!Restrictions.In("Name", new string[] { "name4" }))
4545
.Add(Restrictions.In("Name", new string[] { "name1", "name2", "name3" }))
46-
.Add(Restrictions.In("Name", new ArrayList() { "name1", "name2", "name3" }))
46+
.Add(Restrictions.In("Name", new List<object>() { "name1", "name2", "name3" }))
4747
.Add(Restrictions.InG<int>("Age", new int[] { 1, 2, 3 }))
4848
.Add(Restrictions.InsensitiveLike("Name", "test"))
4949
.Add(Restrictions.InsensitiveLike("Name", "tEsT", MatchMode.Anywhere))
@@ -67,7 +67,7 @@ public void SqlOperators()
6767
.And(Restrictions.On(() => personAlias.Age).Not.IsBetween(10).And(20))
6868
.And(!Restrictions.On<Person>(p => p.Name).IsIn(new string[] { "name4" }))
6969
.And(Restrictions.On<Person>(p => p.Name).IsIn(new string[] { "name1", "name2", "name3" }))
70-
.And(Restrictions.On<Person>(p => p.Name).IsIn(new ArrayList() { "name1", "name2", "name3" }))
70+
.And(Restrictions.On<Person>(p => p.Name).IsIn(new List<object>() { "name1", "name2", "name3" }))
7171
.And(Restrictions.On<Person>(p => p.Age).IsInG<int>(new int[] { 1, 2, 3 }))
7272
.And(Restrictions.On<Person>(p => p.Name).IsInsensitiveLike("test"))
7373
.And(Restrictions.On<Person>(p => p.Name).IsInsensitiveLike("tEsT", MatchMode.Anywhere))
@@ -120,7 +120,7 @@ public void SqlOperatorsInline()
120120
.Add(Restrictions.Between("personAlias.Age", 18, 65))
121121
.Add(Restrictions.Not(Restrictions.Between("Age", 18, 65)))
122122
.Add(Restrictions.In("Name", new string[] { "name1", "name2", "name3" }))
123-
.Add(Restrictions.In("personAlias.Name", new ArrayList() { "name1", "name2", "name3" }))
123+
.Add(Restrictions.In("personAlias.Name", new List<object>() { "name1", "name2", "name3" }))
124124
.Add(Restrictions.InG<int>("Age", new int[] { 1, 2, 3 }))
125125
.Add(Restrictions.InsensitiveLike("Name", "test"))
126126
.Add(Restrictions.InsensitiveLike("Name", "tEsT", MatchMode.Anywhere))
@@ -140,7 +140,7 @@ public void SqlOperatorsInline()
140140
.WhereRestrictionOn(() => personAlias.Age).IsBetween(18).And(65)
141141
.WhereRestrictionOn(p => p.Age).Not.IsBetween(18).And(65)
142142
.AndRestrictionOn(p => p.Name).IsIn(new string[] { "name1", "name2", "name3" })
143-
.AndRestrictionOn(() => personAlias.Name).IsIn(new ArrayList() { "name1", "name2", "name3" })
143+
.AndRestrictionOn(() => personAlias.Name).IsIn(new List<object>() { "name1", "name2", "name3" })
144144
.AndRestrictionOn(p => p.Age).IsInG<int>(new int[] { 1, 2, 3 })
145145
.AndRestrictionOn(p => p.Name).IsInsensitiveLike("test")
146146
.AndRestrictionOn(p => p.Name).IsInsensitiveLike("tEsT", MatchMode.Anywhere)
@@ -164,15 +164,15 @@ public void DetachedRestrictions()
164164
.Add(Restrictions.Between("Age", 18, 65))
165165
.Add(Restrictions.Between("personAlias.Age", 18, 65))
166166
.Add(Restrictions.In("Name", new string[] { "name1", "name2", "name3" }))
167-
.Add(Restrictions.In("personAlias.Name", new ArrayList() { "name1", "name2", "name3" }));
167+
.Add(Restrictions.In("personAlias.Name", new List<object>() { "name1", "name2", "name3" }));
168168

169169
Person personAlias = null;
170170
QueryOver<Person> actual =
171171
QueryOver.Of<Person>(() => personAlias)
172172
.WhereRestrictionOn(p => p.Age).IsBetween(18).And(65)
173173
.WhereRestrictionOn(() => personAlias.Age).IsBetween(18).And(65)
174174
.AndRestrictionOn(p => p.Name).IsIn(new string[] { "name1", "name2", "name3" })
175-
.AndRestrictionOn(() => personAlias.Name).IsIn(new ArrayList() { "name1", "name2", "name3" });
175+
.AndRestrictionOn(() => personAlias.Name).IsIn(new List<object>() { "name1", "name2", "name3" });
176176

177177
AssertCriteriaAreEqual(expected, actual);
178178
}
@@ -238,7 +238,7 @@ public void RestrictionsExtensions()
238238
.Add(Restrictions.InsensitiveLike("Name", "%test%"))
239239
.Add(Restrictions.InsensitiveLike("Name", "test", MatchMode.Anywhere))
240240
.Add(Restrictions.In("Name", new string[] { "name1", "name2" }))
241-
.Add(Restrictions.In("Name", new ArrayList() { "name3", "name4" }))
241+
.Add(Restrictions.In("Name", new List<object>() { "name3", "name4" }))
242242
.Add(Restrictions.Between("Age", 10, 20));
243243

244244
IQueryOver<Person> actual =
@@ -249,7 +249,7 @@ public void RestrictionsExtensions()
249249
.And(p => p.Name.IsInsensitiveLike("%test%"))
250250
.And(p => p.Name.IsInsensitiveLike("test", MatchMode.Anywhere))
251251
.And(p => p.Name.IsIn(new string[] { "name1", "name2" }))
252-
.And(p => p.Name.IsIn(new ArrayList() { "name3", "name4" }))
252+
.And(p => p.Name.IsIn(new List<object>() { "name3", "name4" }))
253253
.And(p => p.Age.IsBetween(10).And(20));
254254

255255
AssertCriteriaAreEqual(expected, actual);

src/NHibernate.Test/EngineTest/TypedValueFixture.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections;
2+
using System.Collections.Generic;
23
using NHibernate.Engine;
34
using NUnit.Framework;
45

@@ -10,11 +11,11 @@ public class TypedValueFixture
1011
[Test]
1112
public void EqualsCollection()
1213
{
13-
ArrayList value1 = new ArrayList();
14+
List<object> value1 = new List<object>();
1415
value1.Add(10);
1516
value1.Add(20);
1617

17-
ArrayList value2 = (ArrayList) value1.Clone();
18+
List<object> value2 = (List<object>) new List<object>(value1);
1819

1920
TypedValue t1 = new TypedValue(NHibernateUtil.Int32, value1, EntityMode.Poco);
2021
TypedValue t2 = new TypedValue(NHibernateUtil.Int32, value2, EntityMode.Poco);
@@ -39,4 +40,4 @@ public void WhenTheTypeIsAnArray_ChoseTheDefaultComparer()
3940
Assert.That(tv.Comparer, Is.TypeOf<TypedValue.DefaultComparer>());
4041
}
4142
}
42-
}
43+
}

src/NHibernate.Test/Hql/SQLFunctionTemplateTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections;
3+
using System.Collections.Generic;
34
using System.Globalization;
45
using NHibernate.Dialect.Function;
56
using NUnit.Framework;
@@ -14,7 +15,7 @@ public void Simple()
1415
{
1516
SQLFunctionTemplate ft = new SQLFunctionTemplate(NHibernateUtil.String, "ltrim( ?1 )");
1617
Assert.IsTrue(ft.HasArguments);
17-
IList args = new ArrayList();
18+
IList args = new List<object>();
1819
args.Add("'abcd <'");
1920
Assert.AreEqual("ltrim( 'abcd <' )", ft.Render(args, factoryImpl).ToString());
2021

@@ -35,7 +36,7 @@ public void Simple()
3536
public void RepetedParams()
3637
{
3738
SQLFunctionTemplate ft;
38-
IList args = new ArrayList();
39+
IList args = new List<object>();
3940

4041
ft =
4142
new SQLFunctionTemplate(NHibernateUtil.String,
@@ -58,7 +59,7 @@ public void RepetedParams()
5859
public void NoStringArguments()
5960
{
6061
SQLFunctionTemplate ft;
61-
IList args = new ArrayList();
62+
IList args = new List<object>();
6263

6364
ft = new SQLFunctionTemplate(NHibernateUtil.String, "?1 ?2 ?3");
6465
args.Add(DateTime.Today);
@@ -75,7 +76,7 @@ public void NoStringArguments()
7576
public void ArgsDiffParams()
7677
{
7778
SQLFunctionTemplate ft;
78-
IList args = new ArrayList();
79+
IList args = new List<object>();
7980

8081
// No Args; 2 params
8182
ft = new SQLFunctionTemplate(NHibernateUtil.String, "func(?1,?2)");

src/NHibernate.Test/Hql/SimpleFunctionsTest.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections;
3+
using System.Collections.Generic;
34
using NHibernate.Dialect.Function;
45
using NHibernate.SqlTypes;
56
using NUnit.Framework;
@@ -13,7 +14,7 @@ public class SimpleFunctionsTest : BaseFunctionFixture
1314
[Test]
1415
public void NoArgFunction()
1516
{
16-
IList args = new ArrayList();
17+
IList args = new List<object>();
1718
NoArgSQLFunction nf = new NoArgSQLFunction("noArgs", NHibernateUtil.String);
1819
Assert.IsTrue(nf.HasParenthesesIfNoArguments);
1920
Assert.AreEqual("noArgs()", nf.Render(args, factoryImpl).ToString());
@@ -37,7 +38,7 @@ public void NoArgFunction()
3738
[Test]
3839
public void StandardFunction()
3940
{
40-
IList args = new ArrayList();
41+
IList args = new List<object>();
4142

4243
StandardSQLFunction sf = new StandardSQLFunction("fname");
4344
Assert.AreEqual("fname()", sf.Render(args, factoryImpl).ToString());
@@ -50,7 +51,7 @@ public void StandardFunction()
5051
[Test]
5152
public void CastFunc()
5253
{
53-
IList args = new ArrayList();
54+
IList args = new List<object>();
5455

5556
CastFunction cf = new CastFunction();
5657
try
@@ -86,7 +87,7 @@ public void CastFunc()
8687
[Test]
8788
public void VarArgsFunction()
8889
{
89-
IList args = new ArrayList();
90+
IList args = new List<object>();
9091

9192
VarArgsSQLFunction vf = new VarArgsSQLFunction("(", " || ", ")");
9293
Assert.AreEqual("()", vf.Render(args, factoryImpl).ToString());
@@ -104,7 +105,7 @@ public void VarArgsFunction()
104105
[Test]
105106
public void Nvl()
106107
{
107-
IList args = new ArrayList();
108+
IList args = new List<object>();
108109

109110
NvlFunction nf = new NvlFunction();
110111
args.Add("va1");
@@ -120,7 +121,7 @@ public void Nvl()
120121
[Test]
121122
public void PositionSubstring()
122123
{
123-
IList args = new ArrayList();
124+
IList args = new List<object>();
124125

125126
PositionSubstringFunction psf = new PositionSubstringFunction();
126127
args.Add("'a'");
@@ -142,7 +143,7 @@ public void ClassicSum()
142143
//<set function type> <leftparen> [ <setquantifier> ] <value expression> <right paren>
143144
//<set function type> : := AVG | MAX | MIN | SUM | COUNT
144145
//<setquantifier> ::= DISTINCT | ALL
145-
IList args = new ArrayList();
146+
IList args = new List<object>();
146147

147148
ClassicSumFunction csf = new ClassicSumFunction();
148149
args.Add("va1");
@@ -172,7 +173,7 @@ public void ClassicCount()
172173
{
173174
//ANSI-SQL92 definition
174175
//COUNT < leftparen> <asterisk> < right paren>
175-
IList args = new ArrayList();
176+
IList args = new List<object>();
176177

177178
ClassicCountFunction ccf = new ClassicCountFunction();
178179
args.Add("va1");
@@ -204,7 +205,7 @@ public void ClassicAvg()
204205
//<set function type> <leftparen> [ <setquantifier> ] <value expression> <right paren>
205206
//<set function type> : := AVG | MAX | MIN | SUM | COUNT
206207
//<setquantifier> ::= DISTINCT | ALL
207-
IList args = new ArrayList();
208+
IList args = new List<object>();
208209

209210
ClassicAvgFunction caf = new ClassicAvgFunction();
210211
args.Add("va1");
@@ -232,7 +233,7 @@ public void ClassicAvg()
232233
[Test]
233234
public void ClassicAggregate()
234235
{
235-
IList args = new ArrayList();
236+
IList args = new List<object>();
236237

237238
ClassicAggregateFunction caf = new ClassicAggregateFunction("max", false);
238239
args.Add("va1");
@@ -276,7 +277,7 @@ public void AnsiSubstring()
276277
// <character substring function> ::=
277278
// SUBSTRING <left paren> <character value expression> FROM < start position>
278279
// [ FOR <string length> ] <right paren>
279-
IList args = new ArrayList();
280+
IList args = new List<object>();
280281

281282
AnsiSubstringFunction asf = new AnsiSubstringFunction();
282283
args.Add("var1");

src/NHibernate.Test/Join/JoinCompositeKeyTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using NUnit.Framework;
33
using System;
44
using System.Collections;
5+
using System.Collections.Generic;
56
using System.Data;
67

78
namespace NHibernate.Test.Join
@@ -58,7 +59,7 @@ protected override void OnTearDown()
5859
s = null;
5960
}
6061

61-
private IList objectsNeedDeleting = new ArrayList();
62+
private IList objectsNeedDeleting = new List<object>();
6263

6364
[Test]
6465
public void SimpleSaveAndRetrieve()

src/NHibernate.Test/Stateless/StatelessSessionQueryFixture.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections;
2+
using System.Collections.Generic;
23
using NHibernate.Cfg;
34
using NUnit.Framework;
45

@@ -25,7 +26,7 @@ protected override void Configure(Configuration configuration)
2526

2627
private class TestData
2728
{
28-
internal readonly IList list = new ArrayList();
29+
internal readonly IList list = new List<object>();
2930

3031
private readonly ISessionFactory sessions;
3132

@@ -115,4 +116,4 @@ public void Hql()
115116
testData.cleanData();
116117
}
117118
}
118-
}
119+
}

src/NHibernate.Test/UtilityTest/SequencedHashMapFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public void SetUp()
2929
_shm = new SequencedHashMap();
3030
_emptyShm = new SequencedHashMap();
3131

32-
_expectedKeys = new ArrayList();
32+
_expectedKeys = new List<object>();
3333
_expectedKeys.Add("test1");
3434
_expectedKeys.Add("test2");
3535
_expectedKeys.Add("test3");
3636

37-
_expectedValues = new ArrayList();
37+
_expectedValues = new List<object>();
3838
_expectedValues.Add(1);
3939
_expectedValues.Add("2");
4040
_expectedValues.Add(true);

src/NHibernate/Collection/Generic/PersistentGenericIdentifierBag.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public override bool IsSnapshotEmpty(object snapshot)
157157
public override IEnumerable GetDeletes(ICollectionPersister persister, bool indexIsFormula)
158158
{
159159
var snap = (ISet<SnapshotElement>)GetSnapshot();
160-
ArrayList deletes = new ArrayList(snap.Select(x => x.Id).ToArray());
160+
List<object> deletes = new List<object>(snap.Select(x => x.Id).ToArray());
161161
for (int i = 0; i < _values.Count; i++)
162162
{
163163
if (_values[i] != null)
@@ -517,4 +517,4 @@ public override int GetHashCode()
517517
}
518518
}
519519
}
520-
}
520+
}

0 commit comments

Comments
 (0)