@@ -8,7 +8,7 @@ private import semmle.code.csharp.frameworks.System
88private import semmle.code.csharp.frameworks.system.Text
99
1010/** A method that formats a string, for example `string.Format()`. */
11- abstract class FormatMethod extends Method {
11+ abstract private class FormatMethodImpl extends Method {
1212 /**
1313 * Gets the argument containing the format string. For example, the argument of
1414 * `string.Format(IFormatProvider, String, Object)` is `1`.
@@ -21,6 +21,8 @@ abstract class FormatMethod extends Method {
2121 int getFirstArgument ( ) { result = this .getFormatArgument ( ) + 1 }
2222}
2323
24+ final class FormatMethod = FormatMethodImpl ;
25+
2426/** A class of types used for formatting. */
2527private class FormatType extends Type {
2628 FormatType ( ) {
@@ -29,7 +31,7 @@ private class FormatType extends Type {
2931 }
3032}
3133
32- private class StringAndStringBuilderFormatMethods extends FormatMethod {
34+ private class StringAndStringBuilderFormatMethods extends FormatMethodImpl {
3335 StringAndStringBuilderFormatMethods ( ) {
3436 (
3537 this .getParameter ( 0 ) .getType ( ) instanceof SystemIFormatProviderInterface and
@@ -51,7 +53,7 @@ private class StringAndStringBuilderFormatMethods extends FormatMethod {
5153 }
5254}
5355
54- private class SystemMemoryExtensionsFormatMethods extends FormatMethod {
56+ private class SystemMemoryExtensionsFormatMethods extends FormatMethodImpl {
5557 SystemMemoryExtensionsFormatMethods ( ) {
5658 this = any ( SystemMemoryExtensionsClass c ) .getTryWriteMethod ( ) and
5759 this .getParameter ( 1 ) .getType ( ) instanceof SystemIFormatProviderInterface and
@@ -63,7 +65,7 @@ private class SystemMemoryExtensionsFormatMethods extends FormatMethod {
6365 override int getFirstArgument ( ) { result = this .getFormatArgument ( ) + 2 }
6466}
6567
66- private class SystemConsoleAndSystemIoTextWriterFormatMethods extends FormatMethod {
68+ private class SystemConsoleAndSystemIoTextWriterFormatMethods extends FormatMethodImpl {
6769 SystemConsoleAndSystemIoTextWriterFormatMethods ( ) {
6870 this .getParameter ( 0 ) .getType ( ) instanceof StringType and
6971 this .getNumberOfParameters ( ) > 1 and
@@ -80,7 +82,7 @@ private class SystemConsoleAndSystemIoTextWriterFormatMethods extends FormatMeth
8082 override int getFormatArgument ( ) { result = 0 }
8183}
8284
83- private class SystemDiagnosticsDebugAssert extends FormatMethod {
85+ private class SystemDiagnosticsDebugAssert extends FormatMethodImpl {
8486 SystemDiagnosticsDebugAssert ( ) {
8587 this .hasName ( "Assert" ) and
8688 this .getDeclaringType ( ) .hasFullyQualifiedName ( "System.Diagnostics" , "Debug" ) and
@@ -90,7 +92,7 @@ private class SystemDiagnosticsDebugAssert extends FormatMethod {
9092 override int getFormatArgument ( ) { result = 2 }
9193}
9294
93- private class SystemDiagnosticsFormatMethods extends FormatMethod {
95+ private class SystemDiagnosticsFormatMethods extends FormatMethodImpl {
9496 SystemDiagnosticsFormatMethods ( ) {
9597 this .getParameter ( 0 ) .getType ( ) instanceof StringType and
9698 this .getNumberOfParameters ( ) > 1 and
0 commit comments