Smdn.Reflection.ReverseGenerating version 1.4.0
·
28 commits
to main
since this release
Released package
Release notes
The full release notes are available at gist.
Change log
Change log in this release:
- 2025-06-28 add CompatibilitySuppressions.xml
- 2025-06-28 update assembly version
- 2025-06-28 add GeneratorOptions.TypeDeclarationOptions.EnableRecordTypes to improve generating record types
- 2025-06-28 bump Smdn.Fundamental.Reflection up to 3.7.0
- 2025-06-28 improve implementation for AttributeDeclarationOptions.OmitInaccessibleMembersInNullStateAttribute
- 2025-06-26 add AttributeDeclarationOptions.OmitInaccessibleMembersInNullStateAttribute
- 2025-06-26 simplify expressions
- 2025-06-25 fix typo and replace to more better word
- 2025-04-21 fix typo in comment
- 2024-12-14 drop target framework net6.0
API changes
API changes in this release:
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs
index 3ee4c42..a515746 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs
@@ -1,134 +1,137 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.3.0)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.4.0)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.3.0.0
-// InformationalVersion: 1.3.0+1e9a9d918b8a2ba6fe994e2fa60ff5f7c5b2544e
+// AssemblyVersion: 1.4.0.0
+// InformationalVersion: 1.4.0+18ee669c79d1bf31c72c392aff42f18f4184ea59
// TargetFramework: .NETFramework,Version=v4.5
// Configuration: Release
// Referenced assemblies:
-// Smdn.Fundamental.Reflection, Version=3.6.0.0, Culture=neutral
+// Smdn.Fundamental.Reflection, Version=3.7.0.0, Culture=neutral
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, out string primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
+ public bool OmitInaccessibleMembersInNullStateAttribute { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
+ public bool EnableRecordTypes { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
+ public bool OmitRecordImplicitInterface { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.1.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.5.0.0.
+// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs
index 7e7faee..14bbaac 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs
@@ -1,133 +1,136 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.3.0)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.4.0)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.3.0.0
-// InformationalVersion: 1.3.0+1e9a9d918b8a2ba6fe994e2fa60ff5f7c5b2544e
+// AssemblyVersion: 1.4.0.0
+// InformationalVersion: 1.4.0+18ee669c79d1bf31c72c392aff42f18f4184ea59
// TargetFramework: .NETFramework,Version=v4.7
// Configuration: Release
// Referenced assemblies:
-// Smdn.Fundamental.Reflection, Version=3.6.0.0, Culture=neutral
+// Smdn.Fundamental.Reflection, Version=3.7.0.0, Culture=neutral
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, out string primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
+ public bool OmitInaccessibleMembersInNullStateAttribute { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
+ public bool EnableRecordTypes { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
+ public bool OmitRecordImplicitInterface { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.1.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.5.0.0.
+// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs
deleted file mode 100644
index de3fbcb..0000000
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.3.0)
-// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.3.0.0
-// InformationalVersion: 1.3.0+1e9a9d918b8a2ba6fe994e2fa60ff5f7c5b2544e
-// TargetFramework: .NETCoreApp,Version=v6.0
-// Configuration: Release
-// Referenced assemblies:
-// Smdn.Fundamental.Reflection, Version=3.6.0.0, Culture=neutral
-// System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-// System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-// System.Memory, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
-// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-// System.Runtime.InteropServices, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-// System.Threading, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-#nullable enable annotations
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Reflection;
-using Smdn.Reflection;
-using Smdn.Reflection.ReverseGenerating;
-
-namespace Smdn.Reflection.ReverseGenerating {
- public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
-
- public enum AttributeSectionFormat : int {
- Discrete = 1,
- List = 0,
- }
-
- public enum MethodBodyOption : int {
- EmptyImplementation = 1,
- None = 0,
- ThrowNotImplementedException = 2,
- ThrowNull = 3,
- }
-
- public static class CSharpFormatter {
- public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
- public static string FormatAccessibility(Accessibility accessibility) {}
- public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
- public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
- public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
- public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
- public static bool IsLanguagePrimitiveType(Type t, [MaybeNullWhen(false)] out string? primitiveTypeName) {}
- public static IEnumerable<string> ToNamespaceList(Type t) {}
- }
-
- public static class Generator {
- public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- [Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
- public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
- }
-
- public class GeneratorOptions : ICloneable {
- public class AttributeDeclarationOptions {
- public AttributeDeclarationOptions() {}
-
- public AttributeSectionFormat AccessorFormat { get; set; }
- public AttributeSectionFormat AccessorParameterFormat { get; set; }
- public AttributeSectionFormat BackingFieldFormat { get; set; }
- public AttributeSectionFormat DelegateParameterFormat { get; set; }
- public AttributeSectionFormat GenericParameterFormat { get; set; }
- public AttributeSectionFormat MethodParameterFormat { get; set; }
- public bool OmitAttributeSuffix { get; set; }
- public AttributeTypeFilter? TypeFilter { get; set; }
- public bool WithDeclaringTypeName { get; set; }
- public bool WithNamedArguments { get; set; }
- public bool WithNamespace { get; set; }
- }
-
- public class MemberDeclarationOptions {
- public MemberDeclarationOptions() {}
-
- public MethodBodyOption AccessorBody { get; set; }
- public MethodBodyOption MethodBody { get; set; }
- public NullabilityInfoContext? NullabilityInfoContext { get; set; }
- public object? NullabilityInfoContextLockObject { get; set; }
- public bool OmitEndOfStatement { get; set; }
- public bool WithAccessibility { get; set; }
- public bool WithDeclaringTypeName { get; set; }
- public bool WithEnumTypeName { get; set; }
- public bool WithNamespace { get; set; }
- }
-
- public class ParameterDeclarationOptions {
- public ParameterDeclarationOptions() {}
-
- public bool WithDeclaringTypeName { get; set; }
- public bool WithNamespace { get; set; }
- }
-
- public class TypeDeclarationOptions {
- public TypeDeclarationOptions() {}
-
- public NullabilityInfoContext? NullabilityInfoContext { get; set; }
- public object? NullabilityInfoContextLockObject { get; set; }
- public bool OmitEndOfStatement { get; set; }
- public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
- public bool WithAccessibility { get; set; }
- public bool WithDeclaringTypeName { get; set; }
- public bool WithNamespace { get; set; }
- }
-
- public class ValueDeclarationOptions {
- public ValueDeclarationOptions() {}
-
- public bool UseDefaultLiteral { get; set; }
- public bool WithDeclaringTypeName { get; set; }
- public bool WithNamespace { get; set; }
- }
-
- public GeneratorOptions() {}
-
- public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
- public bool IgnorePrivateOrAssembly { get; set; }
- public string? Indent { get; set; }
- public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
- public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
- public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
- public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
- public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
-
- public virtual GeneratorOptions Clone() {}
- object ICloneable.Clone() {}
- }
-}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.1.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net8.0.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net8.0.apilist.cs
index 5964868..b0779a7 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net8.0.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net8.0.apilist.cs
@@ -1,155 +1,158 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.3.0)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.4.0)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.3.0.0
-// InformationalVersion: 1.3.0+1e9a9d918b8a2ba6fe994e2fa60ff5f7c5b2544e
+// AssemblyVersion: 1.4.0.0
+// InformationalVersion: 1.4.0+18ee669c79d1bf31c72c392aff42f18f4184ea59
// TargetFramework: .NETCoreApp,Version=v8.0
// Configuration: Release
// Referenced assemblies:
-// Smdn.Fundamental.Reflection, Version=3.6.0.0, Culture=neutral
+// Smdn.Fundamental.Reflection, Version=3.7.0.0, Culture=neutral
// System.Collections, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Memory, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime.InteropServices, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Threading, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, [MaybeNullWhen(false)] out string? primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
+ public bool OmitInaccessibleMembersInNullStateAttribute { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public NullabilityInfoContext? NullabilityInfoContext { get; set; }
public object? NullabilityInfoContextLockObject { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
+ public bool EnableRecordTypes { get; set; }
public NullabilityInfoContext? NullabilityInfoContext { get; set; }
public object? NullabilityInfoContextLockObject { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
+ public bool OmitRecordImplicitInterface { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.1.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.5.0.0.
+// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs
index 39b388d..325dcf1 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs
@@ -1,131 +1,134 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.3.0)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.4.0)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.3.0.0
-// InformationalVersion: 1.3.0+1e9a9d918b8a2ba6fe994e2fa60ff5f7c5b2544e
+// AssemblyVersion: 1.4.0.0
+// InformationalVersion: 1.4.0+18ee669c79d1bf31c72c392aff42f18f4184ea59
// TargetFramework: .NETStandard,Version=v2.0
// Configuration: Release
// Referenced assemblies:
-// Smdn.Fundamental.Reflection, Version=3.6.0.0, Culture=neutral
+// Smdn.Fundamental.Reflection, Version=3.7.0.0, Culture=neutral
// netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, out string primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
+ public bool OmitInaccessibleMembersInNullStateAttribute { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
+ public bool EnableRecordTypes { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
+ public bool OmitRecordImplicitInterface { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.1.0.
-// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.5.0.0.
+// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.3.1.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
Full changes
Full changes in this release:
diff --git a/src/Smdn.Reflection.ReverseGenerating/CompatibilitySuppressions.xml b/src/Smdn.Reflection.ReverseGenerating/CompatibilitySuppressions.xml
new file mode 100644
index 0000000..14d3db4
--- /dev/null
+++ b/src/Smdn.Reflection.ReverseGenerating/CompatibilitySuppressions.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
+<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Suppression>
+ <DiagnosticId>CP0008</DiagnosticId>
+ <Target>T:Smdn.Reflection.ReverseGenerating.MethodBodyOption</Target>
+ <Left>lib/net5.0/Smdn.Reflection.ReverseGenerating.dll</Left>
+ <Right>lib/netstandard2.0/Smdn.Reflection.ReverseGenerating.dll</Right>
+ <IsBaselineSuppression>true</IsBaselineSuppression>
+ </Suppression>
+</Suppressions>
\ No newline at end of file
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj
index 36a6e02..c38f4bd 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj
@@ -4,12 +4,12 @@ SPDX-License-Identifier: MIT
-->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFrameworks>net8.0;net6.0;net47;net45;netstandard2.0</TargetFrameworks>
+ <TargetFrameworks>net8.0;net47;net45;netstandard2.0</TargetFrameworks>
<RootNamespace>Smdn.Reflection.ReverseGenerating</RootNamespace>
- <VersionPrefix>1.3.0</VersionPrefix>
+ <VersionPrefix>1.4.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
- <RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
+ <RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0130 -->
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<NoWarn>CS1591;$(NoWarn)</NoWarn> <!-- CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' -->
@@ -44,7 +44,7 @@ SPDX-License-Identifier: MIT
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.0" Condition="$(TargetFramework.StartsWith('net45')) or $(TargetFramework.StartsWith('net46')) or $(TargetFramework.StartsWith('netstandard1'))" />
- <PackageReference Include="Smdn.Fundamental.Reflection" Version="[3.6.0,4.0.0)" />
+ <PackageReference Include="Smdn.Fundamental.Reflection" Version="[3.7.0,4.0.0)" />
</ItemGroup>
<ItemGroup>
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs
index bd43cb3..b371e8b 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2020 smdn <smdn@smdn.jp>
// SPDX-License-Identifier: MIT
+// cSpell:ignore retval
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs
index ace0b60..a5bdb07 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2022 smdn <smdn@smdn.jp>
// SPDX-License-Identifier: MIT
+// cSpell:ignore retval
#if SYSTEM_REFLECTION_NULLABILITYINFO
using System;
using System.Collections.Generic;
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs
index a12675b..5af7117 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs
@@ -13,7 +13,7 @@ using System.Text;
namespace Smdn.Reflection.ReverseGenerating;
public static partial class CSharpFormatter /* ITypeFormatter */ {
- private static readonly Dictionary<Accessibility, string> Accessibilities = new() {
+ private static readonly Dictionary<Accessibility, string> AccessibilityMap = new() {
{ Accessibility.Public, "public" },
{ Accessibility.Assembly, "internal" },
{ Accessibility.Family, "protected" },
@@ -183,7 +183,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
};
public static string FormatAccessibility(Accessibility accessibility)
- => Accessibilities.TryGetValue(accessibility, out var ret) ? ret : string.Empty;
+ => AccessibilityMap.TryGetValue(accessibility, out var ret) ? ret : string.Empty;
public static bool IsLanguagePrimitiveType(
Type t,
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs
index 4528b5c..3ccf121 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs
@@ -154,12 +154,31 @@ partial class Generator {
var attributes = GetAttributes(attributeProvider, options.AttributeDeclaration.TypeFilter)
.OrderBy(static attr => attr.GetAttributeType().FullName)
- .Select(attr =>
- (
+ .Select(attr => {
+ var omitInaccessibleMembersInNullStateAttribute =
+ options.AttributeDeclaration.OmitInaccessibleMembersInNullStateAttribute &&
+ IsMemberNullStateAttributeType(attr.GetAttributeType());
+
+ if (omitInaccessibleMembersInNullStateAttribute) {
+ var args = ConvertAttributeArguments(attr, omitInaccessibleMembers: true).ToList();
+
+ var isArgsEmpty = string.Equals("MemberNotNullWhenAttribute", attr.GetAttributeType().Name, StringComparison.Ordinal)
+ ? args.Count == 1 // with no args for 'member'/'members', only arg 'returnValue'
+ : args.Count == 0; // with no args for 'member'/'members'
+
+ return (
+ name: isArgsEmpty ? null : ConvertAttributeName(attr),
+ args: isArgsEmpty ? null : string.Join(", ", args)
+ );
+ }
+ else {
+ return (
name: ConvertAttributeName(attr),
- args: string.Join(", ", ConvertAttributeArguments(attr))
- )
+ args: string.Join(", ", ConvertAttributeArguments(attr, omitInaccessibleMembers: false))
);
+ }
+ })
+ .Where(static a => a.name is not null);
if (!attributes.Any())
return Enumerable.Empty<string>();
@@ -240,23 +259,61 @@ partial class Generator {
);
}
- IEnumerable<string> ConvertAttributeArguments(CustomAttributeData attr)
+ IEnumerable<string> ConvertAttributeArguments(CustomAttributeData attr, bool omitInaccessibleMembers)
{
foreach (var param in attr.Constructor.GetParameters()) {
var arg = attr.ConstructorArguments[param.Position];
- if (options.AttributeDeclaration.WithNamedArguments) {
- yield return string.Concat(
- param.Name,
- ": ",
- ConvertAttributeTypedArgument(arg)
+ if (
+ omitInaccessibleMembers &&
+ string.Equals(param.Name, "member", StringComparison.Ordinal) &&
+ arg.Value is string memberName &&
+ !IsAccessibleMemberName(attributeProvider, memberName)
+ ) {
+ // skip MemberNotNull(When)Attribute for non-public member
+ continue;
+ }
+
+ string convertedConstructorArgument;
+
+ if (
+ omitInaccessibleMembers &&
+ string.Equals(param.Name, "members", StringComparison.Ordinal) &&
+ arg.Value is IEnumerable<CustomAttributeTypedArgument> members
+ ) {
+ // exclude non-public members from MemberNotNull(When)Attribute
+ var filteredArgs = members
+ .Where(member =>
+ member.Value is string memberName &&
+ IsAccessibleMemberName(attributeProvider, memberName)
+ )
+ .Select(static member => (string)member.Value!)
+ .ToArray();
+
+ if (filteredArgs.Length == 0)
+ // skip empty MemberNotNull(When)Attribute
+ continue;
+
+ convertedConstructorArgument = CSharpFormatter.FormatValueDeclaration(
+ val: filteredArgs,
+ typeOfValue: filteredArgs.GetType(),
+ options: CSharpFormatter.ValueFormatOptions.FromGeneratorOptions(
+ options: options,
+ tryFindConstantField: false
+ )
);
}
else {
- yield return ConvertAttributeTypedArgument(arg);
+ convertedConstructorArgument = ConvertAttributeTypedArgument(arg);
}
+
+ yield return options.AttributeDeclaration.WithNamedArguments
+ ? string.Concat(param.Name, ": ", convertedConstructorArgument)
+ : convertedConstructorArgument;
}
+ // since the MemberNotNull(When)Attribute does not have writable fields,
+ // there is no need to consider attribute's named arguments
foreach (var namedArg in attr.NamedArguments) {
yield return string.Concat(
namedArg.MemberName,
@@ -275,6 +332,37 @@ partial class Generator {
tryFindConstantField: false
)
);
+
+ static bool IsMemberNullStateAttributeType(Type attributeType)
+ {
+ if (!string.Equals(attributeType.Namespace, "System.Diagnostics.CodeAnalysis", StringComparison.Ordinal))
+ return false;
+
+ return attributeType.Name switch {
+ "MemberNotNullAttribute" => true,
+ "MemberNotNullWhenAttribute" => true,
+ _ => false,
+ };
+ }
+
+ static bool IsAccessibleMemberName(ICustomAttributeProvider attributeProvider, string memberName)
+ =>
+ attributeProvider is MemberInfo attributeProvidingMember &&
+ attributeProvidingMember.DeclaringType is Type declaringType &&
+ declaringType
+ .GetMember(
+ name: memberName,
+ bindingAttr: BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
+ )
+ .FirstOrDefault(static member => {
+ var isPrivateOrAssembly = member switch {
+ PropertyInfo property => property.GetMethod?.IsPrivateOrAssembly() ?? true /* if there's no accessor, consider to be inaccessible */,
+ FieldInfo field => field.IsPrivateOrAssembly(),
+ _ => true, // unexpected kind of member; consider to be inaccessible
+ };
+ return !isPrivateOrAssembly;
+ })
+ is not null;
}
#pragma warning restore CA1502, CA1506
}
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs
index 8028349..dda1ac4 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs
@@ -9,6 +9,8 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
+using Smdn.Reflection.Attributes;
+
namespace Smdn.Reflection.ReverseGenerating;
public static partial class Generator {
@@ -56,6 +58,7 @@ public static partial class Generator {
options ?? throw new ArgumentNullException(nameof(options))
);
+#pragma warning disable CA1502 // TODO: simplify and refactor
private static IEnumerable<string> GenerateTypeDeclaration(
Type t,
bool generateExplicitBaseTypeAndInterfaces,
@@ -63,7 +66,7 @@ public static partial class Generator {
GeneratorOptions options
)
{
- var accessibilities = options.TypeDeclaration.WithAccessibility
+ var accessibilityList = options.TypeDeclaration.WithAccessibility
? CSharpFormatter.FormatAccessibility(t.GetAccessibility()) + " "
: string.Empty;
var typeName = CSharpFormatter.FormatTypeNameCore(
@@ -118,20 +121,21 @@ public static partial class Generator {
);
}
- yield return $"{modifierNew}{accessibilities}enum {typeName}{underlyingTypeDeclaration}";
+ yield return $"{modifierNew}{accessibilityList}enum {typeName}{underlyingTypeDeclaration}";
yield break;
}
string typeDeclaration;
if (t.IsInterface) {
- typeDeclaration = $"{modifierNew}{accessibilities}interface {typeName}";
+ typeDeclaration = $"{modifierNew}{accessibilityList}interface {typeName}";
}
else if (t.IsValueType) {
var isReadOnly = t.IsReadOnlyValueType() ? "readonly " : string.Empty;
var isByRefLike = t.IsByRefLikeValueType() ? "ref " : string.Empty;
+ var isRecord = (options.TypeDeclaration.EnableRecordTypes && t.IsRecord()) ? "record " : string.Empty;
- typeDeclaration = $"{modifierNew}{accessibilities}{isReadOnly}{isByRefLike}struct {typeName}";
+ typeDeclaration = $"{modifierNew}{accessibilityList}{isReadOnly}{isByRefLike}{isRecord}struct {typeName}";
}
else {
string? modifier = null;
@@ -143,7 +147,9 @@ public static partial class Generator {
else if (t.IsSealed)
modifier = "sealed ";
- typeDeclaration = $"{modifierNew}{accessibilities}{modifier}class {typeName}";
+ var isRecord = (options.TypeDeclaration.EnableRecordTypes && t.IsRecord()) ? "record " : string.Empty;
+
+ typeDeclaration = $"{modifierNew}{accessibilityList}{modifier}{isRecord}class {typeName}";
}
if (!generateExplicitBaseTypeAndInterfaces) {
@@ -176,6 +182,7 @@ public static partial class Generator {
}
}
}
+#pragma warning restore CA1502
[Obsolete($"Use {nameof(GenerateGenericParameterConstraintDeclaration)} instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(
@@ -241,7 +248,7 @@ public static partial class Generator {
: "struct";
if (hasDefaultConstructorConstraint && ConstraintTypesContainsValueType(genericParameter, out constraintTypes))
- hasDefaultConstructorConstraint = false; // contraint type of System.ValueType implies `new()`
+ hasDefaultConstructorConstraint = false; // constraint type of System.ValueType implies `new()`
}
else if (constraintAttrs.HasFlag(GenericParameterAttributes.ReferenceTypeConstraint)) {
yield return genericParameter.GetNullableAttributeMetadataValue() == NullableMetadataValue.Annotated
@@ -292,9 +299,15 @@ public static partial class Generator {
if (options == null)
throw new ArgumentNullException(nameof(options));
+ var isRecord = options.TypeDeclaration.EnableRecordTypes && options.TypeDeclaration.OmitRecordImplicitInterface && t.IsRecord();
+ var typeOfIEquatableOfRecord = isRecord
+ ? typeof(IEquatable<>).MakeGenericType(t) // IEquatable<TRecord>
+ : null;
+
return t
.GetExplicitBaseTypeAndInterfaces()
.Where(type => !(options.IgnorePrivateOrAssembly && type.IsPrivateOrAssembly()))
+ .Where(type => type != typeOfIEquatableOfRecord)
.Select(type => {
referencingNamespaces?.UnionWith(CSharpFormatter.ToNamespaceList(type));
return new {
@@ -1144,8 +1157,8 @@ public static partial class Generator {
}
var compilerGeneratedAccessors =
- (ev.AddMethod?.GetCustomAttributesData()?.Any(IsCompilerGeneratedAttribute) ?? false) &&
- (ev.RemoveMethod?.GetCustomAttributesData()?.Any(IsCompilerGeneratedAttribute) ?? false);
+ (ev.AddMethod?.HasCompilerGeneratedAttribute() ?? false) &&
+ (ev.RemoveMethod?.HasCompilerGeneratedAttribute() ?? false);
var emitAccessor = !ev.GetDeclaringTypeOrThrow().IsInterface && !compilerGeneratedAccessors;
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs
index cb62ecc..7e03bd3 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs
@@ -35,6 +35,8 @@ public class GeneratorOptions : ICloneable {
public bool WithAccessibility { get; set; } = true;
public bool OmitEndOfStatement { get; set; } = false;
public bool OmitEnumUnderlyingTypeIfPossible { get; set; } = false;
+ public bool EnableRecordTypes { get; set; } = false;
+ public bool OmitRecordImplicitInterface { get; set; } = false;
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
public NullabilityInfoContext? NullabilityInfoContext { get; set; } = new();
public object? NullabilityInfoContextLockObject { get; set; }
@@ -70,6 +72,7 @@ public class GeneratorOptions : ICloneable {
public bool WithDeclaringTypeName { get; set; } = false;
public bool WithNamedArguments { get; set; } = false;
public bool OmitAttributeSuffix { get; set; } = true;
+ public bool OmitInaccessibleMembersInNullStateAttribute { get; set; } = true;
public AttributeTypeFilter? TypeFilter { get; set; } = null;
public AttributeSectionFormat AccessorFormat { get; set; } = AttributeSectionFormat.List;
public AttributeSectionFormat AccessorParameterFormat { get; set; } = AttributeSectionFormat.List;
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection/UnwrapByRefParameterInfo.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection/UnwrapByRefParameterInfo.cs
index dbde904..251c9db 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection/UnwrapByRefParameterInfo.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection/UnwrapByRefParameterInfo.cs
@@ -12,14 +12,14 @@ namespace Smdn.Reflection;
internal sealed class UnwrapByRefParameterInfo : ParameterInfo {
public ParameterInfo BaseParameter { get; }
- public UnwrapByRefParameterInfo(ParameterInfo baseParamameter)
+ public UnwrapByRefParameterInfo(ParameterInfo baseParameter)
{
#if DEBUG
- if (!baseParamameter.ParameterType.IsByRef)
- throw new ArgumentException($"{baseParamameter.ParameterType} must be by-ref");
+ if (!baseParameter.ParameterType.IsByRef)
+ throw new ArgumentException($"{baseParameter.ParameterType} must be by-ref");
#endif
- BaseParameter = baseParamameter;
+ BaseParameter = baseParameter;
}
public override MemberInfo Member => BaseParameter.Member;
Notes
Full Changelog: releases/Smdn.Reflection.ReverseGenerating-1.3.0...releases/Smdn.Reflection.ReverseGenerating-1.4.0