Lucene.Net: Made types that are most likely to be used as fields in consumer classes [Serializable]
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ebe46c97 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ebe46c97 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ebe46c97 Branch: refs/heads/master Commit: ebe46c971e4e38243aa51bf6f5f95866e73ff1b9 Parents: 7161262 Author: Shad Storhaug <[email protected]> Authored: Wed Sep 6 18:08:58 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Wed Sep 6 18:08:58 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net/Index/IndexWriterConfig.cs | 3 +++ src/Lucene.Net/Index/LiveIndexWriterConfig.cs | 3 +++ src/Lucene.Net/Support/AtomicBoolean.cs | 7 +++++-- src/Lucene.Net/Support/AtomicInteger.cs | 6 +++++- src/Lucene.Net/Support/AtomicLong.cs | 6 +++++- src/Lucene.Net/Support/AtomicObject.cs | 3 +++ .../Support/Compatibility/ConcurrentDictionary.cs | 10 +++++++++- src/Lucene.Net/Support/Compatibility/SortedSet.cs | 5 ++++- src/Lucene.Net/Support/Document/Field.cs | 18 ++++++++++++++++++ src/Lucene.Net/Support/LinkedHashMap.cs | 3 +++ src/Lucene.Net/Support/WeakDictionary.cs | 3 +++ src/Lucene.Net/Util/CharsRef.cs | 3 +++ src/Lucene.Net/Util/IntsRef.cs | 3 +++ src/Lucene.Net/Util/LongBitSet.cs | 3 +++ src/Lucene.Net/Util/LongsRef.cs | 3 +++ src/Lucene.Net/Util/PriorityQueue.cs | 3 +++ 16 files changed, 76 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Index/IndexWriterConfig.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Index/IndexWriterConfig.cs b/src/Lucene.Net/Index/IndexWriterConfig.cs index 5cd5312..953b6fd 100644 --- a/src/Lucene.Net/Index/IndexWriterConfig.cs +++ b/src/Lucene.Net/Index/IndexWriterConfig.cs @@ -63,6 +63,9 @@ namespace Lucene.Net.Index /// @since 3.1 /// </summary> /// <seealso cref="IndexWriter.Config"/> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public sealed class IndexWriterConfig : LiveIndexWriterConfig { // LUCENENET specific: De-nested OpenMode enum from this class to prevent naming conflict http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Index/LiveIndexWriterConfig.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Index/LiveIndexWriterConfig.cs b/src/Lucene.Net/Index/LiveIndexWriterConfig.cs index 55d4f3f..e42cf30 100644 --- a/src/Lucene.Net/Index/LiveIndexWriterConfig.cs +++ b/src/Lucene.Net/Index/LiveIndexWriterConfig.cs @@ -35,6 +35,9 @@ namespace Lucene.Net.Index /// /// @since 4.0 /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class LiveIndexWriterConfig { private readonly Analyzer analyzer; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/AtomicBoolean.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/AtomicBoolean.cs b/src/Lucene.Net/Support/AtomicBoolean.cs index 163ca4c..bebdcc9 100644 --- a/src/Lucene.Net/Support/AtomicBoolean.cs +++ b/src/Lucene.Net/Support/AtomicBoolean.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System; +using System.Threading; namespace Lucene.Net.Support { @@ -18,7 +19,9 @@ namespace Lucene.Net.Support * See the License for the specific language governing permissions and * limitations under the License. */ - +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class AtomicBoolean { private int value = 0; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/AtomicInteger.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/AtomicInteger.cs b/src/Lucene.Net/Support/AtomicInteger.cs index 90531cb..b3b2cca 100644 --- a/src/Lucene.Net/Support/AtomicInteger.cs +++ b/src/Lucene.Net/Support/AtomicInteger.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System; +using System.Threading; namespace Lucene.Net.Support { @@ -22,6 +23,9 @@ namespace Lucene.Net.Support /// <summary> /// NOTE: This was AtomicInteger in the JDK /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class AtomicInt32 { private int value; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/AtomicLong.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/AtomicLong.cs b/src/Lucene.Net/Support/AtomicLong.cs index 376092f..b74edda 100644 --- a/src/Lucene.Net/Support/AtomicLong.cs +++ b/src/Lucene.Net/Support/AtomicLong.cs @@ -1,4 +1,5 @@ -using System.Threading; +using System; +using System.Threading; namespace Lucene.Net.Support { @@ -22,6 +23,9 @@ namespace Lucene.Net.Support /// <summary> /// NOTE: This was AtomicLong in the JDK /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class AtomicInt64 { private long value; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/AtomicObject.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/AtomicObject.cs b/src/Lucene.Net/Support/AtomicObject.cs index 221b32b..84c8c0d 100644 --- a/src/Lucene.Net/Support/AtomicObject.cs +++ b/src/Lucene.Net/Support/AtomicObject.cs @@ -20,6 +20,9 @@ namespace Lucene.Net.Support * limitations under the License. */ +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class AtomicObject<T> where T : class { private T _value; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/Compatibility/ConcurrentDictionary.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/Compatibility/ConcurrentDictionary.cs b/src/Lucene.Net/Support/Compatibility/ConcurrentDictionary.cs index ffd53ab..58f6dd8 100644 --- a/src/Lucene.Net/Support/Compatibility/ConcurrentDictionary.cs +++ b/src/Lucene.Net/Support/Compatibility/ConcurrentDictionary.cs @@ -17,7 +17,12 @@ #if NET35 -namespace Lucene.Net.Support.Compatibility +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace System.Collections.Concurrent { /// <summary> /// Support class that emulates the behavior of the ConcurrentDictionary @@ -27,6 +32,9 @@ namespace Lucene.Net.Support.Compatibility /// all return a snapshot of the data at the time it was called. /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue> { private readonly object _lockObj = new object(); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/Compatibility/SortedSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/Compatibility/SortedSet.cs b/src/Lucene.Net/Support/Compatibility/SortedSet.cs index 0591662..dbc5d20 100644 --- a/src/Lucene.Net/Support/Compatibility/SortedSet.cs +++ b/src/Lucene.Net/Support/Compatibility/SortedSet.cs @@ -19,7 +19,10 @@ namespace System.Collections.Generic { - + +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class SortedSet<T> : ISet<T>, ICollection { private readonly SortedList<T, byte> _list; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/Document/Field.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/Document/Field.cs b/src/Lucene.Net/Support/Document/Field.cs index 81da67e..b47b98e 100644 --- a/src/Lucene.Net/Support/Document/Field.cs +++ b/src/Lucene.Net/Support/Document/Field.cs @@ -86,6 +86,9 @@ namespace Lucene.Net.Documents public abstract string ToString(string format, IFormatProvider provider); } +#if FEATURE_SERIALIZABLE + [Serializable] +#endif protected sealed class Byte : Number { /// <summary> @@ -139,6 +142,9 @@ namespace Lucene.Net.Documents } } +#if FEATURE_SERIALIZABLE + [Serializable] +#endif protected sealed class Int16 : Number { /// <summary> @@ -197,6 +203,9 @@ namespace Lucene.Net.Documents } } +#if FEATURE_SERIALIZABLE + [Serializable] +#endif protected sealed class Int32 : Number { /// <summary> @@ -250,6 +259,9 @@ namespace Lucene.Net.Documents } } +#if FEATURE_SERIALIZABLE + [Serializable] +#endif protected sealed class Int64 : Number { /// <summary> @@ -303,6 +315,9 @@ namespace Lucene.Net.Documents } } +#if FEATURE_SERIALIZABLE + [Serializable] +#endif protected sealed class Double : Number { /// <summary> @@ -356,6 +371,9 @@ namespace Lucene.Net.Documents } } +#if FEATURE_SERIALIZABLE + [Serializable] +#endif protected sealed class Single : Number { /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/LinkedHashMap.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/LinkedHashMap.cs b/src/Lucene.Net/Support/LinkedHashMap.cs index 211d6ef..e3d9c94 100644 --- a/src/Lucene.Net/Support/LinkedHashMap.cs +++ b/src/Lucene.Net/Support/LinkedHashMap.cs @@ -58,6 +58,9 @@ namespace Lucene.Net.Support /// <item><description><see cref="LurchTable{TKey, TValue}"/> - use when you need to sort by most recent access or most recent update. Works well for LRU caching.</description></item> /// </list> /// </remarks> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public class LinkedHashMap<TKey, TValue> : HashMap<TKey, TValue>, IDictionary<TKey, TValue> { private readonly HashMap<TKey, LinkedListNode<KeyValuePair<TKey, TValue>>> dict; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Support/WeakDictionary.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/WeakDictionary.cs b/src/Lucene.Net/Support/WeakDictionary.cs index c8b07de1..e2f3a07 100644 --- a/src/Lucene.Net/Support/WeakDictionary.cs +++ b/src/Lucene.Net/Support/WeakDictionary.cs @@ -26,6 +26,9 @@ using System.Linq; namespace Lucene.Net.Support { +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public sealed class WeakDictionary<TKey, TValue> : IDictionary<TKey, TValue> where TKey : class { private HashMap<WeakKey<TKey>, TValue> _hm; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Util/CharsRef.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/CharsRef.cs b/src/Lucene.Net/Util/CharsRef.cs index 36fef16..432d53f 100644 --- a/src/Lucene.Net/Util/CharsRef.cs +++ b/src/Lucene.Net/Util/CharsRef.cs @@ -30,6 +30,9 @@ namespace Lucene.Net.Util /// <para/> /// @lucene.internal /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public sealed class CharsRef : IComparable<CharsRef>, ICharSequence { /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Util/IntsRef.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/IntsRef.cs b/src/Lucene.Net/Util/IntsRef.cs index b0c67d9..9a37b34 100644 --- a/src/Lucene.Net/Util/IntsRef.cs +++ b/src/Lucene.Net/Util/IntsRef.cs @@ -32,6 +32,9 @@ namespace Lucene.Net.Util /// <para/> /// @lucene.internal /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public sealed class Int32sRef : IComparable<Int32sRef> { /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Util/LongBitSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/LongBitSet.cs b/src/Lucene.Net/Util/LongBitSet.cs index 96da788..f1d6644 100644 --- a/src/Lucene.Net/Util/LongBitSet.cs +++ b/src/Lucene.Net/Util/LongBitSet.cs @@ -30,6 +30,9 @@ namespace Lucene.Net.Util /// <para/> /// @lucene.internal /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public sealed class Int64BitSet { private readonly long[] bits; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Util/LongsRef.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/LongsRef.cs b/src/Lucene.Net/Util/LongsRef.cs index 429f162..f5a0c4f 100644 --- a/src/Lucene.Net/Util/LongsRef.cs +++ b/src/Lucene.Net/Util/LongsRef.cs @@ -32,6 +32,9 @@ namespace Lucene.Net.Util /// <para/> /// @lucene.internal /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public sealed class Int64sRef : IComparable<Int64sRef> { /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ebe46c97/src/Lucene.Net/Util/PriorityQueue.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/PriorityQueue.cs b/src/Lucene.Net/Util/PriorityQueue.cs index 6b5e4ed..36d5be5 100644 --- a/src/Lucene.Net/Util/PriorityQueue.cs +++ b/src/Lucene.Net/Util/PriorityQueue.cs @@ -35,6 +35,9 @@ namespace Lucene.Net.Util /// <para/> /// @lucene.internal /// </summary> +#if FEATURE_SERIALIZABLE + [Serializable] +#endif public abstract class PriorityQueue<T> { private int size = 0;
