Skip to content

Commit

Permalink
Fix nullability warnings due to updated BCL annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jnm2 committed Nov 21, 2021
1 parent 7c407af commit 78bc1e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public override bool Execute()
{
var log = new SuppressibleLoggingHelper(Log, requiredPrefix: "RA", DisabledWarnings);

string unannotatedReferenceAssembly = TargetFrameworkDirectories.Select(path => Path.Combine(path.ItemSpec, UnannotatedReferenceAssembly + ".dll")).FirstOrDefault(File.Exists);
string? unannotatedReferenceAssembly = TargetFrameworkDirectories.Select(path => Path.Combine(path.ItemSpec, UnannotatedReferenceAssembly + ".dll")).FirstOrDefault(File.Exists);
string annotatedReferenceAssembly = Path.Combine(AnnotatedReferenceAssemblyDirectory, UnannotatedReferenceAssembly + ".dll");
bool foundAnnotatedAssembly = File.Exists(annotatedReferenceAssembly);

Expand Down
6 changes: 3 additions & 3 deletions TunnelVisionLabs.ReferenceAssemblyAnnotator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private static bool IsExcludedAnnotation(ICustomAttributeProvider provider, ICus
return annotatedTypeDefinition;
}

private static MethodDefinition FindMatchingMethod(SuppressibleLoggingHelper? log, MethodDefinition methodDefinition, TypeDefinition annotatedTypeDefinition)
private static MethodDefinition? FindMatchingMethod(SuppressibleLoggingHelper? log, MethodDefinition methodDefinition, TypeDefinition annotatedTypeDefinition)
{
try
{
Expand All @@ -305,12 +305,12 @@ private static MethodDefinition FindMatchingMethod(SuppressibleLoggingHelper? lo
}
}

private static PropertyDefinition FindMatchingProperty(PropertyDefinition propertyDefinition, TypeDefinition annotatedTypeDefinition)
private static PropertyDefinition? FindMatchingProperty(PropertyDefinition propertyDefinition, TypeDefinition annotatedTypeDefinition)
{
return annotatedTypeDefinition.Properties.SingleOrDefault(property => EquivalenceComparers.PropertyDefinition.Equals(propertyDefinition, property));
}

private static FieldDefinition FindMatchingField(FieldDefinition fieldDefinition, TypeDefinition annotatedTypeDefinition)
private static FieldDefinition? FindMatchingField(FieldDefinition fieldDefinition, TypeDefinition annotatedTypeDefinition)
{
return annotatedTypeDefinition.Fields.SingleOrDefault(property => property.Name == fieldDefinition.Name);
}
Expand Down

0 comments on commit 78bc1e4

Please sign in to comment.