Change several internal/private instance methods to be static (dotnet/coreclr#26835)
authorStephen Toub <stoub@microsoft.com>
Mon, 23 Sep 2019 22:03:08 +0000 (15:03 -0700)
committerJan Kotas <jkotas@microsoft.com>
Mon, 23 Sep 2019 22:03:08 +0000 (15:03 -0700)
* Replace ToLower(CultureInfo.InvariantCulture) with ToLowerInvariant()

* Mark several members static

Commit migrated from https://github.com/dotnet/coreclr/commit/138f1ef58f4274281543e50fb7a77715ab335eeb

27 files changed:
src/coreclr/src/System.Private.CoreLib/src/System/Exception.CoreCLR.cs
src/coreclr/src/System.Private.CoreLib/src/System/MulticastDelegate.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/MethodBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/SignatureHelper.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
src/libraries/System.Private.CoreLib/src/Internal/Win32/RegistryKey.cs
src/libraries/System.Private.CoreLib/src/System/AppDomain.cs
src/libraries/System.Private.CoreLib/src/System/Collections/Concurrent/ConcurrentQueue.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/ActivityTracker.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/TraceLoggingEventSource.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Unix.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.Windows.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.Unix.cs
src/libraries/System.Private.CoreLib/src/System/Globalization/TimeSpanParse.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ManifestBasedResourceGroveler.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ResourceReader.Core.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs
src/libraries/System.Private.CoreLib/src/System/String.Searching.cs
src/libraries/System.Private.CoreLib/src/System/Text/EncoderFallback.cs
src/libraries/System.Private.CoreLib/src/System/Threading/ThreadLocal.cs

index e15ea6e..cc06e22 100644 (file)
@@ -271,7 +271,7 @@ namespace System
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal static extern uint GetExceptionCount();
 
-        internal object? DeepCopyStackTrace(object? currentStackTrace)
+        internal static object? DeepCopyStackTrace(object? currentStackTrace)
         {
             if (currentStackTrace != null)
             {
@@ -283,7 +283,7 @@ namespace System
             }
         }
 
-        internal object? DeepCopyDynamicMethods(object? currentDynamicMethods)
+        internal static object? DeepCopyDynamicMethods(object? currentDynamicMethods)
         {
             if (currentDynamicMethods != null)
             {
index a169b14..e4caa40 100644 (file)
@@ -569,10 +569,8 @@ namespace System
         // this should help inlining
         [DoesNotReturn]
         [System.Diagnostics.DebuggerNonUserCode]
-        private void ThrowNullThisInDelegateToInstance()
-        {
+        private static void ThrowNullThisInDelegateToInstance() =>
             throw new ArgumentException(SR.Arg_DlgtNullInst);
-        }
 
         [System.Diagnostics.DebuggerNonUserCode]
         private void CtorClosed(object target, IntPtr methodPtr)
index e760d12..1dda5b6 100644 (file)
@@ -354,7 +354,7 @@ namespace System.Reflection.Emit
 
         #endregion
 
-        internal void CheckContext(params Type[]?[]? typess)
+        internal static void CheckContext(params Type[]?[]? typess)
         {
             if (typess == null)
             {
@@ -370,7 +370,7 @@ namespace System.Reflection.Emit
             }
         }
 
-        internal void CheckContext(params Type?[]? types)
+        internal static void CheckContext(params Type?[]? types)
         {
             if (types == null)
             {
index 08754ef..515c43f 100644 (file)
@@ -393,7 +393,7 @@ namespace System.Reflection.Emit
 
         internal int ExceptionHandlerCount => m_exceptions != null ? m_exceptions.Length : 0;
 
-        internal int CalculateNumberOfExceptions(__ExceptionInfo[]? excp)
+        internal static int CalculateNumberOfExceptions(__ExceptionInfo[]? excp)
         {
             int num = 0;
 
@@ -845,12 +845,10 @@ namespace System.Reflection.Emit
 
         // this method should return true for any and every ca that requires more work
         // than just setting the ca
-        private bool IsKnownCA(ConstructorInfo con)
+        private static bool IsKnownCA(ConstructorInfo con)
         {
             Type? caType = con.DeclaringType;
-            if (caType == typeof(System.Runtime.CompilerServices.MethodImplAttribute)) return true;
-            else if (caType == typeof(DllImportAttribute)) return true;
-            else return false;
+            return caType == typeof(MethodImplAttribute) || caType == typeof(DllImportAttribute);
         }
 
         private void ParseCA(ConstructorInfo con)
index 169c546..d43d11f 100644 (file)
@@ -110,7 +110,7 @@ namespace System.Reflection.Emit
             }
         }
 
-        private Type? GetType(string strFormat, Type baseType)
+        private static Type? GetType(string strFormat, Type baseType)
         {
             // This function takes a string to describe the compound type, such as "[,][]", and a baseType.
             if (strFormat == null || strFormat.Equals(string.Empty))
@@ -124,11 +124,12 @@ namespace System.Reflection.Emit
 
         internal void CheckContext(params Type[]?[]? typess)
         {
-            ContainingAssemblyBuilder.CheckContext(typess);
+            AssemblyBuilder.CheckContext(typess);
         }
+
         internal void CheckContext(params Type?[]? types)
         {
-            ContainingAssemblyBuilder.CheckContext(types);
+            AssemblyBuilder.CheckContext(types);
         }
 
         [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
index 5900d91..dbd5c9b 100644 (file)
@@ -572,13 +572,13 @@ namespace System.Reflection.Emit
                 m_signature[m_currSig++] = phandle[i];
         }
 
-        private byte[] ExpandArray(byte[] inArray)
+        private static byte[] ExpandArray(byte[] inArray)
         {
             // Expand the signature buffer size
             return ExpandArray(inArray, inArray.Length * 2);
         }
 
-        private byte[] ExpandArray(byte[] inArray, int requiredLength)
+        private static byte[] ExpandArray(byte[] inArray, int requiredLength)
         {
             // Expand the signature buffer size
 
index 88d94bd..77a3887 100644 (file)
@@ -63,7 +63,7 @@ namespace System.Reflection
             }
         }
 
-        private bool IsDisallowedByRefType(Type type)
+        private static bool IsDisallowedByRefType(Type type)
         {
             if (!type.IsByRef)
                 return false;
index f0e433e..fdbd805 100644 (file)
@@ -2052,7 +2052,7 @@ namespace System
             {
                 if ((bindingFlags & BindingFlags.IgnoreCase) != 0)
                 {
-                    name = name.ToLower(CultureInfo.InvariantCulture);
+                    name = name.ToLowerInvariant();
                     ignoreCase = true;
                     listType = MemberListType.CaseInsensitive;
                 }
@@ -2108,7 +2108,7 @@ namespace System
             string name, bool prefixLookup)
         {
             Debug.Assert(memberInfo != null);
-            Debug.Assert(name is null || (bindingFlags & BindingFlags.IgnoreCase) == 0 || (name.ToLower(CultureInfo.InvariantCulture).Equals(name)));
+            Debug.Assert(name is null || (bindingFlags & BindingFlags.IgnoreCase) == 0 || (name.ToLowerInvariant().Equals(name)));
 
             // Filter by Public & Private
             if (isPublic)
@@ -4162,7 +4162,7 @@ namespace System
             return ret;
         }
 
-        private void WrapArgsForInvokeCall(object[] aArgs, int[] aArgsWrapperTypes)
+        private static void WrapArgsForInvokeCall(object[] aArgs, int[] aArgsWrapperTypes)
         {
             int cArgs = aArgs.Length;
             for (int i = 0; i < cArgs; i++)
@@ -4262,7 +4262,7 @@ namespace System
         }
 
         private static OleAutBinder? s_ForwardCallBinder;
-        private OleAutBinder ForwardCallBinder => s_ForwardCallBinder ??= new OleAutBinder();
+        private static OleAutBinder ForwardCallBinder => s_ForwardCallBinder ??= new OleAutBinder();
 
         [Flags]
         private enum DispatchWrapperType : int
index eec53b7..c4b3de8 100644 (file)
@@ -457,7 +457,7 @@ namespace Internal.Win32
             }
         }
 
-        internal void Win32Error(int errorCode, string? str)
+        internal static void Win32Error(int errorCode, string? str)
         {
             switch (errorCode)
             {
index f5013dc..e7a43ac 100644 (file)
@@ -116,7 +116,7 @@ namespace System
             throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS); // This api is only meaningful for very specific partial trust/CAS scenarios
         }
 
-        private int ExecuteAssembly(Assembly assembly, string?[]? args)
+        private static int ExecuteAssembly(Assembly assembly, string?[]? args)
         {
             MethodInfo? entry = assembly.EntryPoint;
             if (entry == null)
index eca89c9..e082567 100644 (file)
@@ -525,7 +525,7 @@ namespace System.Collections.Concurrent
         }
 
         /// <summary>Gets the item stored in the <paramref name="i"/>th entry in <paramref name="segment"/>.</summary>
-        private T GetItemWhenAvailable(ConcurrentQueueSegment<T> segment, int i)
+        private static T GetItemWhenAvailable(ConcurrentQueueSegment<T> segment, int i)
         {
             Debug.Assert(segment._preservedForObservation);
 
index 00e080d..ca91166 100644 (file)
@@ -248,7 +248,7 @@ namespace System.Diagnostics.Tracing
         /// <summary>
         /// Searched for a active (nonstopped) activity with the given name.  Returns null if not found.
         /// </summary>
-        private ActivityInfo? FindActiveActivity(string name, ActivityInfo? startLocation)
+        private static ActivityInfo? FindActiveActivity(string name, ActivityInfo? startLocation)
         {
             ActivityInfo? activity = startLocation;
             while (activity != null)
@@ -264,7 +264,7 @@ namespace System.Diagnostics.Tracing
         /// Strip out "Start" or "End" suffix from activity name and add providerName prefix.
         /// If 'task'  it does not end in Start or Stop and Task is non-zero use that as the name of the activity
         /// </summary>
-        private string NormalizeActivityName(string providerName, string activityName, int task)
+        private static string NormalizeActivityName(string providerName, string activityName, int task)
         {
             // We use provider name to distinguish between activities from different providers.
 
index e21b304..38a30dc 100644 (file)
@@ -2478,19 +2478,19 @@ namespace System.Diagnostics.Tracing
         }
 
 #if !ES_BUILD_PN
-        private int GetParameterCount(EventMetadata eventData)
+        private static int GetParameterCount(EventMetadata eventData)
         {
             return eventData.Parameters.Length;
         }
 
-        private Type GetDataType(EventMetadata eventData, int parameterId)
+        private static Type GetDataType(EventMetadata eventData, int parameterId)
         {
             return eventData.Parameters[parameterId].ParameterType;
         }
 
         private const bool m_EventSourcePreventRecursion = false;
 #else
-        private int GetParameterCount(EventMetadata eventData)
+        private static int GetParameterCount(EventMetadata eventData)
         {
             int paramCount;
             if (eventData.Parameters == null)
@@ -2505,7 +2505,7 @@ namespace System.Diagnostics.Tracing
             return paramCount;
         }
 
-        private Type GetDataType(EventMetadata eventData, int parameterId)
+        private static Type GetDataType(EventMetadata eventData, int parameterId)
         {
             Type dataType;
             if (eventData.Parameters == null)
@@ -5417,14 +5417,15 @@ namespace System.Diagnostics.Tracing
             channelTab[value] = new ChannelInfo { Name = name, Keywords = kwd, Attribs = channelAttribute };
         }
 
-        private EventChannelType EventChannelToChannelType(EventChannel channel)
+        private static EventChannelType EventChannelToChannelType(EventChannel channel)
         {
 #if !ES_BUILD_STANDALONE
             Debug.Assert(channel >= EventChannel.Admin && channel <= EventChannel.Debug);
 #endif
             return (EventChannelType)((int)channel - (int)EventChannel.Admin + (int)EventChannelType.Admin);
         }
-        private EventChannelAttribute GetDefaultChannelAttribute(EventChannel channel)
+
+        private static EventChannelAttribute GetDefaultChannelAttribute(EventChannel channel)
         {
             EventChannelAttribute attrib = new EventChannelAttribute();
             attrib.EventChannelType = EventChannelToChannelType(channel);
index c693680..098c225 100644 (file)
@@ -471,7 +471,7 @@ namespace System.Diagnostics.Tracing
                 }
                 finally
                 {
-                    this.WriteCleanup(pins, pinCount);
+                    WriteCleanup(pins, pinCount);
                 }
             }
 #endif // FEATURE_MANAGED_ETW
@@ -695,7 +695,7 @@ namespace System.Diagnostics.Tracing
 #if FEATURE_MANAGED_ETW
                         finally
                         {
-                            this.WriteCleanup(pins, pinCount);
+                            WriteCleanup(pins, pinCount);
                         }
                     }
 #endif // FEATURE_MANAGED_ETW
@@ -741,7 +741,7 @@ namespace System.Diagnostics.Tracing
             System.Runtime.ConstrainedExecution.Cer.Success)]
 #endif
         [NonEvent]
-        private unsafe void WriteCleanup(GCHandle* pPins, int cPins)
+        private static unsafe void WriteCleanup(GCHandle* pPins, int cPins)
         {
             DataCollector.ThreadInstance.Disable();
 
index 8973719..c711e10 100644 (file)
@@ -1081,7 +1081,7 @@ namespace System.Globalization
             }
         }
 
-        internal int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+        internal static int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
         {
             if (!ignoreCase)
             {
@@ -1306,7 +1306,7 @@ namespace System.Globalization
             return LastIndexOfCore(source, value, startIndex, count, options);
         }
 
-        internal int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+        internal static int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
         {
             if (GlobalizationMode.Invariant)
             {
index 7e82651..9132853 100644 (file)
@@ -419,8 +419,6 @@ namespace System.Globalization
             return LocaleData.GetConsoleUICulture(cultureName);
         }
 
-        internal bool IsFramework => false;
-
         internal bool IsWin32Installed => false;
 
         internal bool IsReplacementCulture => false;
index 6c1902c..f7c30e2 100644 (file)
@@ -712,8 +712,6 @@ namespace System.Globalization
             return GetLocaleInfo(cultureName, LocaleStringData.ConsoleFallbackName);
         }
 
-        internal bool IsFramework => false;
-
         internal bool IsWin32Installed => true;
 
         internal bool IsReplacementCulture
index bc93105..fba5049 100644 (file)
@@ -777,26 +777,24 @@ namespace System.Globalization
         {
             get
             {
-                CultureTypes types = 0;
+                CultureTypes types = _cultureData.IsNeutralCulture ?
+                    CultureTypes.NeutralCultures :
+                    CultureTypes.SpecificCultures;
 
-                if (_cultureData.IsNeutralCulture)
+                if (_cultureData.IsWin32Installed)
                 {
-                    types |= CultureTypes.NeutralCultures;
+                    types |= CultureTypes.InstalledWin32Cultures;
                 }
-                else
+
+                if (_cultureData.IsSupplementalCustomCulture)
                 {
-                    types |= CultureTypes.SpecificCultures;
+                    types |= CultureTypes.UserCustomCulture;
                 }
 
-                types |= _cultureData.IsWin32Installed ? CultureTypes.InstalledWin32Cultures : 0;
-
-                // Disable  warning 618: System.Globalization.CultureTypes.FrameworkCultures' is obsolete
-#pragma warning disable 618
-                types |= _cultureData.IsFramework ? CultureTypes.FrameworkCultures : 0;
-#pragma warning restore 618
-
-                types |= _cultureData.IsSupplementalCustomCulture ? CultureTypes.UserCustomCulture : 0;
-                types |= _cultureData.IsReplacementCulture ? CultureTypes.ReplacementCultures | CultureTypes.UserCustomCulture : 0;
+                if (_cultureData.IsReplacementCulture)
+                {
+                    types |= CultureTypes.ReplacementCultures;
+                }
 
                 return types;
             }
index 45cf55c..02e7c5f 100644 (file)
@@ -19,7 +19,7 @@ namespace System.Globalization
         // ---- PAL layer ends here ----
         // -----------------------------
 
-        private bool NeedsTurkishCasing(string localeName)
+        private static bool NeedsTurkishCasing(string localeName)
         {
             Debug.Assert(localeName != null);
 
index 4be47d1..aaf227a 100644 (file)
@@ -262,9 +262,6 @@ namespace System.Globalization
         /// <summary>Stores intermediary parsing state for the standard formats.</summary>
         private ref struct TimeSpanRawInfo
         {
-            internal TimeSpanFormat.FormatLiterals PositiveInvariant => TimeSpanFormat.PositiveInvariantFormatLiterals;
-            internal TimeSpanFormat.FormatLiterals NegativeInvariant => TimeSpanFormat.NegativeInvariantFormatLiterals;
-
             internal TimeSpanFormat.FormatLiterals PositiveLocalized
             {
                 get
@@ -767,12 +764,12 @@ namespace System.Globalization
 
             if (inv)
             {
-                if (raw.FullMatch(raw.PositiveInvariant))
+                if (raw.FullMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     match = true;
                     positive = true;
                 }
-                if (!match && raw.FullMatch(raw.NegativeInvariant))
+                if (!match && raw.FullMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     match = true;
                     positive = false;
@@ -840,42 +837,42 @@ namespace System.Globalization
 
             if (inv)
             {
-                if (raw.FullHMSFMatch(raw.PositiveInvariant))
+                if (raw.FullHMSFMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     positive = true;
                     match = TryTimeToTicks(positive, zero, raw._numbers0, raw._numbers1, raw._numbers2, raw._numbers3, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullDHMSMatch(raw.PositiveInvariant))
+                if (!match && raw.FullDHMSMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     positive = true;
                     match = TryTimeToTicks(positive, raw._numbers0, raw._numbers1, raw._numbers2, raw._numbers3, zero, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullAppCompatMatch(raw.PositiveInvariant))
+                if (!match && raw.FullAppCompatMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     positive = true;
                     match = TryTimeToTicks(positive, raw._numbers0, raw._numbers1, raw._numbers2, zero, raw._numbers3, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullHMSFMatch(raw.NegativeInvariant))
+                if (!match && raw.FullHMSFMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     positive = false;
                     match = TryTimeToTicks(positive, zero, raw._numbers0, raw._numbers1, raw._numbers2, raw._numbers3, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullDHMSMatch(raw.NegativeInvariant))
+                if (!match && raw.FullDHMSMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     positive = false;
                     match = TryTimeToTicks(positive, raw._numbers0, raw._numbers1, raw._numbers2, raw._numbers3, zero, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullAppCompatMatch(raw.NegativeInvariant))
+                if (!match && raw.FullAppCompatMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     positive = false;
                     match = TryTimeToTicks(positive, raw._numbers0, raw._numbers1, raw._numbers2, zero, raw._numbers3, out ticks);
@@ -966,42 +963,42 @@ namespace System.Globalization
 
             if (inv)
             {
-                if (raw.FullHMSMatch(raw.PositiveInvariant))
+                if (raw.FullHMSMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     positive = true;
                     match = TryTimeToTicks(positive, zero, raw._numbers0, raw._numbers1, raw._numbers2, zero, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullDHMMatch(raw.PositiveInvariant))
+                if (!match && raw.FullDHMMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     positive = true;
                     match = TryTimeToTicks(positive, raw._numbers0, raw._numbers1, raw._numbers2, zero, zero, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.PartialAppCompatMatch(raw.PositiveInvariant))
+                if (!match && raw.PartialAppCompatMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     positive = true;
                     match = TryTimeToTicks(positive, zero, raw._numbers0, raw._numbers1, zero, raw._numbers2, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullHMSMatch(raw.NegativeInvariant))
+                if (!match && raw.FullHMSMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     positive = false;
                     match = TryTimeToTicks(positive, zero, raw._numbers0, raw._numbers1, raw._numbers2, zero, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.FullDHMMatch(raw.NegativeInvariant))
+                if (!match && raw.FullDHMMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     positive = false;
                     match = TryTimeToTicks(positive, raw._numbers0, raw._numbers1, raw._numbers2, zero, zero, out ticks);
                     overflow = overflow || !match;
                 }
 
-                if (!match && raw.PartialAppCompatMatch(raw.NegativeInvariant))
+                if (!match && raw.PartialAppCompatMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     positive = false;
                     match = TryTimeToTicks(positive, zero, raw._numbers0, raw._numbers1, zero, raw._numbers2, out ticks);
@@ -1090,13 +1087,13 @@ namespace System.Globalization
 
             if (inv)
             {
-                if (raw.FullHMMatch(raw.PositiveInvariant))
+                if (raw.FullHMMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     match = true;
                     positive = true;
                 }
 
-                if (!match && raw.FullHMMatch(raw.NegativeInvariant))
+                if (!match && raw.FullHMMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     match = true;
                     positive = false;
@@ -1160,13 +1157,13 @@ namespace System.Globalization
 
             if (inv)
             {
-                if (raw.FullDMatch(raw.PositiveInvariant))
+                if (raw.FullDMatch(TimeSpanFormat.PositiveInvariantFormatLiterals))
                 {
                     match = true;
                     positive = true;
                 }
 
-                if (!match && raw.FullDMatch(raw.NegativeInvariant))
+                if (!match && raw.FullDMatch(TimeSpanFormat.NegativeInvariantFormatLiterals))
                 {
                     match = true;
                     positive = false;
index a7b3595..047bab0 100644 (file)
@@ -371,7 +371,7 @@ namespace System.Resources
             Debug.Assert(_mediator.MainAssembly != null);
             if (!_mediator.LookedForSatelliteContractVersion)
             {
-                _mediator.SatelliteContractVersion = _mediator.ObtainSatelliteContractVersion(_mediator.MainAssembly);
+                _mediator.SatelliteContractVersion = ResourceManager.ResourceManagerMediator.ObtainSatelliteContractVersion(_mediator.MainAssembly);
                 _mediator.LookedForSatelliteContractVersion = true;
             }
 
index 8d98b57..e096647 100644 (file)
@@ -792,7 +792,7 @@ namespace System.Resources
                 set => _rm._satelliteContractVersion = value;
             }
 
-            internal Version? ObtainSatelliteContractVersion(Assembly a) =>
+            internal static Version? ObtainSatelliteContractVersion(Assembly a) =>
                 ResourceManager.GetSatelliteContractVersion(a);
 
             internal UltimateResourceFallbackLocation FallbackLoc
index 793441d..d289760 100644 (file)
@@ -95,7 +95,7 @@ namespace System.Resources
             return (obj, stream) => typedDelegate((TInstance)obj, stream);
         }
 
-        private bool ValidateReaderType(string readerType)
+        private static bool ValidateReaderType(string readerType)
         {
             return ResourceManager.IsDefaultType(readerType, ResourceManager.ResReaderTypeName);
         }
index 7d18f57..db6a794 100644 (file)
@@ -604,7 +604,7 @@ namespace System.Runtime.Loader
             return null;
         }
 
-        private Assembly ValidateAssemblyNameWithSimpleName(Assembly assembly, string? requestedSimpleName)
+        private static Assembly ValidateAssemblyNameWithSimpleName(Assembly assembly, string? requestedSimpleName)
         {
             // Get the name of the loaded assembly
             string? loadedSimpleName = null;
index d77b4a2..a1df7b7 100644 (file)
@@ -288,7 +288,7 @@ namespace System
                     return CompareInfo.Invariant.IndexOf(this, value, startIndex, count, GetCaseCompareOfComparisonCulture(comparisonType));
 
                 case StringComparison.OrdinalIgnoreCase:
-                    return CompareInfo.Invariant.IndexOfOrdinal(this, value, startIndex, count, GetCaseCompareOfComparisonCulture(comparisonType) != CompareOptions.None);
+                    return CompareInfo.IndexOfOrdinal(this, value, startIndex, count, GetCaseCompareOfComparisonCulture(comparisonType) != CompareOptions.None);
 
                 default:
                     throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
@@ -478,7 +478,7 @@ namespace System
 
                 case StringComparison.Ordinal:
                 case StringComparison.OrdinalIgnoreCase:
-                    return CompareInfo.Invariant.LastIndexOfOrdinal(this, value, startIndex, count, GetCaseCompareOfComparisonCulture(comparisonType) != CompareOptions.None);
+                    return CompareInfo.LastIndexOfOrdinal(this, value, startIndex, count, GetCaseCompareOfComparisonCulture(comparisonType) != CompareOptions.None);
 
                 default:
                     throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
index 13d1ab5..8a2f546 100644 (file)
@@ -376,14 +376,9 @@ namespace System.Text
             return bFallingBack;
         }
 
-        // private helper methods
         [DoesNotReturn]
-        internal void ThrowLastCharRecursive(int charRecursive)
-        {
+        internal static void ThrowLastCharRecursive(int charRecursive) =>
             // Throw it, using our complete character
-            throw new ArgumentException(
-                SR.Format(SR.Argument_RecursiveFallback,
-                    charRecursive), "chars");
-        }
+            throw new ArgumentException(SR.Format(SR.Argument_RecursiveFallback, charRecursive), "chars");
     }
 }
index d645918..dbaf162 100644 (file)
@@ -561,7 +561,7 @@ namespace System.Threading
         /// <summary>
         /// Resizes a table to a certain length (or larger).
         /// </summary>
-        private void GrowTable(ref LinkedSlotVolatile[] table, int minLength)
+        private static void GrowTable(ref LinkedSlotVolatile[] table, int minLength)
         {
             Debug.Assert(table.Length < minLength);