Skip to content

Commit 3be426d

Browse files
committed
Update to Java commit 99819d6 (2025.08.25): CLJ-2917 Iterate - throw when serializing or deserializing.
1 parent e1e23f8 commit 3be426d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Clojure/Clojure/Lib/Iterate.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
**/
1616

1717
using System;
18+
using System.Runtime.Serialization;
1819

1920
namespace clojure.lang
2021
{
2122
public class Iterate : ASeq, IReduce, IPending
2223
{
2324
#region Data
2425

25-
static readonly Object UNREALIZED_SEED = new Object();
26+
static readonly Object UNREALIZED_SEED = new();
2627
readonly IFn _f; // never null
2728
readonly Object _prevSeed;
2829
volatile Object _seed; // lazily realized
@@ -40,7 +41,7 @@ public class Iterate : ASeq, IReduce, IPending
4041
}
4142

4243
private Iterate(IPersistentMap meta, IFn f, Object prevSeed, Object seed, ISeq next)
43-
:base(meta)
44+
: base(meta)
4445
{
4546
_f = f;
4647
_prevSeed = prevSeed;
@@ -54,6 +55,23 @@ public static ISeq create(IFn f, Object seed)
5455
return new Iterate(f, null, seed);
5556
}
5657

58+
#endregion
59+
60+
#region Serialization support
61+
62+
[OnSerializing]
63+
void OnSerializing(StreamingContext context)
64+
{
65+
throw new InvalidOperationException("Serialization of Iterate is not supported");
66+
}
67+
68+
[OnDeserializing]
69+
void OnDeserializing(StreamingContext context)
70+
{
71+
throw new InvalidOperationException("Deserialization of Iterate is not supported");
72+
}
73+
74+
5775
#endregion
5876

5977
#region Object overrides

0 commit comments

Comments
 (0)