diff options
Diffstat (limited to 'linker')
14 files changed, 64 insertions, 57 deletions
diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs index 9d3cfacc7..cf6d75094 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs @@ -3,11 +3,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage (AttributeTargets.Class)] public class IgnoreTestCaseAttribute : Attribute { - public readonly string Reason; public IgnoreTestCaseAttribute (string reason) { - Reason = reason; + if (reason == null) + throw new ArgumentNullException (nameof (reason)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs index 086304179..5107bdef2 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs @@ -6,11 +6,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { /// </summary> [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public class KeptAssemblyAttribute : KeptAttribute { - public readonly string FileName; public KeptAssemblyAttribute (string fileName) { - FileName = fileName; + if (string.IsNullOrEmpty (fileName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (fileName)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs index c183e62d2..ba8021dcf 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs @@ -5,11 +5,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions [AttributeUsage (AttributeTargets.All, AllowMultiple = true, Inherited = false)] public class KeptAttributeAttribute : KeptAttribute { - public readonly string AttributeName; public KeptAttributeAttribute (string attributeName) { - AttributeName = attributeName; + if (string.IsNullOrEmpty (attributeName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (attributeName)); } } } diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs index ff1f2fa84..2824be630 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs @@ -5,18 +5,18 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] public sealed class KeptBaseTypeAttribute : KeptAttribute { - public readonly Type BaseType; - public readonly object [] GenericParameterNames; - public KeptBaseTypeAttribute (Type baseType) { - BaseType = baseType; + if (baseType == null) + throw new ArgumentNullException (nameof (baseType)); } public KeptBaseTypeAttribute (Type baseType, params object[] typeArguments) { - BaseType = baseType; - GenericParameterNames = typeArguments; + if (baseType == null) + throw new ArgumentNullException (nameof (baseType)); + if (typeArguments == null) + throw new ArgumentNullException (nameof (typeArguments)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs index 5014bd23a..b6af7dc0f 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs @@ -1,16 +1,15 @@ using System; -using System.Diagnostics; namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] public class KeptInterfaceAttribute : KeptAttribute { - public readonly Type InterfaceType; public KeptInterfaceAttribute (Type interfaceType) { - InterfaceType = interfaceType; + if (interfaceType == null) + throw new ArgumentNullException (nameof (interfaceType)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs index 00e55f266..e7b77ef8b 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs @@ -3,11 +3,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public sealed class KeptMemberAttribute : KeptAttribute { - public readonly string Name; public KeptMemberAttribute (string name) { - Name = name; + if (string.IsNullOrEmpty (name)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (name)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs index 9d658219a..3812acb67 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs @@ -4,22 +4,25 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public class KeptMemberInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - public readonly string AssemblyFileName; - public readonly string TypeName; - public readonly string [] MemberNames; public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames) { - AssemblyFileName = assemblyFileName; - TypeName = type.ToString (); - MemberNames = memberNames; + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentNullException (nameof (assemblyFileName)); + if (type == null) + throw new ArgumentNullException (nameof (type)); + if (memberNames == null) + throw new ArgumentNullException (nameof (memberNames)); } public KeptMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string [] memberNames) { - AssemblyFileName = assemblyFileName; - TypeName = typeName; - MemberNames = memberNames; + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentNullException (nameof (assemblyFileName)); + if (typeName == null) + throw new ArgumentNullException (nameof (typeName)); + if (memberNames == null) + throw new ArgumentNullException (nameof (memberNames)); } } } diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs index 2e0171a83..64b2f9ec9 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs @@ -5,19 +5,20 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public class KeptTypeInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - public readonly string AssemblyFileName; - public readonly string TypeName; - public KeptTypeInAssemblyAttribute (string assemblyFileName, Type type) { - AssemblyFileName = assemblyFileName; - TypeName = type.ToString (); + if (type == null) + throw new ArgumentNullException (nameof (type)); + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); } public KeptTypeInAssemblyAttribute (string assemblyFileName, string typeName) { - AssemblyFileName = assemblyFileName; - TypeName = typeName; + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); + if (string.IsNullOrEmpty (typeName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName)); } } } diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs index 4bb6a320a..60cab2a3f 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs @@ -6,11 +6,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { /// </summary> [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public class RemovedAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - public readonly string FileName; public RemovedAssemblyAttribute (string fileName) { - FileName = fileName; + if (string.IsNullOrEmpty (fileName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (fileName)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs index c19794184..078c7ac76 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs @@ -3,22 +3,25 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public class RemovedMemberInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - public readonly string AssemblyFileName; - public readonly string TypeName; - public readonly string [] MemberNames; public RemovedMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames) { - AssemblyFileName = assemblyFileName; - TypeName = type.ToString (); - MemberNames = memberNames; + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentNullException (nameof (assemblyFileName)); + if (type == null) + throw new ArgumentNullException (nameof (type)); + if (memberNames == null) + throw new ArgumentNullException (nameof (memberNames)); } public RemovedMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string [] memberNames) { - AssemblyFileName = assemblyFileName; - TypeName = typeName; - MemberNames = memberNames; + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentNullException (nameof (assemblyFileName)); + if (typeName == null) + throw new ArgumentNullException (nameof (typeName)); + if (memberNames == null) + throw new ArgumentNullException (nameof (memberNames)); } } } diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs index a56eee32a..506e2cdea 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs @@ -4,19 +4,20 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] public class RemovedTypeInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - public readonly string AssemblyFileName; - public readonly string TypeName; - public RemovedTypeInAssemblyAttribute (string assemblyFileName, Type type) { - AssemblyFileName = assemblyFileName; - TypeName = type.ToString (); + if (type == null) + throw new ArgumentNullException (nameof (type)); + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); } public RemovedTypeInAssemblyAttribute (string assemblyFileName, string typeName) { - AssemblyFileName = assemblyFileName; - TypeName = typeName; + if (string.IsNullOrEmpty (assemblyFileName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); + if (string.IsNullOrEmpty (typeName)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName)); } } } diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs index 7529a6255..e287d5a56 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/CoreLinkAttribute.cs @@ -3,11 +3,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata { [AttributeUsage (AttributeTargets.Class)] public class CoreLinkAttribute : BaseMetadataAttribute { - public readonly string Value; public CoreLinkAttribute (string value) { - Value = value; + if (string.IsNullOrEmpty (value)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (value)); } } }
\ No newline at end of file diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs index 044b4a5f8..0c6fa852d 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs @@ -3,11 +3,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata { [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] public class ReferenceAttribute : BaseMetadataAttribute { - public readonly string Value; public ReferenceAttribute (string value) { - Value = value; + if (string.IsNullOrEmpty (value)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (value)); } } } diff --git a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs index 805b1ac56..c204a92db 100644 --- a/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs +++ b/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs @@ -3,11 +3,11 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata { [AttributeUsage (AttributeTargets.Class)] public class SandboxDependencyAttribute : BaseMetadataAttribute { - public readonly string RelativePathToFile; public SandboxDependencyAttribute (string relativePathToFile) { - RelativePathToFile = relativePathToFile; + if (string.IsNullOrEmpty (relativePathToFile)) + throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile)); } } }
\ No newline at end of file |