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 2020/02/09 06:16:01 UTC

[lucenenet] 09/35: BREAKING: Factored out Lucene.Net.Support.AssemblyExtensions in favor of J2N's implementation

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 81946c4e228abe62d99fefd6e4601924fc6961d9
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Thu Feb 6 22:43:59 2020 +0700

    BREAKING: Factored out Lucene.Net.Support.AssemblyExtensions in favor of J2N's implementation
---
 .../Analysis/Compound/Hyphenation/PatternParser.cs |   4 +-
 .../Analysis/Util/ClasspathResourceLoader.cs       |   6 +-
 .../Analysis/Util/StopwordAnalyzerBase.cs          |  12 +-
 .../Analysis/Icu/ICUFoldingFilter.cs               |  16 +--
 .../Icu/Segmentation/DefaultICUTokenizerConfig.cs  |   6 +-
 .../Dict/BinaryDictionary.cs                       |   6 +-
 .../Uk/UkrainianMorfologikAnalyzer.cs              |   6 +-
 .../Language/Bm/Lang.cs                            |   5 +-
 .../Language/Bm/Languages.cs                       |   5 +-
 .../Language/Bm/Rule.cs                            |   6 +-
 .../Language/DaitchMokotoffSoundex.cs              |   4 +-
 .../Hhmm/BigramDictionary.cs                       |   5 +-
 .../Hhmm/WordDictionary.cs                         |   5 +-
 .../Pl/PolishAnalyzer.cs                           |  35 +++--
 .../ByTask/Feeds/FileBasedQueryMaker.cs            |   7 +-
 .../JS/JavascriptCompiler.cs                       |   4 +-
 .../JavaCompatibility/SystemTypesHelpers.cs        |   5 +-
 .../Util/LuceneTestCase.cs                         |   2 +-
 .../Analysis/Util/TestFilesystemResourceLoader.cs  |   5 +-
 .../Tools/TestBuildDictionary.cs                   |   7 +-
 .../Suggest/LookupBenchmarkTest.cs                 |  11 +-
 .../Index/TestBackwardsCompatibility.cs            |   6 +-
 .../Index/TestBackwardsCompatibility3x.cs          |  10 +-
 .../Index/TestBinaryDocValuesUpdates.cs            |   9 +-
 src/Lucene.Net.Tests/Store/TestDirectory.cs        |   4 +-
 src/Lucene.Net/Support/AssemblyExtensions.cs       | 160 ---------------------
 .../Support/Util/BundleResourceManagerFactory.cs   |   4 +-
 src/Lucene.Net/Util/IOUtils.cs                     |   5 +-
 .../Support/JDKBreakIterator.cs                    |   6 +-
 .../SourceCode/SourceCodeParserTest.cs             |   7 +-
 .../tools/lucene-cli/SourceCode/ConsolePager.cs    |  29 +---
 .../lucene-cli/SourceCode/SourceCodeExporter.cs    |   6 +-
 32 files changed, 106 insertions(+), 302 deletions(-)

diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
index b49e37d..c48a6fa 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Compound/Hyphenation/PatternParser.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using J2N;
 using System;
 using System.Collections.Generic;
 using System.IO;
@@ -404,7 +404,7 @@ namespace Lucene.Net.Analysis.Compound.Hyphenation
                 string dtdFilename = "hyphenation.dtd";
                 if (dtdFilename.Equals(absoluteUri.Segments.LastOrDefault(), StringComparison.Ordinal))
                 {
-                    return GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(PatternParser), dtdFilename);
+                    return typeof(PatternParser).FindAndGetManifestResourceStream(dtdFilename);
                 }
 
                 return base.GetEntity(absoluteUri, role, ofObjectToReturn);
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/ClasspathResourceLoader.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/ClasspathResourceLoader.cs
index c6ecdcf..d7db1c0 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/ClasspathResourceLoader.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/ClasspathResourceLoader.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using J2N;
 using System;
 using System.IO;
 using System.Reflection;
@@ -44,6 +44,10 @@ namespace Lucene.Net.Analysis.Util
 
         public Stream OpenResource(string resource)
         {
+            // LUCENENET NOTE: For some unknown reason, the shorthand version of this line
+            // Stream stream = this.clazz.FindAndGetManifestResourceStream(resource);
+            // causes TestMappingCharFilter.TestRandomMaps2 to run 2-3 times slower.
+            // So, we are using the long-hand syntax in this one place.
             Stream stream = this.clazz.GetTypeInfo().Assembly.FindAndGetManifestResourceStream(clazz, resource);
             if (stream == null)
             {
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/StopwordAnalyzerBase.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/StopwordAnalyzerBase.cs
index 8bb3f0b..8e0a86c 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/StopwordAnalyzerBase.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/StopwordAnalyzerBase.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using J2N;
 using Lucene.Net.Util;
 using System;
 using System.IO;
@@ -42,13 +42,7 @@ namespace Lucene.Net.Analysis.Util
         /// </summary>
         /// <returns> the analyzer's stopword set or an empty set if the analyzer has no
         ///         stopwords </returns>
-        public virtual CharArraySet StopwordSet
-        {
-            get
-            {
-                return m_stopwords;
-            }
-        }
+        public virtual CharArraySet StopwordSet => m_stopwords;
 
         /// <summary>
         /// Creates a new instance initialized with the given stopword set
@@ -96,7 +90,7 @@ namespace Lucene.Net.Analysis.Util
             TextReader reader = null;
             try
             {
-                var resourceStream = aClass.GetTypeInfo().Assembly.FindAndGetManifestResourceStream(aClass, resource);
+                var resourceStream = aClass.FindAndGetManifestResourceStream(resource);
                 reader = IOUtils.GetDecodingReader(resourceStream, Encoding.UTF8);
                 return WordlistLoader.GetWordSet(reader, comment, new CharArraySet(
 #pragma warning disable 612, 618
diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUFoldingFilter.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUFoldingFilter.cs
index 12780bd..590f5b9 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUFoldingFilter.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/ICUFoldingFilter.cs
@@ -1,5 +1,6 @@
 // Lucene version compatibility level 7.1.0
 using ICU4N.Text;
+using J2N;
 using Lucene.Net.Support;
 using System.Reflection;
 
@@ -64,7 +65,11 @@ namespace Lucene.Net.Analysis.Icu
     [ExceptionToClassNameConvention]
     public sealed class ICUFoldingFilter : ICUNormalizer2Filter
     {
-        private static readonly Normalizer2 normalizer;
+        // TODO: if the wrong version of the ICU jar is used, loading these data files may give a strange error.
+        // maybe add an explicit check? http://icu-project.org/apiref/icu4j/com/ibm/icu/util/VersionInfo.html
+        private static readonly Normalizer2 normalizer = Normalizer2.GetInstance(
+            typeof(ICUFoldingFilter).FindAndGetManifestResourceStream("utr30.nrm"),
+            "utr30", Normalizer2Mode.Compose);
 
         /// <summary>
         /// Create a new <see cref="ICUFoldingFilter"/> on the specified input
@@ -73,14 +78,5 @@ namespace Lucene.Net.Analysis.Icu
             : base(input, normalizer)
         {
         }
-
-        static ICUFoldingFilter()
-        {
-            // TODO: if the wrong version of the ICU jar is used, loading these data files may give a strange error.
-            // maybe add an explicit check? http://icu-project.org/apiref/icu4j/com/ibm/icu/util/VersionInfo.html
-            normalizer = Normalizer2.GetInstance(
-                typeof(ICUFoldingFilter).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(ICUFoldingFilter), "utr30.nrm"),
-                "utr30", Normalizer2Mode.Compose);
-        }
     }
 }
diff --git a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/DefaultICUTokenizerConfig.cs b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/DefaultICUTokenizerConfig.cs
index bdee024..fb1cff9 100644
--- a/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/DefaultICUTokenizerConfig.cs
+++ b/src/Lucene.Net.Analysis.ICU/Analysis/Icu/Segmentation/DefaultICUTokenizerConfig.cs
@@ -2,11 +2,10 @@
 using ICU4N.Globalization;
 using ICU4N.Text;
 using ICU4N.Util;
+using J2N;
 using Lucene.Net.Analysis.Standard;
-using Lucene.Net.Support;
 using System;
 using System.IO;
-using System.Reflection;
 
 namespace Lucene.Net.Analysis.Icu.Segmentation
 {
@@ -132,8 +131,7 @@ namespace Lucene.Net.Analysis.Icu.Segmentation
 
         private static RuleBasedBreakIterator ReadBreakIterator(string filename)
         {
-            using (Stream @is =
-              typeof(DefaultICUTokenizerConfig).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(DefaultICUTokenizerConfig), filename))
+            using (Stream @is = typeof(DefaultICUTokenizerConfig).FindAndGetManifestResourceStream(filename))
             {
                 try
                 {
diff --git a/src/Lucene.Net.Analysis.Kuromoji/Dict/BinaryDictionary.cs b/src/Lucene.Net.Analysis.Kuromoji/Dict/BinaryDictionary.cs
index 1302a54..f8514d6 100644
--- a/src/Lucene.Net.Analysis.Kuromoji/Dict/BinaryDictionary.cs
+++ b/src/Lucene.Net.Analysis.Kuromoji/Dict/BinaryDictionary.cs
@@ -1,11 +1,11 @@
-using J2N.IO;
+using J2N;
+using J2N.IO;
 using Lucene.Net.Codecs;
 using Lucene.Net.Store;
 using Lucene.Net.Support;
 using Lucene.Net.Util;
 using System;
 using System.IO;
-using System.Reflection;
 using System.Security;
 
 namespace Lucene.Net.Analysis.Ja.Dict
@@ -186,7 +186,7 @@ namespace Lucene.Net.Analysis.Ja.Dict
             // we load the data from the kuromoji-data directory (which can be set via the kuromoji.data.dir environment variable).
             if (string.IsNullOrEmpty(DATA_DIR))
             {
-                Stream @is = clazz.GetTypeInfo().Assembly.FindAndGetManifestResourceStream(clazz, fileName);
+                Stream @is = clazz.FindAndGetManifestResourceStream(fileName);
                 if (@is == null)
                     throw new FileNotFoundException("Not in assembly: " + clazz.FullName + suffix);
                 return @is;
diff --git a/src/Lucene.Net.Analysis.Morfologik/Uk/UkrainianMorfologikAnalyzer.cs b/src/Lucene.Net.Analysis.Morfologik/Uk/UkrainianMorfologikAnalyzer.cs
index eb6648c..6e3ecc8 100644
--- a/src/Lucene.Net.Analysis.Morfologik/Uk/UkrainianMorfologikAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Morfologik/Uk/UkrainianMorfologikAnalyzer.cs
@@ -1,11 +1,11 @@
 // Lucene version compatibility level 8.2.0
+using J2N;
 using Lucene.Net.Analysis.CharFilters;
 using Lucene.Net.Analysis.Core;
 using Lucene.Net.Analysis.Miscellaneous;
 using Lucene.Net.Analysis.Morfologik;
 using Lucene.Net.Analysis.Standard;
 using Lucene.Net.Analysis.Util;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using Morfologik.Stemming;
 using System;
@@ -164,8 +164,8 @@ namespace Lucene.Net.Analysis.Uk
                 // (see https://search.maven.org/search?q=a:morfologik-ukrainian-search). However, we are embedding the file in .NET.
                 // Since it doesn't appear to be updated frequently, this should be okay.
                 string dictFile = "ukrainian.dict";
-                using (var dictStream = type.Assembly.FindAndGetManifestResourceStream(type, dictFile))
-                using (var metadataStream = type.Assembly.FindAndGetManifestResourceStream(type, DictionaryMetadata.GetExpectedMetadataFileName(dictFile)))
+                using (var dictStream = type.FindAndGetManifestResourceStream(dictFile))
+                using (var metadataStream = type.FindAndGetManifestResourceStream(DictionaryMetadata.GetExpectedMetadataFileName(dictFile)))
                     return Dictionary.Read(dictStream, metadataStream);
             }
             catch (IOException e)
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
index 95cab22..27db241 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Lang.cs
@@ -1,11 +1,10 @@
 // commons-codec version compatibility level: 1.9
+using J2N;
 using J2N.Collections.Generic.Extensions;
 using J2N.Text;
-using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 using System.Text.RegularExpressions;
 using JCG = J2N.Collections.Generic;
 
@@ -149,7 +148,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
         public static Lang LoadFromResource(string languageRulesResourceName, Languages languages)
         {
             IList<LangRule> rules = new List<LangRule>();
-            Stream lRulesIS = typeof(Lang).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(Lang), languageRulesResourceName);
+            Stream lRulesIS = typeof(Lang).FindAndGetManifestResourceStream(languageRulesResourceName);
 
             if (lRulesIS == null)
             {
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Languages.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Languages.cs
index d01f343..b5865b5 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Languages.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Languages.cs
@@ -1,11 +1,10 @@
 // commons-codec version compatibility level: 1.9
+using J2N;
 using J2N.Collections.Generic.Extensions;
-using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Reflection;
 using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.Analysis.Phonetic.Language.Bm
@@ -92,7 +91,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
         {
             // read languages list
             ISet<string> ls = new JCG.HashSet<string>();
-            Stream langIS = typeof(Languages).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(Languages), languagesResourceName);
+            Stream langIS = typeof(Languages).FindAndGetManifestResourceStream(languagesResourceName);
 
             if (langIS == null)
             {
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
index 9506f2a..7b0d413 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/Rule.cs
@@ -1,11 +1,11 @@
 // commons-codec version compatibility level: 1.9
+using J2N;
 using J2N.Collections.Generic.Extensions;
 using J2N.Text;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 using System.Text;
 using System.Text.RegularExpressions;
 using JCG = J2N.Collections.Generic;
@@ -200,7 +200,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
         private static TextReader CreateScanner(NameType nameType, RuleType rt, string lang)
         {
             string resName = CreateResourceName(nameType, rt, lang);
-            Stream rulesIS = typeof(Languages).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(Languages), resName);
+            Stream rulesIS = typeof(Languages).FindAndGetManifestResourceStream(resName);
 
             if (rulesIS == null)
             {
@@ -213,7 +213,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language.Bm
         private static TextReader CreateScanner(string lang)
         {
             string resName = string.Format("{0}.txt", lang); 
-            Stream rulesIS = typeof(Languages).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(Languages), resName);
+            Stream rulesIS = typeof(Languages).FindAndGetManifestResourceStream(resName);
 
             if (rulesIS == null)
             {
diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs b/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
index 883e274..9c61e45 100644
--- a/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
+++ b/src/Lucene.Net.Analysis.Phonetic/Language/DaitchMokotoffSoundex.cs
@@ -1,10 +1,10 @@
 // commons-codec version compatibility level: 1.10
+using J2N;
 using J2N.Text;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 using System.Text;
 using System.Text.RegularExpressions;
 
@@ -253,7 +253,7 @@ namespace Lucene.Net.Analysis.Phonetic.Language
 
         static DaitchMokotoffSoundex()
         {
-            Stream rulesIS = typeof(DaitchMokotoffSoundex).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(DaitchMokotoffSoundex), RESOURCE_FILE);
+            Stream rulesIS = typeof(DaitchMokotoffSoundex).FindAndGetManifestResourceStream(RESOURCE_FILE);
             if (rulesIS == null)
             {
                 throw new ArgumentException("Unable to load resource: " + RESOURCE_FILE);
diff --git a/src/Lucene.Net.Analysis.SmartCn/Hhmm/BigramDictionary.cs b/src/Lucene.Net.Analysis.SmartCn/Hhmm/BigramDictionary.cs
index 0b2eab1..9ca0b57 100644
--- a/src/Lucene.Net.Analysis.SmartCn/Hhmm/BigramDictionary.cs
+++ b/src/Lucene.Net.Analysis.SmartCn/Hhmm/BigramDictionary.cs
@@ -1,9 +1,8 @@
 // lucene version compatibility level: 4.8.1
+using J2N;
 using J2N.IO;
-using Lucene.Net.Support;
 using System;
 using System.IO;
-using System.Reflection;
 using System.Text;
 
 namespace Lucene.Net.Analysis.Cn.Smart.Hhmm
@@ -244,7 +243,7 @@ namespace Lucene.Net.Analysis.Cn.Smart.Hhmm
 
         private void Load()
         {
-            using (Stream input = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(this.GetType(), "bigramdict.mem"))
+            using (Stream input = this.GetType().FindAndGetManifestResourceStream("bigramdict.mem"))
             {
                 LoadFromInputStream(input);
             }
diff --git a/src/Lucene.Net.Analysis.SmartCn/Hhmm/WordDictionary.cs b/src/Lucene.Net.Analysis.SmartCn/Hhmm/WordDictionary.cs
index 517cc9d..8b4bce3 100644
--- a/src/Lucene.Net.Analysis.SmartCn/Hhmm/WordDictionary.cs
+++ b/src/Lucene.Net.Analysis.SmartCn/Hhmm/WordDictionary.cs
@@ -1,9 +1,8 @@
 // lucene version compatibility level: 4.8.1
+using J2N;
 using J2N.IO;
-using Lucene.Net.Support;
 using System;
 using System.IO;
-using System.Reflection;
 using System.Text;
 
 namespace Lucene.Net.Analysis.Cn.Smart.Hhmm
@@ -166,7 +165,7 @@ namespace Lucene.Net.Analysis.Cn.Smart.Hhmm
         /// <exception cref="IOException">If there is a low-level I/O error.</exception>
         public virtual void Load()
         {
-            using (Stream input = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(this.GetType(), "coredict.mem"))
+            using (Stream input = this.GetType().FindAndGetManifestResourceStream("coredict.mem"))
             {
                 LoadFromObjectInputStream(input);
             }
diff --git a/src/Lucene.Net.Analysis.Stempel/Pl/PolishAnalyzer.cs b/src/Lucene.Net.Analysis.Stempel/Pl/PolishAnalyzer.cs
index a830aef..84b800e 100644
--- a/src/Lucene.Net.Analysis.Stempel/Pl/PolishAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Stempel/Pl/PolishAnalyzer.cs
@@ -1,35 +1,34 @@
 using Egothor.Stemmer;
+using J2N;
 using Lucene.Net.Analysis.Core;
 using Lucene.Net.Analysis.Miscellaneous;
 using Lucene.Net.Analysis.Standard;
 using Lucene.Net.Analysis.Stempel;
 using Lucene.Net.Analysis.Util;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using System;
 using System.IO;
 using System.Linq;
 using System.Text;
-using System.Reflection;
 
 namespace Lucene.Net.Analysis.Pl
 {
     /*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
 
     /// <summary>
     /// <see cref="Analyzer"/> for Polish.
@@ -97,7 +96,7 @@ namespace Lucene.Net.Analysis.Pl
             {
                 try
                 {
-                    return StempelStemmer.Load(typeof(PolishAnalyzer).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(PolishAnalyzer), DEFAULT_STEMMER_FILE));
+                    return StempelStemmer.Load(typeof(PolishAnalyzer).FindAndGetManifestResourceStream(DEFAULT_STEMMER_FILE));
                 }
                 catch (IOException ex)
                 {
diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs
index 350870d..206fff9 100644
--- a/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs
+++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/FileBasedQueryMaker.cs
@@ -1,13 +1,12 @@
-using Lucene.Net.Analysis;
+using J2N;
+using Lucene.Net.Analysis;
 using Lucene.Net.Benchmarks.ByTask.Tasks;
 using Lucene.Net.QueryParsers.Classic;
 using Lucene.Net.Search;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 using System.Text;
 using Console = Lucene.Net.Support.SystemConsole;
 
@@ -76,7 +75,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds
                 else
                 {
                     //see if we can find it as a resource
-                    Stream asStream = typeof(FileBasedQueryMaker).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(FileBasedQueryMaker), fileName);
+                    Stream asStream = typeof(FileBasedQueryMaker).FindAndGetManifestResourceStream(fileName);
                     if (asStream != null)
                     {
                         reader = IOUtils.GetDecodingReader(asStream, Encoding.UTF8);
diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
index 36f0bd3..4af7815 100644
--- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
+++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs
@@ -11,6 +11,7 @@ using System.Linq;
 using System.Reflection;
 using System.Reflection.Emit;
 using JCG = J2N.Collections.Generic;
+using J2N;
 
 #if NETSTANDARD
 using System.IO;
@@ -659,8 +660,7 @@ namespace Lucene.Net.Expressions.JS
 #if NETSTANDARD
             var settings = new Dictionary<string, string>();
             var type = typeof(JavascriptCompiler);
-            var assembly = type.GetTypeInfo().Assembly;
-            using (var reader = new StreamReader(assembly.FindAndGetManifestResourceStream(type, type.GetTypeInfo().Name + ".properties")))
+            using (var reader = new StreamReader(type.FindAndGetManifestResourceStream(type.GetTypeInfo().Name + ".properties")))
             {
                 string line;
                 while(!string.IsNullOrWhiteSpace(line = reader.ReadLine()))
diff --git a/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs b/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs
index 200b36d..4b7e152 100644
--- a/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs
+++ b/src/Lucene.Net.TestFramework/Support/JavaCompatibility/SystemTypesHelpers.cs
@@ -1,11 +1,10 @@
-using Lucene.Net.Support;
+using J2N;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Globalization;
 using System.IO;
 using System.Linq;
-using System.Reflection;
 using System.Text;
 using System.Text.RegularExpressions;
 using Console = Lucene.Net.Support.SystemConsole;
@@ -299,7 +298,7 @@ namespace Lucene.Net
         /// </summary>
         public static Stream getResourceAsStream(this Type t, string name)
         {
-            return t.GetTypeInfo().Assembly.FindAndGetManifestResourceStream(t, name);
+            return t.FindAndGetManifestResourceStream(name);
         }
 
         public static int read(this TextReader reader, char[] buffer)
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 565e34b..d3b3b26 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2117,7 +2117,7 @@ namespace Lucene.Net.Util
         /// <summary>
         /// Gets a resource from the classpath as <see cref="Stream"/>. This method should only
         /// be used, if a real file is needed. To get a stream, code should prefer
-        /// <see cref="Lucene.Net.Support.AssemblyExtensions.FindAndGetManifestResourceStream(Assembly, Type, string)"/> using 
+        /// <see cref="J2N.AssemblyExtensions.FindAndGetManifestResourceStream(Assembly, Type, string)"/> using 
         /// <c>this.GetType().Assembly</c> and <c>this.GetType()</c>.
         /// </summary>
         protected virtual Stream GetDataFile(string name)
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestFilesystemResourceLoader.cs b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestFilesystemResourceLoader.cs
index 373707a..dfbbe3a 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestFilesystemResourceLoader.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Util/TestFilesystemResourceLoader.cs
@@ -1,10 +1,9 @@
-using Lucene.Net.Support;
+using J2N;
 using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
 using System.IO;
 using System.Linq;
-using System.Reflection;
 using System.Text;
 
 namespace Lucene.Net.Analysis.Util
@@ -58,7 +57,7 @@ namespace Lucene.Net.Analysis.Util
             // before passing it to our resource loader.
             string englishStopFile = "english_stop.txt";
             var file = CreateTempFile(System.IO.Path.GetFileNameWithoutExtension(englishStopFile), System.IO.Path.GetExtension(englishStopFile));
-            using (var stream = typeof(Snowball.SnowballFilter).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(Snowball.SnowballFilter), englishStopFile))
+            using (var stream = typeof(Snowball.SnowballFilter).FindAndGetManifestResourceStream(englishStopFile))
             {
                 using (var outputStream = new FileStream(file.FullName, FileMode.OpenOrCreate, FileAccess.Write))
                 {
diff --git a/src/Lucene.Net.Tests.Analysis.Kuromoji/Tools/TestBuildDictionary.cs b/src/Lucene.Net.Tests.Analysis.Kuromoji/Tools/TestBuildDictionary.cs
index 9f13314..e18dec3 100644
--- a/src/Lucene.Net.Tests.Analysis.Kuromoji/Tools/TestBuildDictionary.cs
+++ b/src/Lucene.Net.Tests.Analysis.Kuromoji/Tools/TestBuildDictionary.cs
@@ -1,10 +1,9 @@
-using Lucene.Net.Analysis.Ja.Util;
+using J2N;
+using Lucene.Net.Analysis.Ja.Util;
 using Lucene.Net.Attributes;
-using Lucene.Net.Support;
 using Lucene.Net.Util;
 using NUnit.Framework;
 using System.Collections.Generic;
-using System.Reflection;
 
 namespace Lucene.Net.Analysis.Ja.Tools
 {
@@ -41,7 +40,7 @@ namespace Lucene.Net.Analysis.Ja.Tools
         {
             var inputDir = CreateTempDir("build-dictionary-input");
             var outputDir = CreateTempDir("build-dictionary-output");
-            using (var zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(this.GetType(), "custom-dictionary-input.zip"))
+            using (var zipFileStream = this.GetType().FindAndGetManifestResourceStream("custom-dictionary-input.zip"))
             {
                 TestUtil.Unzip(zipFileStream, inputDir);
             }
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
index f1a9a81..92a48fe 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/LookupBenchmarkTest.cs
@@ -1,4 +1,5 @@
-using J2N.Collections.Generic.Extensions;
+using J2N;
+using J2N.Collections.Generic.Extensions;
 using Lucene.Net.Analysis;
 using Lucene.Net.Search.Suggest.Analyzing;
 using Lucene.Net.Search.Suggest.Fst;
@@ -91,9 +92,7 @@ namespace Lucene.Net.Search.Suggest
         {
             List<Input> input = new List<Input>();
 
-            //URL resource = LookupBenchmarkTest.class.getResource("Top50KWiki.utf8");
-            //var resource = typeof(LookupBenchmarkTest).GetTypeInfo().Assembly.GetManifestResourceStream("Lucene.Net.Tests.Suggest.Suggest.Top50KWiki.utf8");
-            var resource = typeof(LookupBenchmarkTest).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(LookupBenchmarkTest), "Top50KWiki.utf8");
+            var resource = typeof(LookupBenchmarkTest).FindAndGetManifestResourceStream("Top50KWiki.utf8");
             Debug.Assert(resource != null, "Resource missing: Top50KWiki.utf8");
 
             string line = null;
@@ -297,9 +296,9 @@ namespace Lucene.Net.Search.Suggest
                 List<double> times = new List<double>();
                 for (int i = 0; i < warmup + rounds; i++)
                 {
-                    long start = Time.NanoTime();
+                    long start = J2N.Time.NanoTime();
                     guard = Convert.ToInt32(callable.Call());
-                    times.Add((Time.NanoTime() - start) / NANOS_PER_MS );
+                    times.Add((J2N.Time.NanoTime() - start) / NANOS_PER_MS );
                 }
                 return new BenchmarkResult(times, warmup, rounds);
             }
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
index cd2623d..f0dba16 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility.cs
@@ -1,3 +1,4 @@
+using J2N;
 using Lucene.Net.Attributes;
 using Lucene.Net.Index.Extensions;
 using Lucene.Net.Support;
@@ -7,7 +8,6 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using System.Linq;
-using System.Reflection;
 using System.Text;
 using Console = Lucene.Net.Support.SystemConsole;
 
@@ -209,7 +209,7 @@ namespace Lucene.Net.Index
             foreach (string name in names)
             {
                 DirectoryInfo dir = CreateTempDir(name);
-                using (Stream zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "index." + name + ".zip"))
+                using (Stream zipFileStream = this.GetType().FindAndGetManifestResourceStream("index." + name + ".zip"))
                 {
                     TestUtil.Unzip(zipFileStream, dir);
                 }
@@ -953,7 +953,7 @@ namespace Lucene.Net.Index
             foreach (string name in OldIndexDirs.Keys)
             {
                 DirectoryInfo dir = CreateTempDir(name);
-                using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "index." + name + ".zip"))
+                using (Stream dataFile = this.GetType().FindAndGetManifestResourceStream("index." + name + ".zip"))
                 {
                     TestUtil.Unzip(dataFile, dir);
                 }
diff --git a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
index 8dbda2d..95bf649 100644
--- a/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
+++ b/src/Lucene.Net.Tests/Index/TestBackwardsCompatibility3x.cs
@@ -1,3 +1,4 @@
+using J2N;
 using Lucene.Net.Index.Extensions;
 using Lucene.Net.Support;
 using NUnit.Framework;
@@ -5,7 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
-using System.Reflection;
 using System.Text;
 using Console = Lucene.Net.Support.SystemConsole;
 
@@ -141,7 +141,7 @@ namespace Lucene.Net.Index
             foreach (string name in names)
             {
                 DirectoryInfo dir = CreateTempDir(name);
-                using (Stream zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "index." + name + ".zip"))
+                using (Stream zipFileStream = this.GetType().FindAndGetManifestResourceStream("index." + name + ".zip"))
                 {
                     TestUtil.Unzip(zipFileStream, dir);
                 }
@@ -172,7 +172,7 @@ namespace Lucene.Net.Index
                     Console.WriteLine("TEST: index " + UnsupportedNames[i]);
                 }
                 DirectoryInfo oldIndexDir = CreateTempDir(UnsupportedNames[i]);
-                using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "unsupported." + UnsupportedNames[i] + ".zip"))
+                using (Stream dataFile = this.GetType().FindAndGetManifestResourceStream("unsupported." + UnsupportedNames[i] + ".zip"))
                 {
                     TestUtil.Unzip(dataFile, oldIndexDir);
                 }
@@ -963,7 +963,7 @@ namespace Lucene.Net.Index
         public virtual void TestSurrogates()
         {
             DirectoryInfo oldIndexDir = CreateTempDir("surrogates");
-            using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), SurrogatesIndexName))
+            using (Stream dataFile = this.GetType().FindAndGetManifestResourceStream(SurrogatesIndexName))
             {
                 TestUtil.Unzip(dataFile, oldIndexDir);
             }
@@ -1025,7 +1025,7 @@ namespace Lucene.Net.Index
         public virtual void TestNegativePositions()
         {
             DirectoryInfo oldIndexDir = CreateTempDir("negatives");
-            using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), Bogus24IndexName))
+            using (Stream dataFile = this.GetType().FindAndGetManifestResourceStream(Bogus24IndexName))
             {
                 TestUtil.Unzip(dataFile, oldIndexDir);
             }
diff --git a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs
index 8068e3a..0165d3d 100644
--- a/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs
+++ b/src/Lucene.Net.Tests/Index/TestBinaryDocValuesUpdates.cs
@@ -1,7 +1,7 @@
+using J2N;
 using J2N.Threading;
 using J2N.Threading.Atomic;
 using Lucene.Net.Attributes;
-using Lucene.Net.Codecs;
 using Lucene.Net.Documents;
 using Lucene.Net.Facet;
 using Lucene.Net.Facet.Taxonomy;
@@ -15,10 +15,9 @@ using NUnit.Framework;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 using System.Threading;
-using JCG = J2N.Collections.Generic;
 using Console = Lucene.Net.Support.SystemConsole;
+using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.Index
 {
@@ -1807,14 +1806,14 @@ namespace Lucene.Net.Index
 
             // Unzip index
             DirectoryInfo indexDir = CreateTempDir("index");
-            using (Stream zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "index.48.w-binary-doc-values.zip"))
+            using (Stream zipFileStream = this.GetType().FindAndGetManifestResourceStream("index.48.w-binary-doc-values.zip"))
             {
                 TestUtil.Unzip(zipFileStream, indexDir);
             }
 
             // Unzip taxonomy
             DirectoryInfo taxoDir = CreateTempDir("taxo");
-            using (Stream zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "taxo.48.w-binary-doc-values.zip"))
+            using (Stream zipFileStream = this.GetType().FindAndGetManifestResourceStream("taxo.48.w-binary-doc-values.zip"))
             {
                 TestUtil.Unzip(zipFileStream, taxoDir);
             }
diff --git a/src/Lucene.Net.Tests/Store/TestDirectory.cs b/src/Lucene.Net.Tests/Store/TestDirectory.cs
index 3987d23..a1b606e 100644
--- a/src/Lucene.Net.Tests/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/Store/TestDirectory.cs
@@ -1,3 +1,4 @@
+using J2N;
 using J2N.Threading;
 using Lucene.Net.Attributes;
 using Lucene.Net.Support;
@@ -5,7 +6,6 @@ using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
 using System.IO;
-using System.Reflection;
 using System.Threading;
 using Console = Lucene.Net.Support.SystemConsole;
 
@@ -485,7 +485,7 @@ namespace Lucene.Net.Store
         public void TestLUCENENET521()
         {
             var newDirectoryInfo = CreateTempDir("LUCENENET521");
-            using (var zipFileStream = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(this.GetType(), "LUCENENET521.zip"))
+            using (var zipFileStream = this.GetType().FindAndGetManifestResourceStream("LUCENENET521.zip"))
             {
                 TestUtil.Unzip(zipFileStream, newDirectoryInfo);
             }
diff --git a/src/Lucene.Net/Support/AssemblyExtensions.cs b/src/Lucene.Net/Support/AssemblyExtensions.cs
deleted file mode 100644
index 7b6f9e0..0000000
--- a/src/Lucene.Net/Support/AssemblyExtensions.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-
-namespace Lucene.Net.Support
-{
-    /*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-    public static class AssemblyExtensions
-    {
-        private static ConcurrentDictionary<TypeAndResource, string> resourceCache = new ConcurrentDictionary<TypeAndResource, string>();
-
-        /// <summary>
-        /// Aggressively searches for a resource and, if found, returns an open <see cref="Stream"/>
-        /// where it can be read.
-        /// </summary>
-        /// <param name="assembly">this assembly</param>
-        /// <param name="type">a type in the same namespace as the resource</param>
-        /// <param name="name">the resource name to locate</param>
-        /// <returns>an open <see cref="Stream"/> that can be used to read the resource, or <c>null</c> if the resource cannot be found.</returns>
-        public static Stream FindAndGetManifestResourceStream(this Assembly assembly, Type type, string name)
-        {
-            string resourceName = FindResource(assembly, type, name);
-            if (string.IsNullOrEmpty(resourceName))
-            {
-                return null;
-            }
-
-            return assembly.GetManifestResourceStream(resourceName);
-        }
-
-        /// <summary>
-        /// Aggressively searches to find a resource based on a <see cref="Type"/> and resource name.
-        /// </summary>
-        /// <param name="assembly">this assembly</param>
-        /// <param name="type">a type in the same namespace as the resource</param>
-        /// <param name="name">the resource name to locate</param>
-        /// <returns>the resource, if found; if not found, returns <c>null</c></returns>
-        public static string FindResource(this Assembly assembly, Type type, string name)
-        {
-            string resourceName;
-            TypeAndResource key = new TypeAndResource(type, name);
-            if (!resourceCache.TryGetValue(key, out resourceName))
-            {
-                string[] resourceNames = assembly.GetManifestResourceNames();
-                resourceName = resourceNames.Where(x => x.Equals(name, StringComparison.Ordinal)).FirstOrDefault();
-
-                // If resourceName is not null, we have an exact match, don't search
-                if (resourceName == null)
-                {
-                    string assemblyName = type.GetTypeInfo().Assembly.GetName().Name;
-                    string namespaceName = type.GetTypeInfo().Namespace;
-
-                    // Search by assembly + namespace
-                    string resourceToFind = string.Concat(namespaceName, ".", name);
-                    if (!TryFindResource(resourceNames, assemblyName, resourceToFind, name, out resourceName))
-                    {
-                        string found1 = resourceName;
-
-                        // Search by namespace only
-                        if (!TryFindResource(resourceNames, null, resourceToFind, name, out resourceName))
-                        {
-                            string found2 = resourceName;
-
-                            // Search by assembly name only
-                            resourceToFind = string.Concat(assemblyName, ".", name);
-                            if (!TryFindResource(resourceNames, null, resourceToFind, name, out resourceName))
-                            {
-                                // Take the first match of multiple, if there are any
-                                resourceName = found1 ?? found2 ?? resourceName;
-                            }
-                        }
-                    }
-                }
-
-                resourceCache[key] = resourceName;
-            }
-
-            return resourceName;
-        }
-
-        private static bool TryFindResource(string[] resourceNames, string prefix, string resourceName, string exactResourceName, out string result)
-        {
-            if (!resourceNames.Contains(resourceName))
-            {
-                string nameToFind = null;
-                while (resourceName.Length > 0 && resourceName.Contains('.') && (!(string.IsNullOrEmpty(prefix)) || resourceName.Equals(exactResourceName, StringComparison.Ordinal)))
-                {
-                    nameToFind = string.IsNullOrEmpty(prefix)
-                        ? resourceName
-                        : string.Concat(prefix, ".", resourceName);
-                    string[] matches = resourceNames.Where(x => x.EndsWith(nameToFind, StringComparison.Ordinal)).ToArray();
-                    if (matches.Length == 1)
-                    {
-                        result = matches[0]; // Exact match
-                        return true;
-                    }
-                    else if (matches.Length > 1)
-                    {
-                        result = matches[0]; // First of many
-                        return false;
-                    }
-
-                    resourceName = resourceName.Substring(resourceName.IndexOf('.') + 1);
-                }
-                result = null; // No match
-                return false;
-            }
-
-            result = resourceName;
-            return true;
-        }
-
-        private class TypeAndResource
-        {
-            private readonly Type type;
-            private readonly string name;
-
-            public TypeAndResource(Type type, string name)
-            {
-                this.type = type;
-                this.name = name;
-            }
-
-            public override bool Equals(object obj)
-            {
-                if (!(obj is TypeAndResource))
-                {
-                    return false;
-                }
-
-                var other = obj as TypeAndResource;
-                return this.type.Equals(other.type)
-                    && this.name.Equals(other.name, StringComparison.Ordinal);
-            }
-
-            public override int GetHashCode()
-            {
-                return this.type.GetHashCode() ^ this.name.GetHashCode();
-            }
-        }
-    }
-}
diff --git a/src/Lucene.Net/Support/Util/BundleResourceManagerFactory.cs b/src/Lucene.Net/Support/Util/BundleResourceManagerFactory.cs
index 2635048..28c134c 100644
--- a/src/Lucene.Net/Support/Util/BundleResourceManagerFactory.cs
+++ b/src/Lucene.Net/Support/Util/BundleResourceManagerFactory.cs
@@ -1,4 +1,4 @@
-using Lucene.Net.Support;
+using J2N;
 using System;
 using System.Reflection;
 using System.Resources;
@@ -74,7 +74,7 @@ namespace Lucene.Net.Util
         /// <returns>The resource name.</returns>
         protected virtual string GetResourceName(Type clazz)
         {
-            string resource = clazz.GetTypeInfo().Assembly.FindResource(clazz, string.Concat(clazz.Name, ResourceSuffix, ".resources"));
+            string resource = clazz.FindResource(string.Concat(clazz.Name, ResourceSuffix, ".resources"));
             return !string.IsNullOrEmpty(resource)
                 ? resource.Substring(0, resource.Length - 10)
                 : null;
diff --git a/src/Lucene.Net/Util/IOUtils.cs b/src/Lucene.Net/Util/IOUtils.cs
index 115ea08..65f4454 100644
--- a/src/Lucene.Net/Util/IOUtils.cs
+++ b/src/Lucene.Net/Util/IOUtils.cs
@@ -1,10 +1,9 @@
+using J2N;
 using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 using System.Text;
-using System.Threading;
 
 namespace Lucene.Net.Util
 {
@@ -431,7 +430,7 @@ namespace Lucene.Net.Util
             bool success = false;
             try
             {
-                stream = clazz.GetTypeInfo().Assembly.FindAndGetManifestResourceStream(clazz, resource);
+                stream = clazz.FindAndGetManifestResourceStream(resource);
                 TextReader reader = GetDecodingReader(stream, charSet);
                 success = true;
                 return reader;
diff --git a/src/dotnet/Lucene.Net.Tests.ICU/Support/JDKBreakIterator.cs b/src/dotnet/Lucene.Net.Tests.ICU/Support/JDKBreakIterator.cs
index 249f400..e023aa2 100644
--- a/src/dotnet/Lucene.Net.Tests.ICU/Support/JDKBreakIterator.cs
+++ b/src/dotnet/Lucene.Net.Tests.ICU/Support/JDKBreakIterator.cs
@@ -1,7 +1,7 @@
 using ICU4N.Text;
+using J2N;
 using System.Globalization;
 using System.IO;
-using System.Reflection;
 
 namespace Lucene.Net.Support
 {
@@ -37,12 +37,12 @@ namespace Lucene.Net.Support
         static JdkBreakIterator()
         {
             using (Stream @is =
-                typeof(JdkBreakIterator).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(JdkBreakIterator), "jdksent.brk"))
+                typeof(JdkBreakIterator).FindAndGetManifestResourceStream("jdksent.brk"))
             {
                 SentenceInstance = RuleBasedBreakIterator.GetInstanceFromCompiledRules(@is);
             }
             using (Stream @is =
-                typeof(JdkBreakIterator).GetTypeInfo().Assembly.FindAndGetManifestResourceStream(typeof(JdkBreakIterator), "jdkword.brk"))
+                typeof(JdkBreakIterator).FindAndGetManifestResourceStream("jdkword.brk"))
             {
                 WordInstance = RuleBasedBreakIterator.GetInstanceFromCompiledRules(@is);
             }
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/SourceCode/SourceCodeParserTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/SourceCode/SourceCodeParserTest.cs
index d7a465c..0cbba61 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/SourceCode/SourceCodeParserTest.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/SourceCode/SourceCodeParserTest.cs
@@ -1,5 +1,5 @@
-using Lucene.Net.Attributes;
-using Lucene.Net.Support;
+using J2N;
+using Lucene.Net.Attributes;
 using NUnit.Framework;
 using System.IO;
 using System.Reflection;
@@ -30,11 +30,10 @@ namespace Lucene.Net.Cli.SourceCode
         public void TestSourceCodeSectionParser()
         {
             var parser = new SourceCodeSectionParser();
-            var thisAssembly = this.GetType().GetTypeInfo().Assembly;
 
             using (var output = new MemoryStream())
             {
-                using (var input = thisAssembly.FindAndGetManifestResourceStream(this.GetType(), "TestInputForParser.cs"))
+                using (var input = this.GetType().FindAndGetManifestResourceStream("TestInputForParser.cs"))
                 {
                     parser.ParseSourceCodeFiles(input, output);
                 }
diff --git a/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs b/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs
index 039fc19..cae54d8 100644
--- a/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs
+++ b/src/dotnet/tools/lucene-cli/SourceCode/ConsolePager.cs
@@ -1,9 +1,8 @@
-using Lucene.Net.Support;
+using J2N;
 using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.IO;
-using System.Reflection;
 
 namespace Lucene.Net.Cli.SourceCode
 {
@@ -58,7 +57,7 @@ namespace Lucene.Net.Cli.SourceCode
         public ConsolePager(IEnumerable<string> files)
         {
             if (files == null)
-                throw new ArgumentNullException("files");
+                throw new ArgumentNullException(nameof(files));
             this.enumerator = new MultipleFileLineEnumerator(files);
         }
 
@@ -124,8 +123,6 @@ namespace Lucene.Net.Cli.SourceCode
         /// </summary>
         internal sealed class MultipleFileLineEnumerator : IEnumerator<string>
         {
-            private static Assembly thisAssembly = typeof(Program).GetTypeInfo().Assembly;
-
             private readonly IEnumerator<string> fileEnumerator;
             private TextReader currentFile;
             private string line = null;
@@ -133,7 +130,7 @@ namespace Lucene.Net.Cli.SourceCode
             public MultipleFileLineEnumerator(IEnumerable<string> files)
             {
                 if (files == null)
-                    throw new ArgumentNullException("files");
+                    throw new ArgumentNullException(nameof(files));
                 this.fileEnumerator = files.GetEnumerator();
                 NextFile();
             }
@@ -144,28 +141,16 @@ namespace Lucene.Net.Cli.SourceCode
                 if (this.fileEnumerator.MoveNext())
                 {
                     currentFile = new SourceCodeSectionReader(new StreamReader(
-                        thisAssembly.FindAndGetManifestResourceStream(typeof(Program), this.fileEnumerator.Current), 
+                        typeof(Program).FindAndGetManifestResourceStream(this.fileEnumerator.Current), 
                         SourceCodeSectionParser.ENCODING));
                     return true;
                 }
                 return false;
             }
 
-            public string Current
-            {
-                get
-                {
-                    return line;
-                }
-            }
+            public string Current => line;
 
-            object IEnumerator.Current
-            {
-                get
-                {
-                    return line;
-                }
-            }
+            object IEnumerator.Current => line;
 
             public void Dispose()
             {
@@ -188,7 +173,7 @@ namespace Lucene.Net.Cli.SourceCode
                 return line != null;
             }
 
-            public void Reset()
+            void IEnumerator.Reset()
             {
                 throw new NotSupportedException();
             }
diff --git a/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeExporter.cs b/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeExporter.cs
index 483e7d8..39352ba 100644
--- a/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeExporter.cs
+++ b/src/dotnet/tools/lucene-cli/SourceCode/SourceCodeExporter.cs
@@ -1,4 +1,5 @@
-using Lucene.Net.Support;
+using J2N;
+using Lucene.Net.Support;
 using System.Collections.Generic;
 using System.IO;
 using System.Reflection;
@@ -44,11 +45,10 @@ namespace Lucene.Net.Cli.SourceCode
             {
                 Directory.CreateDirectory(outputPath);
             }
-            var thisAssembly = this.GetType().GetTypeInfo().Assembly;
 
             foreach (var file in files)
             {
-                using (var input = thisAssembly.FindAndGetManifestResourceStream(typeof(Program), file))
+                using (var input = typeof(Program).FindAndGetManifestResourceStream(file))
                 using (var output = new FileStream(Path.Combine(outputPath, file), FileMode.Create, FileAccess.Write))
                 {
                     sectionParser.ParseSourceCodeFiles(input, output);