You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2022/11/09 17:35:35 UTC

[lucenenet] branch master updated (3a1ced448 -> e27faab50)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git


    from 3a1ced448 BREAKING: Lucene.Net.Index.IndexReader: De-nested IReaderClosedListener and renamed to IReaderDisposedListener.
     new 694b51846 PERFORMANCE: Lucene.Net.Analysis.Sinks.DateRecognizerSinkFilter: Prefer ReadOnlySpan<char> overloads of DateTime.TryParse() and DateTime.TryParseExact(), when available.
     new 76004096b BUG: Changed TokenAttribute usage from concrete implementation type to interface type to align with Lucene 4.8.0. We were using the concrete type in several places where it shouldn't have been.
     new d813d2c3d SWEEP: Renamed concrete TokenAttribute type file names to be suffixed with "Impl" so the file it was ported from is clear.
     new 97c252784 SWEEP: Renamed interface TokenAttribute type file names removing the prefix "I" so the file it was ported from is clear.
     new 98825e468 SWEEP: Added guard clauses for all TokenAttribute members
     new e27faab50 BREAKING: Lucene.Net.Analysis.Kuromoji.Token: Renamed IsKnown() > IsKnown, IsUnknown() > IsUnknown, IsUser() > IsUser.

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../Analysis/Ar/ArabicStemFilter.cs                |   4 +-
 .../Analysis/Bg/BulgarianStemFilter.cs             |   4 +-
 .../Analysis/Br/BrazilianStemFilter.cs             |   4 +-
 .../Analysis/Ckb/SoraniStemFilter.cs               |   4 +-
 .../Analysis/CommonGrams/CommonGramsFilter.cs      |   4 +-
 .../Analysis/Cz/CzechStemFilter.cs                 |   4 +-
 .../Analysis/De/GermanLightStemFilter.cs           |   4 +-
 .../Analysis/De/GermanMinimalStemFilter.cs         |   4 +-
 .../Analysis/De/GermanStemFilter.cs                |   4 +-
 .../Analysis/El/GreekStemFilter.cs                 |   4 +-
 .../Analysis/En/EnglishMinimalStemFilter.cs        |   4 +-
 .../Analysis/En/KStemFilter.cs                     |   6 +-
 .../Analysis/En/PorterStemFilter.cs                |   6 +-
 .../Analysis/Es/SpanishLightStemFilter.cs          |   4 +-
 .../Analysis/Fa/PersianStemFilter.cs               |   2 +-
 .../Analysis/Fi/FinnishLightStemFilter.cs          |   4 +-
 .../Analysis/Fr/FrenchLightStemFilter.cs           |   4 +-
 .../Analysis/Fr/FrenchMinimalStemFilter.cs         |   4 +-
 .../Analysis/Fr/FrenchStemFilter.cs                |   4 +-
 .../Analysis/Gl/GalicianMinimalStemFilter.cs       |   4 +-
 .../Analysis/Gl/GalicianStemFilter.cs              |   4 +-
 .../Analysis/Hi/HindiNormalizationFilter.cs        |   4 +-
 .../Analysis/Hu/HungarianLightStemFilter.cs        |   4 +-
 .../Analysis/Hunspell/HunspellStemFilter.cs        |   4 +-
 .../Analysis/It/ItalianLightStemFilter.cs          |   4 +-
 .../Analysis/Lv/LatvianStemFilter.cs               |   4 +-
 .../Analysis/Miscellaneous/CodepointCountFilter.cs |   2 +-
 .../Analysis/Miscellaneous/KeywordMarkerFilter.cs  |   6 +-
 .../Analysis/Miscellaneous/KeywordRepeatFilter.cs  |   6 +-
 .../Analysis/Miscellaneous/LengthFilter.cs         |   2 +-
 .../Miscellaneous/PatternKeywordMarkerFilter.cs    |   8 +-
 .../Miscellaneous/SetKeywordMarkerFilter.cs        |   8 +-
 .../Miscellaneous/StemmerOverrideFilter.cs         |   4 +-
 .../Analysis/NGram/NGramTokenFilter.cs             |  18 +-
 .../Analysis/Nl/DutchStemFilter.cs                 |   4 +-
 .../Analysis/No/NorwegianLightStemFilter.cs        |   4 +-
 .../Analysis/No/NorwegianMinimalStemFilter.cs      |   4 +-
 .../Payloads/TokenOffsetPayloadTokenFilter.cs      |   6 +-
 .../Analysis/Pt/PortugueseLightStemFilter.cs       |   4 +-
 .../Analysis/Pt/PortugueseMinimalStemFilter.cs     |   4 +-
 .../Analysis/Pt/PortugueseStemFilter.cs            |   4 +-
 .../Analysis/Ru/RussianLightStemFilter.cs          |   4 +-
 .../Analysis/Sinks/DateRecognizerSinkFilter.cs     |  25 +-
 .../Analysis/Snowball/SnowballFilter.cs            |   4 +-
 .../Analysis/Standard/StandardTokenizerImpl.cs     |   4 +-
 .../Standard/Std31/UAX29URLEmailTokenizerImpl31.cs |   4 +-
 .../Analysis/Sv/SwedishLightStemFilter.cs          |   4 +-
 .../Analysis/Util/ElisionFilter.cs                 |   4 +-
 .../Icu/TokenAttributes/ScriptAttributeImpl.cs     |  14 +-
 src/Lucene.Net.Analysis.Kuromoji/Token.cs          |  15 +-
 .../TokenAttributes/BaseFormAttributeImpl.cs       |  14 +-
 .../TokenAttributes/InflectionAttributeImpl.cs     |  14 +-
 .../TokenAttributes/PartOfSpeechAttributeImpl.cs   |  14 +-
 .../TokenAttributes/ReadingAttributeImpl.cs        |  14 +-
 .../IMorphosyntacticTagsAttribute.cs               |  44 --
 .../MorphosyntacticTagsAttribute.cs                |  84 +--
 ...bute.cs => MorphosyntacticTagsAttributeImpl.cs} |  18 +-
 .../OpenNLPChunkerFilter.cs                        |   2 +-
 .../Pulsing/PulsingPostingsReader.cs               |   2 +-
 .../Analysis/BaseTokenStreamTestCase.cs            |  23 +-
 .../Analysis/CannedBinaryTokenStream.cs            |  12 +-
 .../Analysis/ValidatingTokenFilter.cs              |  18 +-
 .../Index/BaseTermVectorsFormatTestCase.cs         |   4 +-
 .../Analysis/Synonym/TestSynonymMapFilter.cs       |   2 +-
 src/Lucene.Net.Tests/Index/Test2BPostingsBytes.cs  |   2 +-
 src/Lucene.Net.Tests/Index/Test2BTerms.cs          |   2 +-
 src/Lucene.Net.Tests/Index/TestPayloads.cs         |  10 +-
 src/Lucene.Net/Analysis/NumericTokenStream.cs      |  14 +-
 src/Lucene.Net/Analysis/Token.cs                   |   2 +-
 .../Analysis/TokenAttributes/CharTermAttribute.cs  | 684 +++++++--------------
 ...arTermAttribute.cs => CharTermAttributeImpl.cs} |  76 ++-
 .../Analysis/TokenAttributes/FlagsAttribute.cs     |  64 +-
 .../{FlagsAttribute.cs => FlagsAttributeImpl.cs}   |  15 +-
 .../Analysis/TokenAttributes/ICharTermAttribute.cs | 288 ---------
 .../Analysis/TokenAttributes/IFlagsAttribute.cs    |  40 --
 .../Analysis/TokenAttributes/IKeywordAttribute.cs  |  37 --
 .../Analysis/TokenAttributes/IOffsetAttribute.cs   |  57 --
 .../Analysis/TokenAttributes/IPayloadAttribute.cs  |  45 --
 .../TokenAttributes/IPositionIncrementAttribute.cs |  57 --
 .../TokenAttributes/IPositionLengthAttribute.cs    |  46 --
 .../Analysis/TokenAttributes/ITypeAttribute.cs     |  45 --
 .../Analysis/TokenAttributes/KeywordAttribute.cs   |  60 +-
 ...KeywordAttribute.cs => KeywordAttributeImpl.cs} |  15 +-
 .../Analysis/TokenAttributes/OffsetAttribute.cs    |  98 +--
 .../{OffsetAttribute.cs => OffsetAttributeImpl.cs} |   8 +-
 .../Analysis/TokenAttributes/PayloadAttribute.cs   |  90 +--
 ...PayloadAttribute.cs => PayloadAttributeImpl.cs} |  18 +-
 .../TokenAttributes/PositionIncrementAttribute.cs  |  88 +--
 ...ribute.cs => PositionIncrementAttributeImpl.cs} |   8 +-
 .../TokenAttributes/PositionLengthAttribute.cs     |  77 +--
 ...Attribute.cs => PositionLengthAttributeImpl.cs} |   8 +-
 ...sRefAttribute.cs => TermToBytesRefAttribute.cs} |   4 +-
 .../Analysis/TokenAttributes/TypeAttribute.cs      |  73 +--
 .../{TypeAttribute.cs => TypeAttributeImpl.cs}     |  13 +-
 src/Lucene.Net/Codecs/TermVectorsReader.cs         |   4 +-
 src/Lucene.Net/Search/BoostAttributeImpl.cs        |  16 +-
 src/Lucene.Net/Search/FuzzyTermsEnum.cs            |   9 +-
 .../Search/MaxNonCompetitiveBoostAttributeImpl.cs  |   8 +-
 src/Lucene.Net/Util/Attribute.cs                   |   4 +-
 src/Lucene.Net/Util/AttributeImpl.cs               |   2 +-
 src/Lucene.Net/Util/AttributeReflector.cs          |   7 +-
 101 files changed, 800 insertions(+), 1827 deletions(-)
 delete mode 100644 src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/IMorphosyntacticTagsAttribute.cs
 copy src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/{MorphosyntacticTagsAttribute.cs => MorphosyntacticTagsAttributeImpl.cs} (80%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{CharTermAttribute.cs => CharTermAttributeImpl.cs} (82%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{FlagsAttribute.cs => FlagsAttributeImpl.cs} (77%)
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/IKeywordAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/IOffsetAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/IPayloadAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/IPositionIncrementAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/IPositionLengthAttribute.cs
 delete mode 100644 src/Lucene.Net/Analysis/TokenAttributes/ITypeAttribute.cs
 copy src/Lucene.Net/Analysis/TokenAttributes/{KeywordAttribute.cs => KeywordAttributeImpl.cs} (77%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{OffsetAttribute.cs => OffsetAttributeImpl.cs} (86%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{PayloadAttribute.cs => PayloadAttributeImpl.cs} (81%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{PositionIncrementAttribute.cs => PositionIncrementAttributeImpl.cs} (83%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{PositionLengthAttribute.cs => PositionLengthAttributeImpl.cs} (83%)
 rename src/Lucene.Net/Analysis/TokenAttributes/{ITermToBytesRefAttribute.cs => TermToBytesRefAttribute.cs} (97%)
 copy src/Lucene.Net/Analysis/TokenAttributes/{TypeAttribute.cs => TypeAttributeImpl.cs} (88%)


[lucenenet] 04/06: SWEEP: Renamed interface TokenAttribute type file names removing the prefix "I" so the file it was ported from is clear.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 97c25278489f7459d5d52ae69dced55add0a2734
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 9 21:47:12 2022 +0700

    SWEEP: Renamed interface TokenAttribute type file names removing the prefix "I" so the file it was ported from is clear.
---
 .../{IMorphosyntacticTagsAttribute.cs => MorphosyntacticTagsAttribute.cs} | 0
 .../TokenAttributes/{ICharTermAttribute.cs => CharTermAttribute.cs}       | 0
 .../Analysis/TokenAttributes/{IFlagsAttribute.cs => FlagsAttribute.cs}    | 0
 .../TokenAttributes/{IKeywordAttribute.cs => KeywordAttribute.cs}         | 0
 .../Analysis/TokenAttributes/{IOffsetAttribute.cs => OffsetAttribute.cs}  | 0
 .../TokenAttributes/{IPayloadAttribute.cs => PayloadAttribute.cs}         | 0
 .../{IPositionIncrementAttribute.cs => PositionIncrementAttribute.cs}     | 0
 .../{IPositionLengthAttribute.cs => PositionLengthAttribute.cs}           | 0
 .../{ITermToBytesRefAttribute.cs => TermToBytesRefAttribute.cs}           | 0
 .../Analysis/TokenAttributes/{ITypeAttribute.cs => TypeAttribute.cs}      | 0
 10 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/IMorphosyntacticTagsAttribute.cs b/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs
similarity index 100%
rename from src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/IMorphosyntacticTagsAttribute.cs
rename to src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IKeywordAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/IKeywordAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IOffsetAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/IOffsetAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IPayloadAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/IPayloadAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IPositionIncrementAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/IPositionIncrementAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IPositionLengthAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/IPositionLengthAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/ITermToBytesRefAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/TermToBytesRefAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/ITermToBytesRefAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/TermToBytesRefAttribute.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/ITypeAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/ITypeAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs


[lucenenet] 05/06: SWEEP: Added guard clauses for all TokenAttribute members

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 98825e468b25cb9a5c0a7e463f2f8e63c1dc5769
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 9 23:44:05 2022 +0700

    SWEEP: Added guard clauses for all TokenAttribute members
---
 .../Icu/TokenAttributes/ScriptAttributeImpl.cs     | 12 +++-
 .../TokenAttributes/BaseFormAttributeImpl.cs       | 12 +++-
 .../TokenAttributes/InflectionAttributeImpl.cs     | 12 +++-
 .../TokenAttributes/PartOfSpeechAttributeImpl.cs   | 12 +++-
 .../TokenAttributes/ReadingAttributeImpl.cs        | 12 +++-
 .../MorphosyntacticTagsAttributeImpl.cs            | 14 +++-
 .../Analysis/BaseTokenStreamTestCase.cs            |  7 +-
 .../Analysis/CannedBinaryTokenStream.cs            |  6 +-
 src/Lucene.Net/Analysis/NumericTokenStream.cs      | 10 ++-
 .../TokenAttributes/CharTermAttributeImpl.cs       | 74 +++++++++++++++-------
 .../Analysis/TokenAttributes/FlagsAttributeImpl.cs |  8 ++-
 .../TokenAttributes/KeywordAttributeImpl.cs        |  8 ++-
 .../TokenAttributes/OffsetAttributeImpl.cs         |  6 +-
 .../TokenAttributes/PayloadAttributeImpl.cs        |  8 ++-
 .../PositionIncrementAttributeImpl.cs              |  6 +-
 .../TokenAttributes/PositionLengthAttributeImpl.cs |  6 +-
 src/Lucene.Net/Search/BoostAttributeImpl.cs        |  9 ++-
 src/Lucene.Net/Search/FuzzyTermsEnum.cs            |  7 +-
 .../Search/MaxNonCompetitiveBoostAttributeImpl.cs  |  6 +-
 19 files changed, 195 insertions(+), 40 deletions(-)

diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs
index 383ebe55d..97f4a56c9 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs
@@ -1,6 +1,8 @@
 using ICU4N.Globalization;
 using Lucene.Net.Support;
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.Icu.TokenAttributes
 {
@@ -58,7 +60,11 @@ namespace Lucene.Net.Analysis.Icu.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IScriptAttribute t = (IScriptAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IScriptAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IScriptAttribute)}", nameof(target));
             t.Code = code;
         }
 
@@ -84,6 +90,10 @@ namespace Lucene.Net.Analysis.Icu.TokenAttributes
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             // when wordbreaking CJK, we use the 15924 code Japanese (Han+Hiragana+Katakana) to 
             // mark runs of Chinese/Japanese. our use is correct (as for chinese Han is a subset), 
             // but this is just to help prevent confusion.
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs
index 187896418..f1a89d511 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs
@@ -1,4 +1,6 @@
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.Ja.TokenAttributes
 {
@@ -43,12 +45,20 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IBaseFormAttribute t = (IBaseFormAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IBaseFormAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IBaseFormAttribute)}", nameof(target));
             t.SetToken(token);
         }
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             reflector.Reflect(typeof(BaseFormAttribute), "baseForm", GetBaseForm());
         }
     }
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs
index a70e8923a..10162ebb9 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs
@@ -1,5 +1,7 @@
 using Lucene.Net.Analysis.Ja.Util;
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.Ja.TokenAttributes
 {
@@ -49,12 +51,20 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IInflectionAttribute t = (IInflectionAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IInflectionAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IInflectionAttribute)}", nameof(target));
             t.SetToken(token);
         }
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             string type = GetInflectionType();
             string typeEN = type is null ? null : ToStringUtil.GetInflectionTypeTranslation(type);
             reflector.Reflect<IInflectionAttribute>("inflectionType", type);
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs
index e5e866413..31d1564f0 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs
@@ -1,5 +1,7 @@
 using Lucene.Net.Analysis.Ja.Util;
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.Ja.TokenAttributes
 {
@@ -44,12 +46,20 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IPartOfSpeechAttribute t = (IPartOfSpeechAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IPartOfSpeechAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IPartOfSpeechAttribute)}", nameof(target));
             t.SetToken(token);
         }
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             string partOfSpeech = GetPartOfSpeech();
             string partOfSpeechEN = partOfSpeech is null ? null : ToStringUtil.GetPOSTranslation(partOfSpeech);
             reflector.Reflect<IPartOfSpeechAttribute>("partOfSpeech", partOfSpeech);
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs
index b0145efbd..ac298898b 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs
@@ -1,5 +1,7 @@
 using Lucene.Net.Analysis.Ja.Util;
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.Ja.TokenAttributes
 {
@@ -49,12 +51,20 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IReadingAttribute t = (IReadingAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IReadingAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IReadingAttribute)}", nameof(target));
             t.SetToken(token);
         }
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             string reading = GetReading();
             string readingEN = reading is null ? null : ToStringUtil.GetRomanization(reading);
             string pronunciation = GetPronunciation();
diff --git a/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttributeImpl.cs b/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttributeImpl.cs
index 22841878f..50dea885c 100644
--- a/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttributeImpl.cs
@@ -1,7 +1,9 @@
 // Lucene version compatibility level 8.2.0
 using Lucene.Net.Util;
+using System;
 using System.Collections.Generic;
 using System.Text;
+using Attribute = Lucene.Net.Util.Attribute;
 using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.Analysis.Morfologik.TokenAttributes
@@ -77,6 +79,12 @@ namespace Lucene.Net.Analysis.Morfologik.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IMorphosyntacticTagsAttribute other)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IMorphosyntacticTagsAttribute)}", nameof(target));
+
             IList<StringBuilder> cloned = null;
             if (tags != null)
             {
@@ -86,7 +94,7 @@ namespace Lucene.Net.Analysis.Morfologik.TokenAttributes
                     cloned.Add(new StringBuilder(b.ToString()));
                 }
             }
-            ((IMorphosyntacticTagsAttribute)target).Tags = cloned;
+            other.Tags = cloned;
         }
 
         public override object Clone()
@@ -98,6 +106,10 @@ namespace Lucene.Net.Analysis.Morfologik.TokenAttributes
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             reflector.Reflect(typeof(IMorphosyntacticTagsAttribute), "tags", tags);
         }
     }
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index 55ed2e47f..5e331ab5a 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -81,7 +81,12 @@ namespace Lucene.Net.Analysis
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            ((CheckClearAttributesAttribute)target).Clear();
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not CheckClearAttributesAttribute other)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must subclass {nameof(CheckClearAttributesAttribute)}", nameof(target));
+            other.Clear();
         }
     }
 
diff --git a/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs b/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs
index 55895d202..10e6a80ab 100644
--- a/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs
@@ -92,7 +92,11 @@ namespace Lucene.Net.Analysis
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IBinaryTermAttribute other = (IBinaryTermAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IBinaryTermAttribute other)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IBinaryTermAttribute)}", nameof(target));
             other.BytesRef.CopyBytes(bytes);
         }
 
diff --git a/src/Lucene.Net/Analysis/NumericTokenStream.cs b/src/Lucene.Net/Analysis/NumericTokenStream.cs
index 2eb79b8b7..ff74dd295 100644
--- a/src/Lucene.Net/Analysis/NumericTokenStream.cs
+++ b/src/Lucene.Net/Analysis/NumericTokenStream.cs
@@ -216,6 +216,10 @@ namespace Lucene.Net.Analysis
 
             public override void ReflectWith(IAttributeReflector reflector)
             {
+                // LUCENENET: Added guard clause
+                if (reflector is null)
+                    throw new ArgumentNullException(nameof(reflector));
+
                 FillBytesRef();
                 reflector.Reflect(typeof(ITermToBytesRefAttribute), "bytes", BytesRef.DeepCopyOf(_bytes));
                 reflector.Reflect(typeof(INumericTermAttribute), "shift", Shift);
@@ -225,7 +229,11 @@ namespace Lucene.Net.Analysis
 
             public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
             {
-                var a = (INumericTermAttribute)target;
+                // LUCENENET: Added guard clauses
+                if (target is null)
+                    throw new ArgumentNullException(nameof(target));
+                if (target is not INumericTermAttribute a)
+                    throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(INumericTermAttribute)}", nameof(target));
                 a.Init(_value, ValueSize, _precisionStep, Shift);
             }
         }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttributeImpl.cs
index 824f1c84a..44c5e21d5 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttributeImpl.cs
@@ -51,6 +51,18 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public void CopyBuffer(char[] buffer, int offset, int length)
         {
+            // LUCENENET: Added guard clauses.
+            // Note that this is the order the Apache Harmony tests expect it to be checked in.
+            if (offset < 0)
+                throw new ArgumentOutOfRangeException(nameof(offset), offset, $"{nameof(offset)} must not be negative.");
+            // LUCENENET specific - Added guard clause for null
+            if (buffer is null)
+                throw new ArgumentNullException(nameof(buffer));
+            if (offset > buffer.Length - length) // LUCENENET: Checks for int overflow
+                throw new ArgumentOutOfRangeException(nameof(length), $"{nameof(offset)} + {nameof(length)} may not be greater than the size of {nameof(buffer)}");
+            if (length < 0)
+                throw new ArgumentOutOfRangeException(nameof(length), length, $"{nameof(length)} must not be negative.");
+
             GrowTermBuffer(length);
             Array.Copy(buffer, offset, termBuffer, 0, length);
             termLength = length;
@@ -64,6 +76,10 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public char[] ResizeBuffer(int newSize)
         {
+            // LUCENENET: added guard clause
+            if (newSize < 0)
+                throw new ArgumentOutOfRangeException(nameof(newSize), newSize, $"{nameof(newSize)} must not be negative.");
+
             if (termBuffer.Length < newSize)
             {
                 // Not big enough; create a new array with slight
@@ -77,6 +93,10 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         private void GrowTermBuffer(int newSize)
         {
+            // LUCENENET: added guard clause
+            if (newSize < 0)
+                throw new ArgumentOutOfRangeException(nameof(newSize), newSize, $"{nameof(newSize)} must not be negative.");
+
             if (termBuffer.Length < newSize)
             {
                 // Not big enough; create a new array with slight
@@ -97,10 +117,12 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public CharTermAttribute SetLength(int length)
         {
+            // LUCENENET: added guard clause
+            if (length < 0)
+                throw new ArgumentOutOfRangeException(nameof(length), length, $"{nameof(length)} must not be negative.");
             if (length > termBuffer.Length)
-            {
-                throw new ArgumentException("length " + length + " exceeds the size of the termBuffer (" + termBuffer.Length + ")");
-            }
+                throw new ArgumentOutOfRangeException(nameof(length), length, "length " + length + " exceeds the size of the termBuffer (" + termBuffer.Length + ")");
+
             termLength = length;
             return this;
         }
@@ -160,9 +182,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
                 return new CharArrayCharSequence(termBuffer);
             }
             if (startIndex < 0)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} must not be negative.");
             if (length < 0)
-                throw new ArgumentOutOfRangeException(nameof(length));
+                throw new ArgumentOutOfRangeException(nameof(length), $"{nameof(length)} must not be negative.");
             if (startIndex > Length - length) // Checks for int overflow
                 throw new ArgumentOutOfRangeException(nameof(length), $"Index and length must refer to a location within the string. For example {nameof(startIndex)} + {nameof(length)} <= {nameof(Length)}.");
 
@@ -180,9 +202,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
         {
             // LUCENENET: Changed semantics to be the same as the StringBuilder in .NET
             if (startIndex < 0)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} must not be negative.");
             if (charCount < 0)
-                throw new ArgumentOutOfRangeException(nameof(charCount));
+                throw new ArgumentOutOfRangeException(nameof(charCount), $"{nameof(charCount)} must not be negative.");
 
             if (value is null)
             {
@@ -193,7 +215,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
             if (charCount == 0)
                 return this;
             if (startIndex > value.Length - charCount)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"Index and length must refer to a location within the string. For example {nameof(startIndex)} + {nameof(charCount)} <= {nameof(Length)}.");
 
             value.CopyTo(startIndex, InternalResizeBuffer(termLength + charCount), termLength, charCount);
             Length += charCount;
@@ -224,9 +246,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
         {
             // LUCENENET: Changed semantics to be the same as the StringBuilder in .NET
             if (startIndex < 0)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} must not be negative.");
             if (charCount < 0)
-                throw new ArgumentOutOfRangeException(nameof(charCount));
+                throw new ArgumentOutOfRangeException(nameof(charCount), $"{nameof(charCount)} must not be negative.");
 
             if (value is null)
             {
@@ -237,7 +259,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
             if (charCount == 0)
                 return this;
             if (startIndex > value.Length - charCount)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"Index and length must refer to a location within the string. For example {nameof(startIndex)} + {nameof(charCount)} <= {nameof(Length)}.");
 
             Array.Copy(value, startIndex, InternalResizeBuffer(termLength + charCount), termLength, charCount);
             Length += charCount;
@@ -247,7 +269,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public CharTermAttribute Append(string value)
         {
-            return Append(value, 0, value is null ? 0 : value.Length);
+            return Append(value, 0, value?.Length ?? 0);
         }
 
         public CharTermAttribute Append(StringBuilder value)
@@ -265,9 +287,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
         {
             // LUCENENET: Changed semantics to be the same as the StringBuilder in .NET
             if (startIndex < 0)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} must not be negative.");
             if (charCount < 0)
-                throw new ArgumentOutOfRangeException(nameof(charCount));
+                throw new ArgumentOutOfRangeException(nameof(charCount), $"{nameof(charCount)} must not be negative.");
 
             if (value is null)
             {
@@ -278,7 +300,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
             if (charCount == 0)
                 return this;
             if (startIndex > value.Length - charCount)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"Index and length must refer to a location within the string. For example {nameof(startIndex)} + {nameof(charCount)} <= {nameof(Length)}.");
 
             return Append(value.ToString(startIndex, charCount));
         }
@@ -309,9 +331,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
         {
             // LUCENENET: Changed semantics to be the same as the StringBuilder in .NET
             if (startIndex < 0)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"{nameof(startIndex)} must not be negative.");
             if (charCount < 0)
-                throw new ArgumentOutOfRangeException(nameof(charCount));
+                throw new ArgumentOutOfRangeException(nameof(charCount), $"{nameof(charCount)} must not be negative.");
 
             if (value is null)
             {
@@ -322,7 +344,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
             if (charCount == 0)
                 return this;
             if (startIndex > value.Length - charCount)
-                throw new ArgumentOutOfRangeException(nameof(startIndex));
+                throw new ArgumentOutOfRangeException(nameof(startIndex), $"Index and length must refer to a location within the string. For example {nameof(startIndex)} + {nameof(charCount)} <= {nameof(Length)}.");
 
             ResizeBuffer(termLength + charCount);
 
@@ -387,9 +409,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
         public override bool Equals(object other)
         {
             if (other == this)
-            {
                 return true;
-            }
+            if (other is null) // LUCENENET: Added null check for better performance
+                return false;
 
             if (other is CharTermAttribute o)
             {
@@ -418,7 +440,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
         /// before it returned a String representation of the whole
         /// term with all attributes.
         /// this affects especially the
-        /// <see cref="Lucene.Net.Analysis.Token"/> subclass.
+        /// <see cref="Token"/> subclass.
         /// </summary>
         public override string ToString()
         {
@@ -427,6 +449,10 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
+            // LUCENENET: Added guard clause
+            if (reflector is null)
+                throw new ArgumentNullException(nameof(reflector));
+
             reflector.Reflect(typeof(ICharTermAttribute), "term", ToString());
             FillBytesRef();
             reflector.Reflect(typeof(ITermToBytesRefAttribute), "bytes", BytesRef.DeepCopyOf(bytes));
@@ -434,7 +460,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            ICharTermAttribute t = (ICharTermAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not ICharTermAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(ICharTermAttribute)}", nameof(target));
             t.CopyBuffer(termBuffer, 0, termLength);
         }
 
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttributeImpl.cs
index 933fe9f76..2f9844b6f 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttributeImpl.cs
@@ -1,4 +1,6 @@
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -64,7 +66,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IFlagsAttribute t = (IFlagsAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IFlagsAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IFlagsAttribute)}", nameof(target));
             t.Flags = flags;
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttributeImpl.cs
index 31a41b054..0e88bf6f2 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttributeImpl.cs
@@ -1,4 +1,6 @@
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -38,7 +40,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IKeywordAttribute attr = (IKeywordAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IKeywordAttribute attr)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IKeywordAttribute)}", nameof(target));
             attr.IsKeyword = keyword;
         }
 
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttributeImpl.cs
index 9646ed757..4a16d3181 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttributeImpl.cs
@@ -88,7 +88,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IOffsetAttribute t = (IOffsetAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IOffsetAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IOffsetAttribute)}", nameof(target));
             t.SetOffset(startOffset, endOffset);
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttributeImpl.cs
index d367115cd..4ff8091f2 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttributeImpl.cs
@@ -1,4 +1,6 @@
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -88,7 +90,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IPayloadAttribute t = (IPayloadAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IPayloadAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IPayloadAttribute)}", nameof(target));
             t.Payload = (payload is null) ? null : (BytesRef)payload.Clone();
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttributeImpl.cs
index 6916c8a18..a6933c864 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttributeImpl.cs
@@ -74,7 +74,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IPositionIncrementAttribute t = (IPositionIncrementAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IPositionIncrementAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IPositionIncrementAttribute)}", nameof(target));
             t.PositionIncrement = positionIncrement;
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttributeImpl.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttributeImpl.cs
index 3eff86c5a..8793789b4 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttributeImpl.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttributeImpl.cs
@@ -74,7 +74,11 @@ namespace Lucene.Net.Analysis.TokenAttributes
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IPositionLengthAttribute t = (IPositionLengthAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IPositionLengthAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IPositionLengthAttribute)}", nameof(target));
             t.PositionLength = positionLength;
         }
     }
diff --git a/src/Lucene.Net/Search/BoostAttributeImpl.cs b/src/Lucene.Net/Search/BoostAttributeImpl.cs
index bfe7e622e..f9129e6f2 100644
--- a/src/Lucene.Net/Search/BoostAttributeImpl.cs
+++ b/src/Lucene.Net/Search/BoostAttributeImpl.cs
@@ -1,4 +1,6 @@
 using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Search
 {
@@ -44,7 +46,12 @@ namespace Lucene.Net.Search
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            ((IBoostAttribute)target).Boost = boost;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IBoostAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IBoostAttribute)}", nameof(target));
+            t.Boost = boost;
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net/Search/FuzzyTermsEnum.cs b/src/Lucene.Net/Search/FuzzyTermsEnum.cs
index 88c7ea778..dc16ea168 100644
--- a/src/Lucene.Net/Search/FuzzyTermsEnum.cs
+++ b/src/Lucene.Net/Search/FuzzyTermsEnum.cs
@@ -496,7 +496,12 @@ namespace Lucene.Net.Search
 
             public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
             {
-                IList<CompiledAutomaton> targetAutomata = ((ILevenshteinAutomataAttribute)target).Automata;
+                // LUCENENET: Added guard clauses
+                if (target is null)
+                    throw new ArgumentNullException(nameof(target));
+                if (target is not ILevenshteinAutomataAttribute t)
+                    throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(ILevenshteinAutomataAttribute)}", nameof(target));
+                IList<CompiledAutomaton> targetAutomata = t.Automata;
                 targetAutomata.Clear();
                 targetAutomata.AddRange(automata);
             }
diff --git a/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs b/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs
index 6ee48c612..70b5a7ddf 100644
--- a/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs
+++ b/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs
@@ -53,7 +53,11 @@ namespace Lucene.Net.Search
 
         public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            IMaxNonCompetitiveBoostAttribute t = (IMaxNonCompetitiveBoostAttribute)target;
+            // LUCENENET: Added guard clauses
+            if (target is null)
+                throw new ArgumentNullException(nameof(target));
+            if (target is not IMaxNonCompetitiveBoostAttribute t)
+                throw new ArgumentException($"Argument type {target.GetType().FullName} must implement {nameof(IMaxNonCompetitiveBoostAttribute)}", nameof(target));
             t.MaxNonCompetitiveBoost = maxNonCompetitiveBoost;
             t.CompetitiveTerm = competitiveTerm;
         }


[lucenenet] 01/06: PERFORMANCE: Lucene.Net.Analysis.Sinks.DateRecognizerSinkFilter: Prefer ReadOnlySpan overloads of DateTime.TryParse() and DateTime.TryParseExact(), when available.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 694b5184617cd1dcbdd111375d21083be252a521
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 9 21:11:04 2022 +0700

    PERFORMANCE: Lucene.Net.Analysis.Sinks.DateRecognizerSinkFilter: Prefer ReadOnlySpan<char> overloads of DateTime.TryParse() and DateTime.TryParseExact(), when available.
---
 .../Analysis/Sinks/DateRecognizerSinkFilter.cs     | 25 ++++++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs
index ccf2900b1..edc59c276 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Sinks/DateRecognizerSinkFilter.cs
@@ -24,7 +24,7 @@ namespace Lucene.Net.Analysis.Sinks
      */
 
     /// <summary>
-    /// Attempts to parse the <see cref="CharTermAttribute.ToString()"/> as a Date using either the 
+    /// Attempts to parse the <see cref="ICharTermAttribute.Buffer"/> as a Date using either the 
     /// <see cref="DateTime.TryParse(string, IFormatProvider, DateTimeStyles, out DateTime)"/> or 
     /// <see cref="DateTime.TryParseExact(string, string[], IFormatProvider, DateTimeStyles, out DateTime)"/> methods.
     /// If a format is passed, <see cref="DateTime.TryParseExact(string, string[], IFormatProvider, DateTimeStyles, out DateTime)"/> 
@@ -59,7 +59,7 @@ namespace Lucene.Net.Analysis.Sinks
         /// Creates a new instance of <see cref="DateRecognizerSinkFilter"/> using the current culture and <see cref="DateTimeStyles.None"/>.
         /// Strictly matches the supplied DateTime formats using <see cref="DateTime.TryParseExact(string, string, IFormatProvider, DateTimeStyles, out DateTime)"/>.
         /// </summary>
-        /// <param name="format">The allowable format of the <see cref="CharTermAttribute.ToString()"/>.
+        /// <param name="format">The allowable format of the <see cref="ICharTermAttribute.Buffer"/>.
         /// If supplied, it must match the format of the date exactly to get a match.</param>
         public DateRecognizerSinkFilter(string format)
            : this(new string[] { format }, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None)
@@ -69,7 +69,7 @@ namespace Lucene.Net.Analysis.Sinks
         /// Creates a new instance of <see cref="DateRecognizerSinkFilter"/>  using the current culture and <see cref="DateTimeStyles.None"/>.
         /// Strictly matches the supplied DateTime formats using <see cref="DateTime.TryParseExact(string, string[], IFormatProvider, DateTimeStyles, out DateTime)"/>.
         /// </summary>
-        /// <param name="formats">An array of allowable formats of the <see cref="CharTermAttribute.ToString()"/>.
+        /// <param name="formats">An array of allowable formats of the <see cref="ICharTermAttribute.Buffer"/>.
         /// If supplied, one of them must match the format of the date exactly to get a match.</param>
         public DateRecognizerSinkFilter(string[] formats)
             : this(formats, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None)
@@ -90,7 +90,7 @@ namespace Lucene.Net.Analysis.Sinks
         /// Creates a new instance of <see cref="DateRecognizerSinkFilter"/>  using the supplied format, culture and <see cref="DateTimeStyles.None"/>.
         /// Strictly matches the supplied DateTime formats using <see cref="DateTime.TryParseExact(string, string, IFormatProvider, DateTimeStyles, out DateTime)"/>.
         /// </summary>
-        /// <param name="format">The allowable format of the <see cref="CharTermAttribute.ToString()"/>.
+        /// <param name="format">The allowable format of the <see cref="ICharTermAttribute.Buffer"/>.
         /// If supplied, it must match the format of the date exactly to get a match.</param>
         /// <param name="culture">An object that supplies culture-specific format information</param>
         public DateRecognizerSinkFilter(string format, IFormatProvider culture)
@@ -101,7 +101,7 @@ namespace Lucene.Net.Analysis.Sinks
         /// Creates a new instance of <see cref="DateRecognizerSinkFilter"/>  using the supplied formats, culture and <see cref="DateTimeStyles.None"/>.
         /// Strictly matches the supplied DateTime formats using <see cref="DateTime.TryParseExact(string, string[], IFormatProvider, DateTimeStyles, out DateTime)"/>.
         /// </summary>
-        /// <param name="formats">An array of allowable formats of the <see cref="CharTermAttribute.ToString()"/>.
+        /// <param name="formats">An array of allowable formats of the <see cref="ICharTermAttribute.Buffer"/>.
         /// If supplied, one of them must match the format of the date exactly to get a match.</param>
         /// <param name="culture">An object that supplies culture-specific format information</param>
         public DateRecognizerSinkFilter(string[] formats, IFormatProvider culture)
@@ -112,7 +112,7 @@ namespace Lucene.Net.Analysis.Sinks
         /// Creates a new instance of <see cref="DateRecognizerSinkFilter"/> using the supplied format, culture and <see cref="DateTimeStyles"/>.
         /// Strictly matches the supplied DateTime formats using <see cref="DateTime.TryParseExact(string, string, IFormatProvider, DateTimeStyles, out DateTime)"/>.
         /// </summary>
-        /// <param name="format">The allowable format of the <see cref="CharTermAttribute.ToString()"/>.
+        /// <param name="format">The allowable format of the <see cref="ICharTermAttribute.Buffer"/>.
         /// If supplied, it must match the format of the date exactly to get a match.</param>
         /// <param name="culture">An object that supplies culture-specific format information</param>
         /// <param name="style">A bitwise combination of enumeration values that indicates the permitted format of s. 
@@ -125,7 +125,7 @@ namespace Lucene.Net.Analysis.Sinks
         /// Creates a new instance of <see cref="DateRecognizerSinkFilter"/> using the supplied formats, culture and <see cref="DateTimeStyles"/>.
         /// Strictly matches the supplied DateTime formats using <see cref="DateTime.TryParseExact(string, string[], IFormatProvider, DateTimeStyles, out DateTime)"/>.
         /// </summary>
-        /// <param name="formats">An array of allowable formats of the <see cref="CharTermAttribute.ToString()"/>.
+        /// <param name="formats">An array of allowable formats of the <see cref="ICharTermAttribute.Buffer"/>.
         /// If supplied, one of them must match the format of the date exactly to get a match.</param>
         /// <param name="culture">An object that supplies culture-specific format information</param>
         /// <param name="style">A bitwise combination of enumeration values that indicates the permitted format of s. 
@@ -145,6 +145,16 @@ namespace Lucene.Net.Analysis.Sinks
             }
 
             //We don't care about the date, just that we can parse it as a date
+#if FEATURE_NUMBER_PARSE_READONLYSPAN
+            if (m_formats is null)
+            {
+                return DateTime.TryParse(new ReadOnlySpan<char>(m_termAtt.Buffer, 0, m_termAtt.Length), m_culture, m_style, out _);
+            }
+            else
+            {
+                return DateTime.TryParseExact(new ReadOnlySpan<char>(m_termAtt.Buffer, 0, m_termAtt.Length), m_formats, m_culture, m_style, out _);
+            }
+#else
             if (m_formats is null)
             {
                 return DateTime.TryParse(m_termAtt.ToString(), m_culture, m_style, out _);
@@ -153,6 +163,7 @@ namespace Lucene.Net.Analysis.Sinks
             {
                 return DateTime.TryParseExact(m_termAtt.ToString(), m_formats, m_culture, m_style, out _);
             }
+#endif
         }
     }
 }
\ No newline at end of file


[lucenenet] 03/06: SWEEP: Renamed concrete TokenAttribute type file names to be suffixed with "Impl" so the file it was ported from is clear.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit d813d2c3d0c9c7feb21f181945cd809bb28c10a6
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 9 21:40:27 2022 +0700

    SWEEP: Renamed concrete TokenAttribute type file names to be suffixed with "Impl" so the file it was ported from is clear.
---
 ...orphosyntacticTagsAttribute.cs => MorphosyntacticTagsAttributeImpl.cs} | 0
 .../TokenAttributes/{CharTermAttribute.cs => CharTermAttributeImpl.cs}    | 0
 .../Analysis/TokenAttributes/{FlagsAttribute.cs => FlagsAttributeImpl.cs} | 0
 .../TokenAttributes/{KeywordAttribute.cs => KeywordAttributeImpl.cs}      | 0
 .../TokenAttributes/{OffsetAttribute.cs => OffsetAttributeImpl.cs}        | 0
 .../TokenAttributes/{PayloadAttribute.cs => PayloadAttributeImpl.cs}      | 0
 .../{PositionIncrementAttribute.cs => PositionIncrementAttributeImpl.cs}  | 0
 .../{PositionLengthAttribute.cs => PositionLengthAttributeImpl.cs}        | 0
 .../Analysis/TokenAttributes/{TypeAttribute.cs => TypeAttributeImpl.cs}   | 0
 9 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs b/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs
rename to src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/CharTermAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/FlagsAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/KeywordAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/OffsetAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/PayloadAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttributeImpl.cs
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/TypeAttributeImpl.cs
similarity index 100%
rename from src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs
rename to src/Lucene.Net/Analysis/TokenAttributes/TypeAttributeImpl.cs


[lucenenet] 02/06: BUG: Changed TokenAttribute usage from concrete implementation type to interface type to align with Lucene 4.8.0. We were using the concrete type in several places where it shouldn't have been.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 76004096b6eea10aae290e78fc2fbc33e3f7f233
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 9 21:13:49 2022 +0700

    BUG: Changed TokenAttribute usage from concrete implementation type to interface type to align with Lucene 4.8.0. We were using the concrete type in several places where it shouldn't have been.
---
 .../Analysis/Ar/ArabicStemFilter.cs                    |  4 ++--
 .../Analysis/Bg/BulgarianStemFilter.cs                 |  4 ++--
 .../Analysis/Br/BrazilianStemFilter.cs                 |  4 ++--
 .../Analysis/Ckb/SoraniStemFilter.cs                   |  4 ++--
 .../Analysis/CommonGrams/CommonGramsFilter.cs          |  4 ++--
 .../Analysis/Cz/CzechStemFilter.cs                     |  4 ++--
 .../Analysis/De/GermanLightStemFilter.cs               |  4 ++--
 .../Analysis/De/GermanMinimalStemFilter.cs             |  4 ++--
 .../Analysis/De/GermanStemFilter.cs                    |  4 ++--
 .../Analysis/El/GreekStemFilter.cs                     |  4 ++--
 .../Analysis/En/EnglishMinimalStemFilter.cs            |  4 ++--
 .../Analysis/En/KStemFilter.cs                         |  6 +++---
 .../Analysis/En/PorterStemFilter.cs                    |  6 +++---
 .../Analysis/Es/SpanishLightStemFilter.cs              |  4 ++--
 .../Analysis/Fa/PersianStemFilter.cs                   |  2 +-
 .../Analysis/Fi/FinnishLightStemFilter.cs              |  4 ++--
 .../Analysis/Fr/FrenchLightStemFilter.cs               |  4 ++--
 .../Analysis/Fr/FrenchMinimalStemFilter.cs             |  4 ++--
 .../Analysis/Fr/FrenchStemFilter.cs                    |  4 ++--
 .../Analysis/Gl/GalicianMinimalStemFilter.cs           |  4 ++--
 .../Analysis/Gl/GalicianStemFilter.cs                  |  4 ++--
 .../Analysis/Hi/HindiNormalizationFilter.cs            |  4 ++--
 .../Analysis/Hu/HungarianLightStemFilter.cs            |  4 ++--
 .../Analysis/Hunspell/HunspellStemFilter.cs            |  4 ++--
 .../Analysis/It/ItalianLightStemFilter.cs              |  4 ++--
 .../Analysis/Lv/LatvianStemFilter.cs                   |  4 ++--
 .../Analysis/Miscellaneous/CodepointCountFilter.cs     |  2 +-
 .../Analysis/Miscellaneous/KeywordMarkerFilter.cs      |  6 +++---
 .../Analysis/Miscellaneous/KeywordRepeatFilter.cs      |  6 +++---
 .../Analysis/Miscellaneous/LengthFilter.cs             |  2 +-
 .../Miscellaneous/PatternKeywordMarkerFilter.cs        |  8 ++++----
 .../Analysis/Miscellaneous/SetKeywordMarkerFilter.cs   |  8 ++++----
 .../Analysis/Miscellaneous/StemmerOverrideFilter.cs    |  4 ++--
 .../Analysis/NGram/NGramTokenFilter.cs                 | 18 ++++++++++++------
 .../Analysis/Nl/DutchStemFilter.cs                     |  4 ++--
 .../Analysis/No/NorwegianLightStemFilter.cs            |  4 ++--
 .../Analysis/No/NorwegianMinimalStemFilter.cs          |  4 ++--
 .../Analysis/Payloads/TokenOffsetPayloadTokenFilter.cs |  6 +++---
 .../Analysis/Pt/PortugueseLightStemFilter.cs           |  4 ++--
 .../Analysis/Pt/PortugueseMinimalStemFilter.cs         |  4 ++--
 .../Analysis/Pt/PortugueseStemFilter.cs                |  4 ++--
 .../Analysis/Ru/RussianLightStemFilter.cs              |  4 ++--
 .../Analysis/Snowball/SnowballFilter.cs                |  4 ++--
 .../Analysis/Standard/StandardTokenizerImpl.cs         |  4 ++--
 .../Standard/Std31/UAX29URLEmailTokenizerImpl31.cs     |  4 ++--
 .../Analysis/Sv/SwedishLightStemFilter.cs              |  4 ++--
 .../Analysis/Util/ElisionFilter.cs                     |  4 ++--
 .../Icu/TokenAttributes/ScriptAttributeImpl.cs         |  4 ++--
 .../TokenAttributes/BaseFormAttributeImpl.cs           |  4 ++--
 .../TokenAttributes/InflectionAttributeImpl.cs         |  4 ++--
 .../TokenAttributes/PartOfSpeechAttributeImpl.cs       |  4 ++--
 .../TokenAttributes/ReadingAttributeImpl.cs            |  4 ++--
 .../TokenAttributes/MorphosyntacticTagsAttribute.cs    |  4 ++--
 .../OpenNLPChunkerFilter.cs                            |  2 +-
 src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs |  2 +-
 .../Analysis/BaseTokenStreamTestCase.cs                | 16 ++++++++--------
 .../Analysis/CannedBinaryTokenStream.cs                |  8 ++++----
 .../Analysis/ValidatingTokenFilter.cs                  | 18 +++++++++---------
 .../Index/BaseTermVectorsFormatTestCase.cs             |  4 ++--
 .../Analysis/Synonym/TestSynonymMapFilter.cs           |  2 +-
 src/Lucene.Net.Tests/Index/Test2BPostingsBytes.cs      |  2 +-
 src/Lucene.Net.Tests/Index/Test2BTerms.cs              |  2 +-
 src/Lucene.Net.Tests/Index/TestPayloads.cs             | 10 +++++-----
 src/Lucene.Net/Analysis/NumericTokenStream.cs          |  6 +++---
 src/Lucene.Net/Analysis/Token.cs                       |  2 +-
 .../Analysis/TokenAttributes/CharTermAttribute.cs      |  4 ++--
 .../Analysis/TokenAttributes/FlagsAttribute.cs         |  9 +++------
 .../Analysis/TokenAttributes/IFlagsAttribute.cs        |  8 +++-----
 .../TokenAttributes/ITermToBytesRefAttribute.cs        |  4 ++--
 .../Analysis/TokenAttributes/KeywordAttribute.cs       |  9 ++++-----
 .../Analysis/TokenAttributes/OffsetAttribute.cs        |  4 ++--
 .../Analysis/TokenAttributes/PayloadAttribute.cs       | 12 +++++-------
 .../TokenAttributes/PositionIncrementAttribute.cs      |  4 ++--
 .../TokenAttributes/PositionLengthAttribute.cs         |  4 ++--
 .../Analysis/TokenAttributes/TypeAttribute.cs          | 13 ++++++-------
 src/Lucene.Net/Codecs/TermVectorsReader.cs             |  4 ++--
 src/Lucene.Net/Search/BoostAttributeImpl.cs            |  9 ++++-----
 src/Lucene.Net/Search/FuzzyTermsEnum.cs                |  4 ++--
 .../Search/MaxNonCompetitiveBoostAttributeImpl.cs      |  4 ++--
 src/Lucene.Net/Util/Attribute.cs                       |  4 ++--
 src/Lucene.Net/Util/AttributeImpl.cs                   |  2 +-
 src/Lucene.Net/Util/AttributeReflector.cs              |  7 ++++---
 82 files changed, 207 insertions(+), 210 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Ar/ArabicStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Ar/ArabicStemFilter.cs
index 1684f8f0a..84b65b1b0 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Ar/ArabicStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Ar/ArabicStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Ar
@@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Ar
     /// <para/>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <seealso cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <seealso cref="TokenStream"/>.
     /// </summary>
     /// <seealso cref="Miscellaneous.SetKeywordMarkerFilter"/>
     public sealed class ArabicStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Bg/BulgarianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Bg/BulgarianStemFilter.cs
index 4bc27031f..b488cab91 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Bg/BulgarianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Bg/BulgarianStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Bg
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Bg
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class BulgarianStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
index 76f4b4d57..30e8e39b9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Br/BrazilianStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using System;
 
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Br
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     /// <seealso cref="Miscellaneous.SetKeywordMarkerFilter"/>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Ckb/SoraniStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Ckb/SoraniStemFilter.cs
index 19c36f797..b353fc5a4 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Ckb/SoraniStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Ckb/SoraniStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Ckb
@@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Ckb
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para> 
     /// </summary>
     /// <seealso cref="Miscellaneous.SetKeywordMarkerFilter"/>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsFilter.cs
index ca7b3b18a..80811c3bf 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CommonGrams/CommonGramsFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Analysis.Util;
 using Lucene.Net.Util;
@@ -31,7 +31,7 @@ namespace Lucene.Net.Analysis.CommonGrams
     /// <summary>
     /// Construct bigrams for frequently occurring terms while indexing. Single terms
     /// are still indexed too, with bigrams overlaid. This is achieved through the
-    /// use of <see cref="PositionIncrementAttribute.PositionIncrement"/>. Bigrams have a type
+    /// use of <see cref="IPositionIncrementAttribute.PositionIncrement"/>. Bigrams have a type
     /// of <see cref="GRAM_TYPE"/> Example:
     /// <list type="bullet">
     ///     <item><description>input:"the quick brown fox"</description></item>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Cz/CzechStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Cz/CzechStemFilter.cs
index 055c83469..e6d070702 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Cz/CzechStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Cz/CzechStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Cz
@@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Cz
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// <para><b>NOTE</b>: Input is expected to be in lowercase, 
     /// but with diacritical marks</para> </summary>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanLightStemFilter.cs
index 39324e3b8..23d032a50 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.De
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.De
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class GermanLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanMinimalStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanMinimalStemFilter.cs
index 084a5271d..9b334d7d7 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanMinimalStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanMinimalStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.De
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.De
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class GermanMinimalStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs
index ad96338fe..8223f9c51 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/De/GermanStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using System;
 
@@ -31,7 +31,7 @@ namespace Lucene.Net.Analysis.De
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para> </summary>
     /// <seealso cref="Miscellaneous.SetKeywordMarkerFilter"/>
     public sealed class GermanStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/El/GreekStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/El/GreekStemFilter.cs
index fbc11556d..70240cc54 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/El/GreekStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/El/GreekStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.El
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.El
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// <para>
     /// NOTE: Input is expected to be casefolded for Greek (including folding of final
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishMinimalStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishMinimalStemFilter.cs
index 40b006783..bb977ae4e 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishMinimalStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/En/EnglishMinimalStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.En
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.En
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class EnglishMinimalStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemFilter.cs
index 1c74ed3fa..64cb187ac 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/En/KStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/En/KStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using System.IO;
 
@@ -32,9 +32,9 @@ namespace Lucene.Net.Analysis.En
     /// All terms must already be lowercased for this filter to work correctly.
     /// 
     /// <para>
-    /// Note: This filter is aware of the <see cref="KeywordAttribute"/>. To prevent
+    /// Note: This filter is aware of the <see cref="IKeywordAttribute"/>. To prevent
     /// certain terms from being passed to the stemmer
-    /// <see cref="KeywordAttribute.IsKeyword"/> should be set to <code>true</code>
+    /// <see cref="IKeywordAttribute.IsKeyword"/> should be set to <code>true</code>
     /// in a previous <see cref="TokenStream"/>.
     /// 
     /// Note: For including the original term as well as the stemmed version, see
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/En/PorterStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/En/PorterStemFilter.cs
index c962bc4a6..808329ac4 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/En/PorterStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/En/PorterStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.En
@@ -41,9 +41,9 @@ namespace Lucene.Net.Analysis.En
     ///    }
     ///    </code>
     ///    <para>
-    ///    Note: This filter is aware of the <see cref="KeywordAttribute"/>. To prevent
+    ///    Note: This filter is aware of the <see cref="IKeywordAttribute"/>. To prevent
     ///    certain terms from being passed to the stemmer
-    ///    <see cref="KeywordAttribute.IsKeyword"/> should be set to <code>true</code>
+    ///    <see cref="IKeywordAttribute.IsKeyword"/> should be set to <code>true</code>
     ///    in a previous <see cref="TokenStream"/>.
     /// 
     ///    Note: For including the original term as well as the stemmed version, see
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Es/SpanishLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Es/SpanishLightStemFilter.cs
index 43e3700d0..9e948308c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Es/SpanishLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Es/SpanishLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Es
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Es
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class SpanishLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Fa/PersianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Fa/PersianStemFilter.cs
index 1a2dc6d1c..67f773cf5 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Fa/PersianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Fa/PersianStemFilter.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Analysis.Fa
     /// <para/>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <seealso cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <seealso cref="TokenStream"/>.
     /// </summary>
     /// <seealso cref="Miscellaneous.SetKeywordMarkerFilter"/>
     public sealed class PersianStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Fi/FinnishLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Fi/FinnishLightStemFilter.cs
index f5924e97f..f7b11f2db 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Fi/FinnishLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Fi/FinnishLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Fi
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Fi
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class FinnishLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchLightStemFilter.cs
index de1b36838..3447d13b9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Fr
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Fr
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class FrenchLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchMinimalStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchMinimalStemFilter.cs
index c5e0bc4a2..4f9df9c57 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchMinimalStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchMinimalStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Fr
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Fr
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class FrenchMinimalStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs
index 57c571f5c..55ae3f46b 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Fr/FrenchStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using System;
 
@@ -30,7 +30,7 @@ namespace Lucene.Net.Analysis.Fr
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.KeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para> </summary>
     /// <seealso cref="Miscellaneous.KeywordMarkerFilter"/>
     /// @deprecated (3.1) Use <see cref="Snowball.SnowballFilter"/> with 
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianMinimalStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianMinimalStemFilter.cs
index 9a609332a..55cbf2b34 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianMinimalStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianMinimalStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Gl
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Gl
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class GalicianMinimalStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianStemFilter.cs
index 0e546d281..f5e7e213a 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Gl/GalicianStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Gl
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Gl
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class GalicianStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hi/HindiNormalizationFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hi/HindiNormalizationFilter.cs
index 579abd758..db7ec2b82 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hi/HindiNormalizationFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hi/HindiNormalizationFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Hi
@@ -27,7 +27,7 @@ namespace Lucene.Net.Analysis.Hi
     /// In some cases the normalization may cause unrelated terms to conflate, so
     /// to prevent terms from being normalized use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para> 
     /// </summary>
     /// <seealso cref="HindiNormalizer"/>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hu/HungarianLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hu/HungarianLightStemFilter.cs
index 44f4763b0..a84d37a34 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hu/HungarianLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hu/HungarianLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Hu
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Hu
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class HungarianLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilter.cs
index 318edabc5..23cba0117 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/HunspellStemFilter.cs
@@ -29,9 +29,9 @@ namespace Lucene.Net.Analysis.Hunspell
     /// multiple tokens for each consumed token
     /// 
     /// <para>
-    /// Note: This filter is aware of the <see cref="KeywordAttribute"/>. To prevent
+    /// Note: This filter is aware of the <see cref="IKeywordAttribute"/>. To prevent
     /// certain terms from being passed to the stemmer
-    /// <see cref="KeywordAttribute.IsKeyword"/> should be set to <c>true</c>
+    /// <see cref="IKeywordAttribute.IsKeyword"/> should be set to <c>true</c>
     /// in a previous <see cref="TokenStream"/>.
     /// 
     /// Note: For including the original term as well as the stemmed version, see
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/It/ItalianLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/It/ItalianLightStemFilter.cs
index 4e1b24279..733b5f3dd 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/It/ItalianLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/It/ItalianLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.It
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.It
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class ItalianLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemFilter.cs
index a771e51ff..becb32b8b 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Lv/LatvianStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Lv
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Lv
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class LatvianStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CodepointCountFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CodepointCountFilter.cs
index 3ebeb76bf..04b476d1a 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CodepointCountFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CodepointCountFilter.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
 
         /// <summary>
         /// Create a new <see cref="CodepointCountFilter"/>. This will filter out tokens whose
-        /// <see cref="CharTermAttribute"/> is either too short (<see cref="Character.CodePointCount(char[], int, int)"/>
+        /// <see cref="ICharTermAttribute"/> is either too short (<see cref="Character.CodePointCount(char[], int, int)"/>
         /// &lt; min) or too long (<see cref="Character.CodePointCount(char[], int, int)"/> &gt; max). </summary>
         /// <param name="version"> the Lucene match version </param>
         /// <param name="in">      the <see cref="TokenStream"/> to consume </param>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordMarkerFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordMarkerFilter.cs
index ccf761b03..e5fd06fb1 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordMarkerFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordMarkerFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Miscellaneous
@@ -21,9 +21,9 @@ namespace Lucene.Net.Analysis.Miscellaneous
      */
 
     /// <summary>
-    /// Marks terms as keywords via the <see cref="KeywordAttribute"/>.
+    /// Marks terms as keywords via the <see cref="IKeywordAttribute"/>.
     /// </summary>
-    /// <seealso cref="KeywordAttribute"/>
+    /// <seealso cref="IKeywordAttribute"/>
     public abstract class KeywordMarkerFilter : TokenFilter
     {
         private readonly IKeywordAttribute keywordAttr;
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordRepeatFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordRepeatFilter.cs
index f0271145c..770aa74a6 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordRepeatFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/KeywordRepeatFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Miscellaneous
@@ -22,8 +22,8 @@ namespace Lucene.Net.Analysis.Miscellaneous
 
     /// <summary>
     /// This TokenFilter emits each incoming token twice once as keyword and once non-keyword, in other words once with
-    /// <see cref="KeywordAttribute.IsKeyword"/> set to <c>true</c> and once set to <c>false</c>.
-    /// This is useful if used with a stem filter that respects the <see cref="KeywordAttribute"/> to index the stemmed and the
+    /// <see cref="IKeywordAttribute.IsKeyword"/> set to <c>true</c> and once set to <c>false</c>.
+    /// This is useful if used with a stem filter that respects the <see cref="IKeywordAttribute"/> to index the stemmed and the
     /// un-stemmed version of a term into the same field.
     /// </summary>
     public sealed class KeywordRepeatFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/LengthFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/LengthFilter.cs
index 490c8a4b6..723b5cefe 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/LengthFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/LengthFilter.cs
@@ -55,7 +55,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
 
         /// <summary>
         /// Create a new <see cref="LengthFilter"/>. This will filter out tokens whose
-        /// <see cref="CharTermAttribute"/> is either too short (<see cref="ICharTermAttribute.Length"/>
+        /// <see cref="ICharTermAttribute"/> is either too short (<see cref="ICharTermAttribute.Length"/>
         /// &lt; min) or too long (<see cref="ICharTermAttribute.Length"/> &gt; max). </summary>
         /// <param name="version"> the Lucene match version </param>
         /// <param name="in">      the <see cref="TokenStream"/> to consume </param>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternKeywordMarkerFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternKeywordMarkerFilter.cs
index 4d74f9022..130d841a9 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternKeywordMarkerFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PatternKeywordMarkerFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using System.Text.RegularExpressions;
 
@@ -22,9 +22,9 @@ namespace Lucene.Net.Analysis.Miscellaneous
      */
 
     /// <summary>
-    /// Marks terms as keywords via the <see cref="KeywordAttribute"/>. Each token
+    /// Marks terms as keywords via the <see cref="IKeywordAttribute"/>. Each token
     /// that matches the provided pattern is marked as a keyword by setting
-    /// <see cref="KeywordAttribute.IsKeyword"/> to <c>true</c>.
+    /// <see cref="IKeywordAttribute.IsKeyword"/> to <c>true</c>.
     /// </summary>
     public sealed class PatternKeywordMarkerFilter : KeywordMarkerFilter
     {
@@ -35,7 +35,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// <summary>
         /// Create a new <see cref="PatternKeywordMarkerFilter"/>, that marks the current
         /// token as a keyword if the tokens term buffer matches the provided
-        /// <see cref="Regex"/> via the <see cref="KeywordAttribute"/>.
+        /// <see cref="Regex"/> via the <see cref="IKeywordAttribute"/>.
         /// </summary>
         /// <param name="in">
         ///          <see cref="TokenStream"/> to filter </param>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/SetKeywordMarkerFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/SetKeywordMarkerFilter.cs
index b30fa481c..bdafc7875 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/SetKeywordMarkerFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/SetKeywordMarkerFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Analysis.Util;
 
@@ -22,9 +22,9 @@ namespace Lucene.Net.Analysis.Miscellaneous
      */
 
     /// <summary>
-    /// Marks terms as keywords via the <see cref="KeywordAttribute"/>. Each token
+    /// Marks terms as keywords via the <see cref="IKeywordAttribute"/>. Each token
     /// contained in the provided set is marked as a keyword by setting
-    /// <see cref="KeywordAttribute.IsKeyword"/> to <c>true</c>.
+    /// <see cref="IKeywordAttribute.IsKeyword"/> to <c>true</c>.
     /// </summary>
     public sealed class SetKeywordMarkerFilter : KeywordMarkerFilter
     {
@@ -34,7 +34,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// <summary>
         /// Create a new <see cref="SetKeywordMarkerFilter"/>, that marks the current token as a
         /// keyword if the tokens term buffer is contained in the given set via the
-        /// <see cref="KeywordAttribute"/>.
+        /// <see cref="IKeywordAttribute"/>.
         /// </summary>
         /// <param name="in">
         ///          <see cref="TokenStream"/> to filter </param>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
index eb8772c48..3f21ca5a0 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/StemmerOverrideFilter.cs
@@ -30,7 +30,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
      */
 
     /// <summary>
-    /// Provides the ability to override any <see cref="KeywordAttribute"/> aware stemmer
+    /// Provides the ability to override any <see cref="IKeywordAttribute"/> aware stemmer
     /// with custom dictionary-based stemming.
     /// </summary>
     public sealed class StemmerOverrideFilter : TokenFilter
@@ -47,7 +47,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
         /// Create a new <see cref="StemmerOverrideFilter"/>, performing dictionary-based stemming
         /// with the provided dictionary (<paramref name="stemmerOverrideMap"/>).
         /// <para>
-        /// Any dictionary-stemmed terms will be marked with <see cref="KeywordAttribute"/>
+        /// Any dictionary-stemmed terms will be marked with <see cref="IKeywordAttribute"/>
         /// so that they will not be stemmed with stemmers down the chain.
         /// </para>
         /// </summary>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/NGram/NGramTokenFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/NGram/NGramTokenFilter.cs
index eca3daddf..e4749a489 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/NGram/NGramTokenFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/NGram/NGramTokenFilter.cs
@@ -114,22 +114,28 @@ namespace Lucene.Net.Analysis.NGram
             offsetAtt = AddAttribute<IOffsetAttribute>();
         }
 
-        private sealed class PositionIncrementAttributeAnonymousClass : PositionIncrementAttribute
+        private sealed class PositionIncrementAttributeAnonymousClass : IPositionIncrementAttribute
         {
-            public override int PositionIncrement
+            public int PositionIncrement
             {
                 get => 0;
-                set { }
+                set => _ = value;
             }
+
+            // LUCENENET specific - The interface requires this to be implemented, since we added it to avoid casts.
+            public void CopyTo(IAttribute target) => _ = target;
         }
 
-        private sealed class PositionLengthAttributeAnonymousClass : PositionLengthAttribute
+        private sealed class PositionLengthAttributeAnonymousClass : IPositionLengthAttribute
         {
-            public override int PositionLength
+            public int PositionLength
             {
                 get => 0;
-                set { }
+                set => _ = value;
             }
+
+            // LUCENENET specific - The interface requires this to be implemented, since we added it to avoid casts.
+            public void CopyTo(IAttribute target) => _ = target;
         }
 
         /// <summary>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
index 3b567a7dd..500e64003 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Analysis.Util;
 using System;
@@ -33,7 +33,7 @@ namespace Lucene.Net.Analysis.Nl
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.KeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para> 
     /// </summary>
     /// <seealso cref="Miscellaneous.KeywordMarkerFilter"/>
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilter.cs
index 8595fc341..0ccb36220 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.No
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.No
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class NorwegianLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilter.cs
index a85f8eb03..0b347efeb 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/No/NorwegianMinimalStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.No
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.No
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class NorwegianMinimalStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/TokenOffsetPayloadTokenFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/TokenOffsetPayloadTokenFilter.cs
index c0f8d2bc5..806a3144d 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Payloads/TokenOffsetPayloadTokenFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Payloads/TokenOffsetPayloadTokenFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Util;
 
@@ -22,8 +22,8 @@ namespace Lucene.Net.Analysis.Payloads
      */
 
     /// <summary>
-    /// Adds the <see cref="OffsetAttribute.StartOffset"/>
-    /// and <see cref="OffsetAttribute.EndOffset"/>
+    /// Adds the <see cref="IOffsetAttribute.StartOffset"/>
+    /// and <see cref="IOffsetAttribute.EndOffset"/>
     /// First 4 bytes are the start
     /// </summary>
     public class TokenOffsetPayloadTokenFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseLightStemFilter.cs
index 22fb18b88..6c8490042 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Pt
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Pt
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class PortugueseLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseMinimalStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseMinimalStemFilter.cs
index f3fce7553..584e52595 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseMinimalStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseMinimalStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Pt
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Pt
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class PortugueseMinimalStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseStemFilter.cs
index 932f82c01..2c8360489 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Pt/PortugueseStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Pt
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Pt
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class PortugueseStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Ru/RussianLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Ru/RussianLightStemFilter.cs
index 6a14022b3..dd834662d 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Ru/RussianLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Ru/RussianLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Ru
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Ru
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class RussianLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballFilter.cs
index f0df84c79..5f88d8f7c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Snowball/SnowballFilter.cs
@@ -35,9 +35,9 @@ namespace Lucene.Net.Analysis.Snowball
     /// </para>
     /// 
     /// <para>
-    /// Note: This filter is aware of the <see cref="KeywordAttribute"/>. To prevent
+    /// Note: This filter is aware of the <see cref="IKeywordAttribute"/>. To prevent
     /// certain terms from being passed to the stemmer
-    /// <see cref="KeywordAttribute.IsKeyword"/> should be set to <c>true</c>
+    /// <see cref="IKeywordAttribute.IsKeyword"/> should be set to <c>true</c>
     /// in a previous <see cref="TokenStream"/>.
     /// 
     /// Note: For including the original term as well as the stemmed version, see
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizerImpl.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizerImpl.cs
index 1cb3cc6e3..1e53c1da7 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizerImpl.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/StandardTokenizerImpl.cs
@@ -998,7 +998,7 @@ namespace Lucene.Net.Analysis.Standard
         public int YyChar => yyChar;
 
         /// <summary>
-        /// Fills CharTermAttribute with the current token text.
+        /// Fills <see cref="ICharTermAttribute"/> with the current token text.
         /// </summary>
         public void GetText(ICharTermAttribute t)
         {
@@ -1009,7 +1009,7 @@ namespace Lucene.Net.Analysis.Standard
         /// <summary>
         /// Creates a new scanner
         /// </summary>
-        /// <param name="in">  the TextReader to read input from. </param>
+        /// <param name="in"> the <see cref="TextReader"/> to read input from. </param>
         public StandardTokenizerImpl(TextReader @in)
         {
             this.zzReader = @in;
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Standard/Std31/UAX29URLEmailTokenizerImpl31.cs b/src/Lucene.Net.Analysis.Common/Analysis/Standard/Std31/UAX29URLEmailTokenizerImpl31.cs
index 6cbdc6d6d..8597bc30c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Standard/Std31/UAX29URLEmailTokenizerImpl31.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Standard/Std31/UAX29URLEmailTokenizerImpl31.cs
@@ -3285,7 +3285,7 @@ namespace Lucene.Net.Analysis.Standard.Std31
 
         public int YyChar => yychar;
 
-        /// <summary>Fills CharTermAttribute with the current token text.</summary>
+        /// <summary>Fills <see cref="ICharTermAttribute"/> with the current token text.</summary>
         public void GetText(ICharTermAttribute t)
         {
             t.CopyBuffer(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
@@ -3294,7 +3294,7 @@ namespace Lucene.Net.Analysis.Standard.Std31
         /// <summary>
         /// Creates a new scanner
         /// </summary>
-        /// <param name="in">the TextReader to read input from.</param>
+        /// <param name="in">the <see cref="TextReader"/> to read input from.</param>
         public UAX29URLEmailTokenizerImpl31(TextReader @in)
         {
             this.zzReader = @in;
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Sv/SwedishLightStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Sv/SwedishLightStemFilter.cs
index ddd745e0f..47f96245a 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Sv/SwedishLightStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Sv/SwedishLightStemFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Sv
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.Sv
     /// <para>
     /// To prevent terms from being stemmed use an instance of
     /// <see cref="Miscellaneous.SetKeywordMarkerFilter"/> or a custom <see cref="TokenFilter"/> that sets
-    /// the <see cref="KeywordAttribute"/> before this <see cref="TokenStream"/>.
+    /// the <see cref="IKeywordAttribute"/> before this <see cref="TokenStream"/>.
     /// </para>
     /// </summary>
     public sealed class SwedishLightStemFilter : TokenFilter
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/ElisionFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/ElisionFilter.cs
index 399a00549..d8d321e4b 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/ElisionFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/ElisionFilter.cs
@@ -1,4 +1,4 @@
-// Lucene version compatibility level 4.8.1
+// Lucene version compatibility level 4.8.1
 using Lucene.Net.Analysis.TokenAttributes;
 
 namespace Lucene.Net.Analysis.Util
@@ -43,7 +43,7 @@ namespace Lucene.Net.Analysis.Util
         }
 
         /// <summary>
-        /// Increments the <see cref="TokenStream"/> with a <see cref="CharTermAttribute"/> without elisioned start
+        /// Increments the <see cref="TokenStream"/> with a <see cref="ICharTermAttribute"/> without elisioned start
         /// </summary>
         public override sealed bool IncrementToken()
         {
diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs
index 493d97470..383ebe55d 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/TokenAttributes/ScriptAttributeImpl.cs
@@ -56,9 +56,9 @@ namespace Lucene.Net.Analysis.Icu.TokenAttributes
             code = UScript.Common;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            ScriptAttribute t = (ScriptAttribute)target;
+            IScriptAttribute t = (IScriptAttribute)target;
             t.Code = code;
         }
 
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs
index 4d27dc8a3..187896418 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/BaseFormAttributeImpl.cs
@@ -41,9 +41,9 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
             token = null;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            BaseFormAttribute t = (BaseFormAttribute)target;
+            IBaseFormAttribute t = (IBaseFormAttribute)target;
             t.SetToken(token);
         }
 
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs
index f3d22e6d3..a70e8923a 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/InflectionAttributeImpl.cs
@@ -47,9 +47,9 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
             token = null;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            InflectionAttribute t = (InflectionAttribute)target;
+            IInflectionAttribute t = (IInflectionAttribute)target;
             t.SetToken(token);
         }
 
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs
index c6722ba3f..e5e866413 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/PartOfSpeechAttributeImpl.cs
@@ -42,9 +42,9 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
             token = null;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            PartOfSpeechAttribute t = (PartOfSpeechAttribute)target;
+            IPartOfSpeechAttribute t = (IPartOfSpeechAttribute)target;
             t.SetToken(token);
         }
 
diff --git a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs
index d659b5a7e..b0145efbd 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/TokenAttributes/ReadingAttributeImpl.cs
@@ -47,9 +47,9 @@ namespace Lucene.Net.Analysis.Ja.TokenAttributes
             token = null;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            ReadingAttribute t = (ReadingAttribute)target;
+            IReadingAttribute t = (IReadingAttribute)target;
             t.SetToken(token);
         }
 
diff --git a/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs b/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs
index 6fd65c025..22841878f 100644
--- a/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs
+++ b/src/Lucene.Net.Analysis.Morfologik/Morfologik/TokenAttributes/MorphosyntacticTagsAttribute.cs
@@ -75,7 +75,7 @@ namespace Lucene.Net.Analysis.Morfologik.TokenAttributes
             return this.tags is null ? 0 : tags.GetHashCode();
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
             IList<StringBuilder> cloned = null;
             if (tags != null)
@@ -98,7 +98,7 @@ namespace Lucene.Net.Analysis.Morfologik.TokenAttributes
 
         public override void ReflectWith(IAttributeReflector reflector)
         {
-            reflector.Reflect(typeof(MorphosyntacticTagsAttribute), "tags", tags);
+            reflector.Reflect(typeof(IMorphosyntacticTagsAttribute), "tags", tags);
         }
     }
 }
diff --git a/src/Lucene.Net.Analysis.OpenNLP/OpenNLPChunkerFilter.cs b/src/Lucene.Net.Analysis.OpenNLP/OpenNLPChunkerFilter.cs
index bbaa1bcae..431d1abd4 100644
--- a/src/Lucene.Net.Analysis.OpenNLP/OpenNLPChunkerFilter.cs
+++ b/src/Lucene.Net.Analysis.OpenNLP/OpenNLPChunkerFilter.cs
@@ -26,7 +26,7 @@ namespace Lucene.Net.Analysis.OpenNlp
 
     /// <summary>
     /// Run OpenNLP chunker. Prerequisite: the <see cref="OpenNLPTokenizer"/> and <see cref="OpenNLPPOSFilter"/> must precede this filter.
-    /// Tags terms in the TypeAttribute, replacing the POS tags previously put there by <see cref="OpenNLPPOSFilter"/>.
+    /// Tags terms in the <see cref="ITypeAttribute"/>, replacing the POS tags previously put there by <see cref="OpenNLPPOSFilter"/>.
     /// </summary>
     public sealed class OpenNLPChunkerFilter : TokenFilter
     {
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
index 75363e18e..5665ec6f3 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
@@ -701,7 +701,7 @@ namespace Lucene.Net.Codecs.Pulsing
                 // and is calling clearAttributes(), so they don't nuke the reuse information!
             }
 
-            public override void CopyTo(Util.IAttribute target)
+            public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
             {
                 // this makes no sense for us, because our state is per-docsenum.
                 // we don't want to copy any stuff over to another docsenum ever!
diff --git a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
index dcd9ade2d..55ed2e47f 100644
--- a/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
@@ -79,7 +79,7 @@ namespace Lucene.Net.Analysis
             return 76137213 ^ clearCalled.GetHashCode();
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
             ((CheckClearAttributesAttribute)target).Clear();
         }
@@ -125,42 +125,42 @@ namespace Lucene.Net.Analysis
                 ICharTermAttribute termAtt = null;
                 if (output.Length > 0)
                 {
-                    Assert.IsTrue(ts.HasAttribute<ICharTermAttribute>(), "has no CharTermAttribute");
+                    Assert.IsTrue(ts.HasAttribute<ICharTermAttribute>(), "has no ICharTermAttribute");
                     termAtt = ts.GetAttribute<ICharTermAttribute>();
                 }
 
                 IOffsetAttribute offsetAtt = null;
                 if (startOffsets != null || endOffsets != null || finalOffset != null)
                 {
-                    Assert.IsTrue(ts.HasAttribute<IOffsetAttribute>(), "has no OffsetAttribute");
+                    Assert.IsTrue(ts.HasAttribute<IOffsetAttribute>(), "has no IOffsetAttribute");
                     offsetAtt = ts.GetAttribute<IOffsetAttribute>();
                 }
 
                 ITypeAttribute typeAtt = null;
                 if (types != null)
                 {
-                    Assert.IsTrue(ts.HasAttribute<ITypeAttribute>(), "has no TypeAttribute");
+                    Assert.IsTrue(ts.HasAttribute<ITypeAttribute>(), "has no ITypeAttribute");
                     typeAtt = ts.GetAttribute<ITypeAttribute>();
                 }
 
                 IPositionIncrementAttribute posIncrAtt = null;
                 if (posIncrements != null || finalPosInc != null)
                 {
-                    Assert.IsTrue(ts.HasAttribute<IPositionIncrementAttribute>(), "has no PositionIncrementAttribute");
+                    Assert.IsTrue(ts.HasAttribute<IPositionIncrementAttribute>(), "has no IPositionIncrementAttribute");
                     posIncrAtt = ts.GetAttribute<IPositionIncrementAttribute>();
                 }
 
                 IPositionLengthAttribute posLengthAtt = null;
                 if (posLengths != null)
                 {
-                    Assert.IsTrue(ts.HasAttribute<IPositionLengthAttribute>(), "has no PositionLengthAttribute");
+                    Assert.IsTrue(ts.HasAttribute<IPositionLengthAttribute>(), "has no IPositionLengthAttribute");
                     posLengthAtt = ts.GetAttribute<IPositionLengthAttribute>();
                 }
 
                 IKeywordAttribute keywordAtt = null;
                 if (keywordAtts != null)
                 {
-                    Assert.IsTrue(ts.HasAttribute<IKeywordAttribute>(), "has no KeywordAttribute");
+                    Assert.IsTrue(ts.HasAttribute<IKeywordAttribute>(), "has no IKeywordAttribute");
                     keywordAtt = ts.GetAttribute<IKeywordAttribute>();
                 }
 
@@ -169,7 +169,7 @@ namespace Lucene.Net.Analysis
                 IPayloadAttribute payloadAtt = null;
                 if (payloads != null)
                 {
-                    Assert.IsTrue(ts.HasAttribute<IPayloadAttribute>(), "has no PayloadAttribute");
+                    Assert.IsTrue(ts.HasAttribute<IPayloadAttribute>(), "has no IPayloadAttribute");
                     payloadAtt = ts.GetAttribute<IPayloadAttribute>();
                 }
 
diff --git a/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs b/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs
index 430478b6b..55895d202 100644
--- a/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/CannedBinaryTokenStream.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Analysis.TokenAttributes;
+using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Util;
 using System;
 using System.Runtime.CompilerServices;
@@ -90,10 +90,10 @@ namespace Lucene.Net.Analysis
             return RuntimeHelpers.GetHashCode(this);
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            BinaryTermAttribute other = (BinaryTermAttribute)target;
-            other.bytes.CopyBytes(bytes);
+            IBinaryTermAttribute other = (IBinaryTermAttribute)target;
+            other.BytesRef.CopyBytes(bytes);
         }
 
         public override object Clone()
diff --git a/src/Lucene.Net.TestFramework/Analysis/ValidatingTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/ValidatingTokenFilter.cs
index 34ddeddde..dac4541c5 100644
--- a/src/Lucene.Net.TestFramework/Analysis/ValidatingTokenFilter.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/ValidatingTokenFilter.cs
@@ -44,16 +44,16 @@ namespace Lucene.Net.Analysis
 
         private readonly IDictionary<int, int> posToEndOffset = new Dictionary<int, int>();
 
-        private readonly PositionIncrementAttribute posIncAtt;
-        private readonly PositionLengthAttribute posLenAtt;
-        private readonly OffsetAttribute offsetAtt;
-        private readonly CharTermAttribute termAtt;
+        private readonly IPositionIncrementAttribute posIncAtt;
+        private readonly IPositionLengthAttribute posLenAtt;
+        private readonly IOffsetAttribute offsetAtt;
+        private readonly ICharTermAttribute termAtt;
         private readonly bool offsetsAreCorrect;
 
         private readonly string name;
 
         // Returns null if the attr wasn't already added
-        private A GetAttrIfExists<A>() where A : Lucene.Net.Util.Attribute
+        private A GetAttrIfExists<A>() where A : Lucene.Net.Util.IAttribute
         {
             if (HasAttribute<A>())
             {
@@ -73,10 +73,10 @@ namespace Lucene.Net.Analysis
         public ValidatingTokenFilter(TokenStream @in, string name, bool offsetsAreCorrect)
             : base(@in)
         {
-            posIncAtt = GetAttrIfExists<PositionIncrementAttribute>();
-            posLenAtt = GetAttrIfExists<PositionLengthAttribute>();
-            offsetAtt = GetAttrIfExists<OffsetAttribute>();
-            termAtt = GetAttrIfExists<CharTermAttribute>();
+            posIncAtt = GetAttrIfExists<IPositionIncrementAttribute>();
+            posLenAtt = GetAttrIfExists<IPositionLengthAttribute>();
+            offsetAtt = GetAttrIfExists<IOffsetAttribute>();
+            termAtt = GetAttrIfExists<ICharTermAttribute>();
             this.name = name;
             this.offsetsAreCorrect = offsetsAreCorrect;
         }
diff --git a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
index dbb54e28d..5d9a5f894 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -218,9 +218,9 @@ namespace Lucene.Net.Index
                 return start + 31 * end;
             }
 
-            public override void CopyTo(IAttribute target)
+            public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
             {
-                OffsetAttribute t = (OffsetAttribute)target;
+                IOffsetAttribute t = (IOffsetAttribute)target;
                 t.SetOffset(start, end);
             }
         }
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
index 70da7374a..7164838b3 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
@@ -64,7 +64,7 @@ namespace Lucene.Net.Analysis.Synonym
             b.Add(inputCharsRef, outputCharsRef, keepOrig);
         }
 
-        private void AssertEquals(CharTermAttribute term, string expected)
+        private void AssertEquals(ICharTermAttribute term, string expected)
         {
             assertEquals(expected.Length, term.Length);
             char[] buffer = term.Buffer;
diff --git a/src/Lucene.Net.Tests/Index/Test2BPostingsBytes.cs b/src/Lucene.Net.Tests/Index/Test2BPostingsBytes.cs
index ee3cd39d4..b79695a28 100644
--- a/src/Lucene.Net.Tests/Index/Test2BPostingsBytes.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BPostingsBytes.cs
@@ -26,7 +26,7 @@ namespace Lucene.Net.Index
      */
 
     using BaseDirectoryWrapper = Lucene.Net.Store.BaseDirectoryWrapper;
-    using CharTermAttribute = Lucene.Net.Analysis.TokenAttributes.CharTermAttribute;
+    using ICharTermAttribute = Lucene.Net.Analysis.TokenAttributes.ICharTermAttribute;
     using Document = Documents.Document;
     using Field = Field;
     using FieldType = FieldType;
diff --git a/src/Lucene.Net.Tests/Index/Test2BTerms.cs b/src/Lucene.Net.Tests/Index/Test2BTerms.cs
index 475db64b7..698ad79fe 100644
--- a/src/Lucene.Net.Tests/Index/Test2BTerms.cs
+++ b/src/Lucene.Net.Tests/Index/Test2BTerms.cs
@@ -154,7 +154,7 @@ namespace Lucene.Net.Index
                     {
                         return new MyTermAttributeImpl();
                     }
-                    if (attClass.IsSubclassOf(typeof(CharTermAttribute)))
+                    if (typeof(ICharTermAttribute).IsAssignableFrom(attClass))
                     {
                         throw new ArgumentException("no");
                     }
diff --git a/src/Lucene.Net.Tests/Index/TestPayloads.cs b/src/Lucene.Net.Tests/Index/TestPayloads.cs
index f1ca0adbe..c6a5c4e36 100644
--- a/src/Lucene.Net.Tests/Index/TestPayloads.cs
+++ b/src/Lucene.Net.Tests/Index/TestPayloads.cs
@@ -42,7 +42,7 @@ namespace Lucene.Net.Index
     using Field = Field;
     using IBits = Lucene.Net.Util.IBits;
     using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
-    using PayloadAttribute = Lucene.Net.Analysis.TokenAttributes.PayloadAttribute;
+    using IPayloadAttribute = Lucene.Net.Analysis.TokenAttributes.IPayloadAttribute;
     using TestUtil = Lucene.Net.Util.TestUtil;
     using TextField = TextField;
 
@@ -695,7 +695,7 @@ namespace Lucene.Net.Index
             Document doc = new Document();
             Field field = new TextField("field", "", Field.Store.NO);
             TokenStream ts = new MockTokenizer(new StringReader("here we go"), MockTokenizer.WHITESPACE, true);
-            Assert.IsFalse(ts.HasAttribute<PayloadAttribute>());
+            Assert.IsFalse(ts.HasAttribute<IPayloadAttribute>());
             field.SetTokenStream(ts);
             doc.Add(field);
             writer.AddDocument(doc);
@@ -706,7 +706,7 @@ namespace Lucene.Net.Index
             field.SetTokenStream(ts);
             writer.AddDocument(doc);
             ts = new MockTokenizer(new StringReader("another"), MockTokenizer.WHITESPACE, true);
-            Assert.IsFalse(ts.HasAttribute<PayloadAttribute>());
+            Assert.IsFalse(ts.HasAttribute<IPayloadAttribute>());
             field.SetTokenStream(ts);
             writer.AddDocument(doc);
             DirectoryReader reader = writer.GetReader();
@@ -730,7 +730,7 @@ namespace Lucene.Net.Index
             Document doc = new Document();
             Field field = new TextField("field", "", Field.Store.NO);
             TokenStream ts = new MockTokenizer(new StringReader("here we go"), MockTokenizer.WHITESPACE, true);
-            Assert.IsFalse(ts.HasAttribute<PayloadAttribute>());
+            Assert.IsFalse(ts.HasAttribute<IPayloadAttribute>());
             field.SetTokenStream(ts);
             doc.Add(field);
             Field field2 = new TextField("field", "", Field.Store.NO);
@@ -742,7 +742,7 @@ namespace Lucene.Net.Index
             doc.Add(field2);
             Field field3 = new TextField("field", "", Field.Store.NO);
             ts = new MockTokenizer(new StringReader("nopayload"), MockTokenizer.WHITESPACE, true);
-            Assert.IsFalse(ts.HasAttribute<PayloadAttribute>());
+            Assert.IsFalse(ts.HasAttribute<IPayloadAttribute>());
             field3.SetTokenStream(ts);
             doc.Add(field3);
             writer.AddDocument(doc);
diff --git a/src/Lucene.Net/Analysis/NumericTokenStream.cs b/src/Lucene.Net/Analysis/NumericTokenStream.cs
index 290e18ab5..2eb79b8b7 100644
--- a/src/Lucene.Net/Analysis/NumericTokenStream.cs
+++ b/src/Lucene.Net/Analysis/NumericTokenStream.cs
@@ -148,7 +148,7 @@ namespace Lucene.Net.Analysis
                 var attClass = typeof(T);
                 if (typeof(ICharTermAttribute).IsAssignableFrom(attClass))
                 {
-                    throw new ArgumentException("NumericTokenStream does not support CharTermAttribute.");
+                    throw new ArgumentException("NumericTokenStream does not support ICharTermAttribute.");
                 }
                 return @delegate.CreateAttributeInstance<T>();
             }
@@ -223,9 +223,9 @@ namespace Lucene.Net.Analysis
                 reflector.Reflect(typeof(INumericTermAttribute), "valueSize", ValueSize);
             }
 
-            public override void CopyTo(Util.IAttribute target)
+            public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
             {
-                var a = (NumericTermAttribute)target;
+                var a = (INumericTermAttribute)target;
                 a.Init(_value, ValueSize, _precisionStep, Shift);
             }
         }
diff --git a/src/Lucene.Net/Analysis/Token.cs b/src/Lucene.Net/Analysis/Token.cs
index 78a92add2..006bd7c8a 100644
--- a/src/Lucene.Net/Analysis/Token.cs
+++ b/src/Lucene.Net/Analysis/Token.cs
@@ -593,7 +593,7 @@ namespace Lucene.Net.Analysis
             payload = prototype.payload;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
             if (target is Token to)
             {
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
index 1d3c9c456..824f1c84a 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
@@ -432,9 +432,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
             reflector.Reflect(typeof(ITermToBytesRefAttribute), "bytes", BytesRef.DeepCopyOf(bytes));
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            CharTermAttribute t = (CharTermAttribute)target;
+            ICharTermAttribute t = (ICharTermAttribute)target;
             t.CopyBuffer(termBuffer, 0, termLength);
         }
 
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
index 103731c8c..933fe9f76 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
@@ -1,4 +1,4 @@
-using System;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -19,9 +19,6 @@ namespace Lucene.Net.Analysis.TokenAttributes
      * limitations under the License.
      */
 
-    using Attribute = Lucene.Net.Util.Attribute;
-    using IAttribute = Lucene.Net.Util.IAttribute;
-
     /// <summary>
     /// Default implementation of <see cref="IFlagsAttribute"/>. </summary>
     public class FlagsAttribute : Attribute, IFlagsAttribute // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
@@ -65,9 +62,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
             return flags;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            FlagsAttribute t = (FlagsAttribute)target;
+            IFlagsAttribute t = (IFlagsAttribute)target;
             t.Flags = flags;
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs
index 2aa5cf185..f75222d67 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/IFlagsAttribute.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Util;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -22,18 +22,16 @@ namespace Lucene.Net.Analysis.TokenAttributes
     /// <summary> This attribute can be used to pass different flags down the <see cref="Tokenizer" /> chain,
     /// eg from one TokenFilter to another one.
     /// <para/>
-    /// This is completely distinct from <see cref="TypeAttribute"/>, although they do share similar purposes.
+    /// This is completely distinct from <see cref="ITypeAttribute"/>, although they do share similar purposes.
     /// The flags can be used to encode information about the token for use by other 
     /// <see cref="TokenFilter"/>s.
+    /// <para/>
     /// @lucene.experimental While we think this is here to stay, we may want to change it to be a long.
     /// </summary>
     public interface IFlagsAttribute : IAttribute
     {
         /// <summary>
         /// Get the bitset for any bits that have been set.
-        /// <para/>
-        /// This is completely distinct from <see cref="ITypeAttribute.Type" />, although they do share similar purposes.
-        /// The flags can be used to encode information about the token for use by other <see cref="Lucene.Net.Analysis.TokenFilter" />s.
         /// </summary>
         int Flags { get; set; }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/ITermToBytesRefAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/ITermToBytesRefAttribute.cs
index a8964c129..8aa7ce637 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/ITermToBytesRefAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/ITermToBytesRefAttribute.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Util;
+using Lucene.Net.Util;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -39,7 +39,7 @@ namespace Lucene.Net.Analysis.TokenAttributes
     ///
     ///     if (IsInteresting(bytes))
     ///     {
-    ///       // because the bytes are reused by the attribute (like CharTermAttribute's char[] buffer),
+    ///       // because the bytes are reused by the attribute (like ICharTermAttribute's char[] buffer),
     ///       // you should make a copy if you need persistent access to the bytes, otherwise they will
     ///       // be rewritten across calls to IncrementToken()
     ///
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs
index 086ba1e38..31a41b054 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/KeywordAttribute.cs
@@ -1,3 +1,5 @@
+using Lucene.Net.Util;
+
 namespace Lucene.Net.Analysis.TokenAttributes
 {
     /*
@@ -17,9 +19,6 @@ namespace Lucene.Net.Analysis.TokenAttributes
      * limitations under the License.
      */
 
-    using Attribute = Lucene.Net.Util.Attribute;
-    using IAttribute = Lucene.Net.Util.IAttribute;
-
     /// <summary>
     /// Default implementation of <see cref="IKeywordAttribute"/>. </summary>
     public sealed class KeywordAttribute : Attribute, IKeywordAttribute
@@ -37,9 +36,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
             keyword = false;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            KeywordAttribute attr = (KeywordAttribute)target;
+            IKeywordAttribute attr = (IKeywordAttribute)target;
             attr.IsKeyword = keyword;
         }
 
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs
index 9d4eaa2ed..9646ed757 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/OffsetAttribute.cs
@@ -86,9 +86,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
             return code;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            OffsetAttribute t = (OffsetAttribute)target;
+            IOffsetAttribute t = (IOffsetAttribute)target;
             t.SetOffset(startOffset, endOffset);
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs
index 7ff3193cf..d367115cd 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/PayloadAttribute.cs
@@ -1,4 +1,6 @@
-namespace Lucene.Net.Analysis.TokenAttributes
+using Lucene.Net.Util;
+
+namespace Lucene.Net.Analysis.TokenAttributes
 {
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,10 +19,6 @@
      * limitations under the License.
      */
 
-    using Attribute = Lucene.Net.Util.Attribute;
-    using IAttribute = Lucene.Net.Util.IAttribute;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-
     /// <summary>
     /// Default implementation of <see cref="IPayloadAttribute"/>. </summary>
     public class PayloadAttribute : Attribute, IPayloadAttribute // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
@@ -88,9 +86,9 @@
             return (payload is null) ? 0 : payload.GetHashCode();
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            PayloadAttribute t = (PayloadAttribute)target;
+            IPayloadAttribute t = (IPayloadAttribute)target;
             t.Payload = (payload is null) ? null : (BytesRef)payload.Clone();
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs
index 952db5c37..6916c8a18 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/PositionIncrementAttribute.cs
@@ -72,9 +72,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
             return positionIncrement;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            PositionIncrementAttribute t = (PositionIncrementAttribute)target;
+            IPositionIncrementAttribute t = (IPositionIncrementAttribute)target;
             t.PositionIncrement = positionIncrement;
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs
index 4ee38275c..3eff86c5a 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/PositionLengthAttribute.cs
@@ -72,9 +72,9 @@ namespace Lucene.Net.Analysis.TokenAttributes
             return positionLength;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            PositionLengthAttribute t = (PositionLengthAttribute)target;
+            IPositionLengthAttribute t = (IPositionLengthAttribute)target;
             t.PositionLength = positionLength;
         }
     }
diff --git a/src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs b/src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs
index bd88dd700..b6dcbb87c 100644
--- a/src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs
+++ b/src/Lucene.Net/Analysis/TokenAttributes/TypeAttribute.cs
@@ -1,4 +1,6 @@
-using System;
+using Lucene.Net.Util;
+using System;
+using Attribute = Lucene.Net.Util.Attribute;
 
 namespace Lucene.Net.Analysis.TokenAttributes
 {
@@ -19,9 +21,6 @@ namespace Lucene.Net.Analysis.TokenAttributes
      * limitations under the License.
      */
 
-    using Attribute = Lucene.Net.Util.Attribute;
-    using IAttribute = Lucene.Net.Util.IAttribute;
-
     /// <summary>
     /// Default implementation of <see cref="ITypeAttribute"/>. </summary>
     public partial class TypeAttribute : Attribute, ITypeAttribute // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation
@@ -73,10 +72,10 @@ namespace Lucene.Net.Analysis.TokenAttributes
             return (type is null) ? 0 : type.GetHashCode();
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            TypeAttribute t = (TypeAttribute)target;
-            t.type = type;
+            ITypeAttribute t = (ITypeAttribute)target;
+            t.Type = type;
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net/Codecs/TermVectorsReader.cs b/src/Lucene.Net/Codecs/TermVectorsReader.cs
index 3a16f052f..927bc9142 100644
--- a/src/Lucene.Net/Codecs/TermVectorsReader.cs
+++ b/src/Lucene.Net/Codecs/TermVectorsReader.cs
@@ -21,7 +21,7 @@ namespace Lucene.Net.Codecs
 
     using DocsAndPositionsEnum = Lucene.Net.Index.DocsAndPositionsEnum; // javadocs
     using Fields = Lucene.Net.Index.Fields;
-    using OffsetAttribute = Lucene.Net.Analysis.TokenAttributes.OffsetAttribute; // javadocs
+    using IOffsetAttribute = Lucene.Net.Analysis.TokenAttributes.IOffsetAttribute; // javadocs
 
     /// <summary>
     /// Codec API for reading term vectors:
@@ -41,7 +41,7 @@ namespace Lucene.Net.Codecs
         /// <summary>
         /// Returns term vectors for this document, or <c>null</c> if
         /// term vectors were not indexed. If offsets are
-        /// available they are in an <see cref="OffsetAttribute"/>
+        /// available they are in an <see cref="IOffsetAttribute"/>
         /// available from the <see cref="DocsAndPositionsEnum"/>.
         /// </summary>
         public abstract Fields Get(int doc);
diff --git a/src/Lucene.Net/Search/BoostAttributeImpl.cs b/src/Lucene.Net/Search/BoostAttributeImpl.cs
index eb4a6d066..bfe7e622e 100644
--- a/src/Lucene.Net/Search/BoostAttributeImpl.cs
+++ b/src/Lucene.Net/Search/BoostAttributeImpl.cs
@@ -1,3 +1,5 @@
+using Lucene.Net.Util;
+
 namespace Lucene.Net.Search
 {
     /*
@@ -17,9 +19,6 @@ namespace Lucene.Net.Search
      * limitations under the License.
      */
 
-    using Attribute = Lucene.Net.Util.Attribute;
-    using IAttribute = Lucene.Net.Util.IAttribute;
-
     /// <summary>
     /// Implementation class for <see cref="IBoostAttribute"/>.
     /// <para/>
@@ -43,9 +42,9 @@ namespace Lucene.Net.Search
             boost = 1.0f;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            ((BoostAttribute)target).Boost = boost;
+            ((IBoostAttribute)target).Boost = boost;
         }
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net/Search/FuzzyTermsEnum.cs b/src/Lucene.Net/Search/FuzzyTermsEnum.cs
index 342c45765..88c7ea778 100644
--- a/src/Lucene.Net/Search/FuzzyTermsEnum.cs
+++ b/src/Lucene.Net/Search/FuzzyTermsEnum.cs
@@ -494,9 +494,9 @@ namespace Lucene.Net.Search
                 return automata.Equals(((LevenshteinAutomataAttribute)other).automata);
             }
 
-            public override void CopyTo(IAttribute target)
+            public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
             {
-                IList<CompiledAutomaton> targetAutomata = ((LevenshteinAutomataAttribute)target).Automata;
+                IList<CompiledAutomaton> targetAutomata = ((ILevenshteinAutomataAttribute)target).Automata;
                 targetAutomata.Clear();
                 targetAutomata.AddRange(automata);
             }
diff --git a/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs b/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs
index 4359769ab..6ee48c612 100644
--- a/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs
+++ b/src/Lucene.Net/Search/MaxNonCompetitiveBoostAttributeImpl.cs
@@ -51,9 +51,9 @@ namespace Lucene.Net.Search
             competitiveTerm = null;
         }
 
-        public override void CopyTo(IAttribute target)
+        public override void CopyTo(IAttribute target) // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
         {
-            MaxNonCompetitiveBoostAttribute t = (MaxNonCompetitiveBoostAttribute)target;
+            IMaxNonCompetitiveBoostAttribute t = (IMaxNonCompetitiveBoostAttribute)target;
             t.MaxNonCompetitiveBoost = maxNonCompetitiveBoost;
             t.CompetitiveTerm = competitiveTerm;
         }
diff --git a/src/Lucene.Net/Util/Attribute.cs b/src/Lucene.Net/Util/Attribute.cs
index 782392f40..6c1372462 100644
--- a/src/Lucene.Net/Util/Attribute.cs
+++ b/src/Lucene.Net/Util/Attribute.cs
@@ -1,4 +1,4 @@
-namespace Lucene.Net.Util
+namespace Lucene.Net.Util
 {
     /*
      * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,6 +20,6 @@ namespace Lucene.Net.Util
     /// <summary> Base interface for attributes.</summary>
     public interface IAttribute
     {
-        void CopyTo(IAttribute target);
+        void CopyTo(IAttribute target); // LUCENENET specific - .NET doesn't recognize this method without a cast, so we define it here to ensure it is visible on all IAttribute interfaces
     }
 }
\ No newline at end of file
diff --git a/src/Lucene.Net/Util/AttributeImpl.cs b/src/Lucene.Net/Util/AttributeImpl.cs
index 33d513341..b2fe0d24e 100644
--- a/src/Lucene.Net/Util/AttributeImpl.cs
+++ b/src/Lucene.Net/Util/AttributeImpl.cs
@@ -195,7 +195,7 @@ namespace Lucene.Net.Util
         /// <paramref name="target"/> attribute. The <paramref name="target"/> implementation must support all the
         /// <see cref="IAttribute"/>s this implementation supports.
         /// </summary>
-        public abstract void CopyTo(IAttribute target);
+        public abstract void CopyTo(IAttribute target); // LUCENENET specific - intentionally expanding target to use IAttribute rather than Attribute
 
         /// <summary> Shallow clone. Subclasses must override this if they
         /// need to clone any members deeply,
diff --git a/src/Lucene.Net/Util/AttributeReflector.cs b/src/Lucene.Net/Util/AttributeReflector.cs
index 906188664..c2b17df70 100644
--- a/src/Lucene.Net/Util/AttributeReflector.cs
+++ b/src/Lucene.Net/Util/AttributeReflector.cs
@@ -1,4 +1,5 @@
-using System;
+using Lucene.Net.Analysis.TokenAttributes;
+using System;
 
 namespace Lucene.Net.Util
 {
@@ -33,8 +34,8 @@ namespace Lucene.Net.Util
         /// <summary>
         /// This method gets called for every property in an <see cref="Attribute"/>/<see cref="AttributeSource"/>
         /// passing the <see cref="Type"/> of the <see cref="IAttribute"/>, a <paramref name="key"/> and the actual <paramref name="value"/>.
-        /// E.g., an invocation of <see cref="Analysis.TokenAttributes.CharTermAttribute.ReflectWith(IAttributeReflector)"/>
-        /// would call this method once using <see cref="T:typeof(Analysis.TokenAttributes.ICharTermAttribute)"/>
+        /// E.g., an invocation of <see cref="CharTermAttribute.ReflectWith(IAttributeReflector)"/>
+        /// would call this method once using <c>typeof(ICharTermAttribute)</c>
         /// as attribute type, <c>"term"</c> as <paramref name="key"/> and the actual <paramref name="value"/> as a <see cref="string"/>.
         /// </summary>
         void Reflect(Type type, string key, object value);


[lucenenet] 06/06: BREAKING: Lucene.Net.Analysis.Kuromoji.Token: Renamed IsKnown() > IsKnown, IsUnknown() > IsUnknown, IsUser() > IsUser.

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit e27faab509d5a828e0f074a20f1271c44d5d2eb9
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Wed Nov 9 23:54:06 2022 +0700

    BREAKING: Lucene.Net.Analysis.Kuromoji.Token: Renamed IsKnown() > IsKnown, IsUnknown() > IsUnknown, IsUser() > IsUser.
---
 src/Lucene.Net.Analysis.Kuromoji/Token.cs | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Kuromoji/Token.cs b/src/Lucene.Net.Analysis.Kuromoji/Token.cs
index ca736b971..802fb1990 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Token.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Token.cs
@@ -141,28 +141,19 @@ namespace Lucene.Net.Analysis.Ja
         /// Returns <c>true</c> if this token is known word.
         /// </summary>
         /// <returns><c>true</c> if this token is in standard dictionary. <c>false</c> if not.</returns>
-        public virtual bool IsKnown()
-        {
-            return type == JapaneseTokenizerType.KNOWN;
-        }
+        public virtual bool IsKnown => type == JapaneseTokenizerType.KNOWN;
 
         /// <summary>
         /// Returns <c>true</c> if this token is unknown word.
         /// </summary>
         /// <returns><c>true</c> if this token is unknown word. <c>false</c> if not.</returns>
-        public virtual bool IsUnknown()
-        {
-            return type == JapaneseTokenizerType.UNKNOWN;
-        }
+        public virtual bool IsUnknown => type == JapaneseTokenizerType.UNKNOWN;
 
         /// <summary>
         /// Returns <c>true</c> if this token is defined in user dictionary.
         /// </summary>
         /// <returns><c>true</c> if this token is in user dictionary. <c>false</c> if not.</returns>
-        public virtual bool IsUser()
-        {
-            return type == JapaneseTokenizerType.USER;
-        }
+        public virtual bool IsUser => type == JapaneseTokenizerType.USER;
 
         /// <summary>
         /// Get index of this token in input text. Returns position of token.