Skip to content

Commit

Permalink
[xtro] Don't treat byref arguments as nullable.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Nov 14, 2024
1 parent 768c9e5 commit 8964cf3
Show file tree
Hide file tree
Showing 14 changed files with 6 additions and 82 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@

# Initial result from new rule extra-null-allowed
!extra-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewDataSource::GetIndexPath(UIKit.UICollectionView,System.String,System.IntPtr)' has a extraneous [NullAllowed] on return type
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #2
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #3
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
Expand All @@ -139,14 +136,9 @@
!extra-null-allowed! 'System.Void UIKit.UIMarkupTextPrintFormatter::.ctor(System.String)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UINavigationController::set_ViewControllers(UIKit.UIViewController[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UINavigationController::SetViewControllers(UIKit.UIViewController[],System.Boolean)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIPopoverPresentationControllerDelegate::WillRepositionPopover(UIKit.UIPopoverPresentationController,CoreGraphics.CGRect&,UIKit.UIView&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIPopoverPresentationControllerDelegate::WillRepositionPopover(UIKit.UIPopoverPresentationController,CoreGraphics.CGRect&,UIKit.UIView&)' has a extraneous [NullAllowed] on parameter #2
!extra-null-allowed! 'System.Void UIKit.UISimpleTextPrintFormatter::.ctor(Foundation.NSAttributedString)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UISimpleTextPrintFormatter::.ctor(System.String)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITabBar::BeginCustomizingItems(UIKit.UITabBarItem[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextDragPreviewRenderer::Adjust(CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGPoint)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextDragPreviewRenderer::Adjust(CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGPoint)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UITextDragPreviewRenderer::Adjust(CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGPoint)' has a extraneous [NullAllowed] on parameter #2
!extra-null-allowed! 'System.Void UIKit.UITextField::set_WeakDefaultTextAttributes(Foundation.NSDictionary)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextInputAssistantItem::set_LeadingBarButtonGroups(UIKit.UIBarButtonItemGroup[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextInputAssistantItem::set_TrailingBarButtonGroups(UIKit.UIBarButtonItemGroup[])' has a extraneous [NullAllowed] on parameter #0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@

!missing-release-attribute-on-return-value! CoreMedia.CMFormatDescription AVFoundation.AVTimedMetadataGroup::CopyFormatDescription()'s selector's ('copyFormatDescription') Objective-C method family ('copy') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.

# Initial result from new rule extra-null-allowed
!extra-null-allowed! 'AVFoundation.AVAudioTime AVFoundation.AVAudioTime::FromAudioTimeStamp(AudioToolbox.AudioTimeStamp&,System.Double)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void AVFoundation.AVAudioFormat::.ctor(AudioToolbox.AudioStreamBasicDescription&)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void AVFoundation.AVAudioFormat::.ctor(AudioToolbox.AudioStreamBasicDescription&,AVFoundation.AVAudioChannelLayout)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void AVFoundation.AVAudioTime::.ctor(AudioToolbox.AudioTimeStamp&,System.Double)' has a extraneous [NullAllowed] on parameter #0

# Swift Docs and Obj-C are out of sync
# https://developer.apple.com/documentation/avfoundation/avvideocompositioninstructionprotocol/1388661-requiredsourcetrackids
# https://developer.apple.com/documentation/avfoundation/1386654-avvideocompositioninstruction/1388661-requiredsourcetrackids?language=objc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,3 @@
!missing-release-attribute-on-return-value! CoreData.NSManagedObjectContext CoreData.NSPersistentContainer::get_NewBackgroundContext()'s selector's ('newBackgroundContext') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.
!missing-release-attribute-on-return-value! CoreData.NSManagedObjectID CoreData.NSIncrementalStore::NewObjectIdFor(CoreData.NSEntityDescription,Foundation.NSObject)'s selector's ('newObjectIDForEntity:referenceObject:') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.
!missing-release-attribute-on-return-value! Foundation.NSObject CoreData.NSIncrementalStore::NewValue(CoreData.NSRelationshipDescription,CoreData.NSManagedObjectID,CoreData.NSManagedObjectContext,Foundation.NSError&)'s selector's ('newValueForRelationship:forObjectWithID:withContext:error:') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.

# by-ref argument, cannot be null
!extra-null-allowed! 'System.Boolean CoreData.NSManagedObject::ValidateValue(Foundation.NSObject&,System.String,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #0
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,6 @@
!extra-null-allowed! 'Foundation.NSUrlSessionDownloadTask Foundation.NSUrlSession::CreateDownloadTaskFromResumeData(Foundation.NSData,Foundation.NSUrlDownloadSessionResponse)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Boolean Foundation.NSFileManager::Remove(Foundation.NSUrl,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Boolean Foundation.NSFileManager::Remove(System.String,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Boolean Foundation.NSFormatter::IsPartialStringValid(System.String&,Foundation.NSRange&,System.String,Foundation.NSRange,System.String&)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void Foundation.NSCoder::EncodeRoot(Foundation.NSObject)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void Foundation.NSOperationQueue::AddOperation(Foundation.NSOperation)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void Foundation.NSOperationQueue::AddOperations(Foundation.NSOperation[],System.Boolean)' has a extraneous [NullAllowed] on parameter #0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,3 @@

# unused (came along some API yet to be bound)
!unknown-simd-type-mapping! The Simd type vector_uchar16 does not have a mapping to a managed type. Please add one in SimdCheck.cs

# These four below just have a 'ref' in front of the parameters in question and are okay.
!extra-null-allowed! 'System.Void MetalPerformanceShaders.MPSImageHistogram::.ctor(Metal.IMTLDevice,MetalPerformanceShaders.MPSImageHistogramInfo&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void MetalPerformanceShaders.MPSImageHistogramEqualization::.ctor(Metal.IMTLDevice,MetalPerformanceShaders.MPSImageHistogramInfo&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void MetalPerformanceShaders.MPSImageHistogramSpecification::.ctor(Metal.IMTLDevice,MetalPerformanceShaders.MPSImageHistogramInfo&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void MetalPerformanceShaders.MPSImageNormalizedHistogram::.ctor(Metal.IMTLDevice,MetalPerformanceShaders.MPSImageHistogramInfo&)' has a extraneous [NullAllowed] on parameter #1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,3 @@
!missing-release-attribute-on-return-value! ModelIO.MDLMesh ModelIO.MDLMesh::CreatePlane(System.Numerics.Vector2,CoreGraphics.NVector2i,ModelIO.MDLGeometryType,ModelIO.IMDLMeshBufferAllocator)'s selector's ('newPlaneWithDimensions:segments:geometryType:allocator:') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.
!missing-release-attribute-on-return-value! ModelIO.MDLMesh ModelIO.MDLMesh::CreateSubdividedMesh(ModelIO.MDLMesh,System.UIntPtr,System.UIntPtr)'s selector's ('newSubdividedMesh:submeshIndex:subdivisionLevels:') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.
!missing-release-attribute-on-return-value! ModelIO.MDLMesh ModelIO.MDLMesh::NewBoxWithDimensions(System.Numerics.Vector3,CoreGraphics.NVector3i,ModelIO.MDLGeometryType,System.Boolean,ModelIO.IMDLMeshBufferAllocator)'s selector's ('newBoxWithDimensions:segments:geometryType:inwardNormals:allocator:') Objective-C method family ('new') indicates that the native method returns a retained object, and as such a '[return: Release]' attribute is required.

# incorrect result on `ref` parameter
!extra-null-allowed! 'System.Void ModelIO.MDLObject::EnumerateChildObjects(ObjCRuntime.Class,ModelIO.MDLObject,ModelIO.MDLObjectHandler,System.Boolean&)' has a extraneous [NullAllowed] on parameter #3
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
## it's an internal that is called from a non-generated binding
!incorrect-designated-initializer! SKWarpGeometryGrid::initWithColumns:rows:sourcePositions:destPositions: is not a constructor

## bad API signature, bound manually
!extra-null-allowed! 'SpriteKit.SKShapeNode SpriteKit.SKShapeNode::FromPoints(CoreGraphics.CGPoint&,System.UIntPtr)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'SpriteKit.SKShapeNode SpriteKit.SKShapeNode::FromSplinePoints(CoreGraphics.CGPoint&,System.UIntPtr)' has a extraneous [NullAllowed] on parameter #0

## headers documents it as: default to `nil`
!extra-null-allowed! 'System.Void SpriteKit.SKAction::set_TimingFunction2(SpriteKit.SKActionTimingFunction2)' has a extraneous [NullAllowed] on parameter #0

Expand Down
3 changes: 0 additions & 3 deletions tests/xtro-sharpie/api-annotations-dotnet/common-UIKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@
!extra-enum-value! Managed value 45 for UIViewAutoresizing.FlexibleMargins not found in native headers
!extra-enum-value! Managed value 63 for UIViewAutoresizing.All not found in native headers

## it's a `ref` on a struct, which xtro assumes nullable
!extra-null-allowed! 'System.Void UIKit.UIScrollViewDelegate::WillEndDragging(UIKit.UIScrollView,CoreGraphics.CGPoint,CoreGraphics.CGPoint&)' has a extraneous [NullAllowed] on parameter #2

## added in xcode 14 and is between a #if XAMCORE_5_0
!incorrect-protocol-member! UISearchSuggestion::representedObject is REQUIRED and should be abstract
!incorrect-protocol-member! UISearchSuggestion::setRepresentedObject: is REQUIRED and should be abstract
Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@

# Initial result from new rule extra-null-allowed
!extra-null-allowed! 'Foundation.NSIndexPath UIKit.UICollectionViewDataSource::GetIndexPath(UIKit.UICollectionView,System.String,System.IntPtr)' has a extraneous [NullAllowed] on return type
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #2
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #3
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
Expand All @@ -143,14 +140,9 @@
!extra-null-allowed! 'System.Void UIKit.UIMarkupTextPrintFormatter::.ctor(System.String)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UINavigationController::set_ViewControllers(UIKit.UIViewController[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UINavigationController::SetViewControllers(UIKit.UIViewController[],System.Boolean)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UIPopoverPresentationControllerDelegate::WillRepositionPopover(UIKit.UIPopoverPresentationController,CoreGraphics.CGRect&,UIKit.UIView&)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UIPopoverPresentationControllerDelegate::WillRepositionPopover(UIKit.UIPopoverPresentationController,CoreGraphics.CGRect&,UIKit.UIView&)' has a extraneous [NullAllowed] on parameter #2
!extra-null-allowed! 'System.Void UIKit.UISimpleTextPrintFormatter::.ctor(Foundation.NSAttributedString)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UISimpleTextPrintFormatter::.ctor(System.String)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITabBar::BeginCustomizingItems(UIKit.UITabBarItem[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextDragPreviewRenderer::Adjust(CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGPoint)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextDragPreviewRenderer::Adjust(CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGPoint)' has a extraneous [NullAllowed] on parameter #1
!extra-null-allowed! 'System.Void UIKit.UITextDragPreviewRenderer::Adjust(CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGRect&,CoreGraphics.CGPoint)' has a extraneous [NullAllowed] on parameter #2
!extra-null-allowed! 'System.Void UIKit.UITextField::set_WeakDefaultTextAttributes(Foundation.NSDictionary)' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextInputAssistantItem::set_LeadingBarButtonGroups(UIKit.UIBarButtonItemGroup[])' has a extraneous [NullAllowed] on parameter #0
!extra-null-allowed! 'System.Void UIKit.UITextInputAssistantItem::set_TrailingBarButtonGroups(UIKit.UIBarButtonItemGroup[])' has a extraneous [NullAllowed] on parameter #0
Expand Down
Loading

0 comments on commit 8964cf3

Please sign in to comment.