Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xtro test for [Deprecated] attributes and fix up usages #4966

Merged
merged 5 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion src/appkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3731,6 +3731,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea
NSColor SelectedControl { get; }

[Static]
[Deprecated (PlatformName.MacOSX, message: "Use 'SelectedContentBackgroundColor' instead.")]
[Export ("secondarySelectedControlColor")]
NSColor SecondarySelectedControl { get; }

Expand Down Expand Up @@ -3821,6 +3822,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea
NSColor HeaderText { get; }

[Static]
[Deprecated (PlatformName.MacOSX, message : "Use 'SelectedContentBackgroundColor' instead.")]
[Export ("alternateSelectedControlColor")]
NSColor AlternateSelectedControl { get; }

Expand All @@ -3829,6 +3831,7 @@ partial interface NSColor : NSCoding, NSCopying, NSSecureCoding, NSPasteboardRea
NSColor AlternateSelectedControlText { get; }

[Static]
[Advice ("Use 'AlternatingContentBackgroundColors' instead.")]
[Export ("controlAlternatingRowBackgroundColors")]
NSColor [] ControlAlternatingRowBackgroundColors ();

Expand Down Expand Up @@ -5757,6 +5760,7 @@ partial interface NSDocumentController : NSWindowRestoration, NSCoding {
[Export ("runModalOpenPanel:forTypes:")]
nint RunModalOpenPanel (NSOpenPanel openPanel, string [] types);

[Deprecated (PlatformName.MacOSX, 10, 7, message: "Use 'OpenDocument (NSUrl, bool, OpenDocumentCompletionHandler)' instead.")]
[Export ("openDocumentWithContentsOfURL:display:error:")]
NSObject OpenDocument (NSUrl url, bool displayDocument, out NSError outError);

Expand All @@ -5767,6 +5771,7 @@ partial interface NSDocumentController : NSWindowRestoration, NSCoding {
[Export ("makeDocumentWithContentsOfURL:ofType:error:")]
NSObject MakeDocument (NSUrl url, string typeName, out NSError outError);

[Deprecated (PlatformName.MacOSX, 10, 7, message: "Use 'NSDocumentController.ReopenDocumentForUrl (NSUrl, NSUrl, bool, OpenDocumentCompletionHandler)' instead.")]
[Export ("reopenDocumentForURL:withContentsOfURL:error:")]
bool ReopenDocument (NSUrl url, NSUrl contentsUrl, out NSError outError);

Expand Down Expand Up @@ -6790,6 +6795,7 @@ interface NSFontManager : NSMenuItemValidation {
[Export ("sendAction")]
bool SendAction { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
NSObject WeakDelegate { get; set; }

Expand All @@ -6802,24 +6808,31 @@ interface NSFontManager : NSMenuItemValidation {
[Export ("convertAttributes:")]
NSDictionary ConvertAttributes (NSDictionary attributes);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontDescriptor.MatchingFontDescriptors' instead.")]
[Export ("availableFontNamesMatchingFontDescriptor:")]
string [] AvailableFontNamesMatchingFontDescriptor (NSFontDescriptor descriptor);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontCollection.AllFontCollectionNames' instead.")]
[Export ("collectionNames")]
string [] CollectionNames { get; }

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontCollection.GetMatchingDescriptors ()' instead.")]
[Export ("fontDescriptorsInCollection:")]
NSArray FontDescriptorsInCollection (string collectionNames);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSFontCollection.ShowFontCollection (NSFontCollection, string, NSFontCollectionVisibility, out NSError)' instead.")]
[Export ("addCollection:options:")]
bool AddCollection (string collectionName, NSFontCollectionOptions collectionOptions);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'HideFontCollection (string, NSFontCollectionVisibility, out NSError)' instead.")]
[Export ("removeCollection:")]
bool RemoveCollection (string collectionName);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSMutableFontCollection.AddQueryForDescriptors' instead.")]
[Export ("addFontDescriptors:toCollection:")]
void AddFontDescriptors (NSFontDescriptor [] descriptors, string collectionName);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSMutableFontCollection.RemoveQueryForDescriptors' instead.")]
[Export ("removeFontDescriptor:fromCollection:")]
void RemoveFontDescriptor (NSFontDescriptor descriptor, string collection);

Expand Down Expand Up @@ -7998,13 +8011,16 @@ partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibility
[Export ("size")]
CGSize Size { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Static]
[Export ("menuZone")]
NSZone MenuZone { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("helpRequested:")]
void HelpRequested (NSEvent eventPtr);

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("isTornOff")]
bool IsTornOff { get; }

Expand Down Expand Up @@ -8042,6 +8058,7 @@ partial interface NSMenu : NSCoding, NSCopying, NSAccessibility, NSAccessibility
[Export ("showsStateColumn")]
bool ShowsStateColumn { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("menuChangedMessagesEnabled")]
bool MenuChangedMessagesEnabled { get; set; }

Expand Down Expand Up @@ -11919,30 +11936,39 @@ interface NSPrinter : NSCoding, NSCopying {
[Export ("pageSizeForPaper:")]
CGSize PageSizeForPaper (string paperName);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("statusForTable:")]
NSPrinterTableStatus StatusForTable (string tableName);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("isKey:inTable:")]
bool IsKeyInTable (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("booleanForKey:inTable:")]
bool BooleanForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("floatForKey:inTable:")]
float /* float, not CGFloat */ FloatForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("intForKey:inTable:")]
int /* int, not NSInteger */ IntForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("rectForKey:inTable:")]
CGRect RectForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("sizeForKey:inTable:")]
CGSize SizeForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("stringForKey:inTable:")]
string StringForKey (string key, string table);

[Deprecated (PlatformName.MacOSX, 10, 9)]
[Export ("stringListForKey:inTable:")]
string [] StringListForKey (string key, string table);

Expand Down Expand Up @@ -14314,7 +14340,7 @@ partial interface NSSound : NSSecureCoding, NSCopying, NSPasteboardReading, NSPa
[Export ("playbackDeviceIdentifier")]
string PlaybackDeviceID { get; set; }

// FIXME: Poor docs, no type defined for the array elements
[Deprecated (PlatformName.MacOSX, 10, 9)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth removing the fixme if it's now deprecated.

[Export ("channelMapping")]
NSObject ChannelMapping { get; set; }
}
Expand Down Expand Up @@ -15941,6 +15967,7 @@ partial interface NSView : NSDraggingDestination, NSAnimatablePropertyContainer,
[Export ("drawPageBorderWithSize:")]
void DrawPageBorder (CGSize borderSize);

[Deprecated (PlatformName.MacOSX, 10, 14, message: "Never called.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean never called?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note from apple said this method is never called.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a callback (hence it doesn't mean never called by the OS) so I assume it means calling the method has no effect anymore. So something like: "Calling this method won't have any effects anymore." would be slightly clearer.

Copy link
Contributor Author

@chamons chamons Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not exactly true, you can implement NSView subclass and override various Draw functions and AppKit will call them.

I could say something like "This method is never called and does nothing", but that feels like a mouthful.

[Export ("drawSheetBorderWithSize:")]
void DrawSheetBorder (CGSize borderSize);

Expand Down Expand Up @@ -17146,6 +17173,7 @@ interface NSTableViewDataSource {
[Export ("tableView:acceptDrop:row:dropOperation:")]
bool AcceptDrop (NSTableView tableView, [Protocolize (4)] NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'NSFilePromiseReceiver' instead.")]
[Export ("tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:")]
string [] FilesDropped (NSTableView tableView, NSUrl dropDestination, NSIndexSet indexSet );

Expand Down Expand Up @@ -18491,6 +18519,7 @@ partial interface NSTextContainer : NSCoding {
[Export ("isSimpleRectangularTextContainer")]
bool IsSimpleRectangularTextContainer { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("containsPoint:")]
bool ContainsPoint (CGPoint point);

Expand Down Expand Up @@ -18640,6 +18669,7 @@ interface NSTextTab : NSSecureCoding, NSCopying {
interface NSTextInput
{
[Abstract]
[Deprecated (PlatformName.MacOSX, 10, 6)]
[Export ("insertText:")]
void InsertText (NSObject insertString);

Expand Down Expand Up @@ -18755,6 +18785,7 @@ partial interface NSTextView : NSTextInputClient, NSTextLayoutOrientationProvide
[Export ("lowerBaseline:")]
void LowerBaseline (NSObject sender);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use unicode characters via the character palette.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmh the character palette? Can we be more specific?

Copy link
Contributor Author

@chamons chamons Oct 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/11x/AppKit.framework/Headers/NSTextView.h:- (void)toggleTraditionalCharacterShape:(nullable id)sender NS_DEPRECATED_MAC(10_0, 10_11, "Use the traditional shaped characters encoded in the Unicode standard. Access the characters via the character palette.");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

character palette (emojis) often bound as control + command + space. (;

[Export ("toggleTraditionalCharacterShape:")]
void ToggleTraditionalCharacterShape (NSObject sender);

Expand Down Expand Up @@ -20339,6 +20370,7 @@ partial interface NSWindow : NSAnimatablePropertyContainer, NSUserInterfaceItemI
[Export ("gState")]
nint GState ();

[Deprecated (PlatformName.MacOSX, 10, 14)]
[Export ("setOneShot:")]
void SetOneShot (bool flag);

Expand Down Expand Up @@ -20414,9 +20446,11 @@ partial interface NSWindow : NSAnimatablePropertyContainer, NSUserInterfaceItemI
[Export ("sharingType")]
NSWindowSharingType SharingType { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 14)]
[Export ("preferredBackingLocation")]
NSWindowBackingLocation PreferredBackingLocation { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 14)]
[Export ("backingLocation")]
NSWindowBackingLocation BackingLocation { get; }

Expand Down Expand Up @@ -21241,6 +21275,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("openFile:withApplication:andDeactivate:"), ThreadSafe]
bool OpenFile (string fullPath, [NullAllowed] string appName, bool deactivate);

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSWorkspace.OpenUrl' instead.")]
[Export ("openFile:fromImage:at:inView:"), ThreadSafe]
bool OpenFile (string fullPath, NSImage anImage, CGPoint point, NSView aView);

Expand Down Expand Up @@ -21304,6 +21339,7 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:"), ThreadSafe]
bool GetFileSystemInfo (string fullPath, out bool removableFlag, out bool writableFlag, out bool unmountableFlag, out string description, out string fileSystemType);

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("performFileOperation:source:destination:files:tag:"), ThreadSafe]
bool PerformFileOperation (NSString workspaceOperation, string source, string destination, string[] files, out nint tag);

Expand All @@ -21319,9 +21355,11 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("hideOtherApplications")]
void HideOtherApplications ();

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("mountedLocalVolumePaths")]
string[] MountedLocalVolumePaths { get; }

[Deprecated (PlatformName.MacOSX, 10, 11)]
[Export ("mountedRemovableMedia")]
string[] MountedRemovableMedia { get; }

Expand All @@ -21341,9 +21379,11 @@ interface NSWorkspace : NSWorkspaceAccessibilityExtensions {
[Export ("openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:"), ThreadSafe]
bool _OpenUrls (NSUrl[] urls, string bundleIdentifier, NSWorkspaceLaunchOptions options, NSAppleEventDescriptor descriptor, [NullAllowed] string[] identifiers);

[Deprecated (PlatformName.MacOSX, 10, 7, message: "Use 'NSWorkspace.RunningApplications' instead.")]
[Export ("launchedApplications")]
NSDictionary [] LaunchedApplications { get; }

[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSWorkspace.FrontmostApplication' instead.")]
[Export ("activeApplication")]
NSDictionary ActiveApplication { get; }

Expand Down Expand Up @@ -22262,6 +22302,7 @@ partial interface NSTypesetter {
NSRange GlyphRangeForCharacterRange (NSRange charRange, out NSRange actualCharRange);

// TODO: could use a higher level API
[Deprecated (PlatformName.MacOSX, 10, 13)]
[Export ("getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:bidiLevels:")]
nuint GetGlyphsInRange (NSRange glyphsRange, IntPtr glyphBuffer, IntPtr charIndexBuffer, IntPtr inscribeBuffer, IntPtr elasticBuffer, IntPtr bidiLevelBuffer);

Expand Down
18 changes: 17 additions & 1 deletion src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,7 @@ interface AVAudioSession {
AVAudioSession SharedInstance ();

[NoWatch]
[Availability (Deprecated = Platform.iOS_6_0, Message = "Use 'AVAudioSession.Notification.Observe*' methods instead.")]
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
[NoTV]
NSObject WeakDelegate { get; set; }
Expand Down Expand Up @@ -2339,6 +2340,7 @@ interface AVAudioSessionRouteChangeEventArgs {
AVAudioSessionRouteDescription PreviousRoute { get; }
}

[Deprecated (PlatformName.iOS, 6, 0)]
[BaseType (typeof (NSObject))]
[Model]
[Protocol]
Expand Down Expand Up @@ -3989,7 +3991,8 @@ interface AVAssetWriter {
void CancelWriting ();

[Export ("finishWriting")]
[Availability (Deprecated = Platform.iOS_6_0, Message = "Use the asynchronous 'FinishWriting (NSAction completionHandler)' instead.")]
[Deprecated (PlatformName.iOS, 6, 0, message: "Use the asynchronous 'FinishWriting (NSAction completionHandler)' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 9, message: "Use the asynchronous 'FinishWriting (NSAction completionHandler)' instead.")]
bool FinishWriting ();

[Mac (10,9)]
Expand Down Expand Up @@ -9412,11 +9415,13 @@ interface AVCapturePhotoOutput
[Export ("livePhotoAutoTrimmingEnabled")]
bool IsLivePhotoAutoTrimmingEnabled { [Bind ("isLivePhotoAutoTrimmingEnabled")] get; set; }

[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'AVCapturePhoto.FileDataRepresentation' instead.")]
[Static]
[Export ("JPEGPhotoDataRepresentationForJPEGSampleBuffer:previewPhotoSampleBuffer:")]
[return: NullAllowed]
NSData GetJpegPhotoDataRepresentation (CMSampleBuffer JPEGSampleBuffer, [NullAllowed] CMSampleBuffer previewPhotoSampleBuffer);

[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'AVCapturePhoto.FileDataRepresentation' instead.")]
[Static]
[Export ("DNGPhotoDataRepresentationForRawSampleBuffer:previewPhotoSampleBuffer:")]
[return: NullAllowed]
Expand Down Expand Up @@ -10298,6 +10303,8 @@ interface AVPlayer {
[Export ("actionAtItemEnd")]
AVPlayerActionAtItemEnd ActionAtItemEnd { get; set; }

[Deprecated (PlatformName.MacOSX, 10, 13)]
[Deprecated (PlatformName.iOS, 11, 0)]
[Export ("closedCaptionDisplayEnabled")]
bool ClosedCaptionDisplayEnabled { [Bind ("isClosedCaptionDisplayEnabled")] get; set; }

Expand Down Expand Up @@ -10713,12 +10720,18 @@ interface AVPlayerItem : NSCopying {
[Export ("stepByCount:")]
void StepByCount (nint stepCount);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'Seek (NSDate, AVCompletion)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'Seek (NSDate, AVCompletion)' instead.")]
[Export ("seekToDate:")]
bool Seek (NSDate date);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'Seek (CMTime, AVCompletion)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'Seek (CMTime, AVCompletion)' instead.")]
[Export ("seekToTime:")]
void Seek (CMTime time);

[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'Seek (CMTime, CMTime, CMTime, AVCompletion)' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'Seek (CMTime, CMTime, CMTime, AVCompletion)' instead.")]
[Export ("seekToTime:toleranceBefore:toleranceAfter:")]
void Seek (CMTime time, CMTime toleranceBefore, CMTime toleranceAfter);

Expand Down Expand Up @@ -10775,6 +10788,8 @@ interface AVPlayerItem : NSCopying {

[return: NullAllowed]
[Mac (10, 8)]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CurrentMediaSelection' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message: "Use 'CurrentMediaSelection' instead.")]
[Export ("selectedMediaOptionInMediaSelectionGroup:")]
AVMediaSelectionOption SelectedMediaOption (AVMediaSelectionGroup inMediaSelectionGroup);

Expand Down Expand Up @@ -12892,6 +12907,7 @@ interface AVCapturePhoto
NSData FileDataRepresentation { get; }

[iOS (11,0)]
[Deprecated (PlatformName.iOS, 12, 0, message: "Use 'GetFileDataRepresentation' instead.")]
[Export ("fileDataRepresentationWithReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData:")]
[return: NullAllowed]
NSData GetFileDataRepresentation ([NullAllowed] NSDictionary<NSString, NSObject> replacementMetadata, [NullAllowed] NSDictionary<NSString, NSObject> replacementEmbeddedThumbnailPhotoFormat, [NullAllowed] CVPixelBuffer replacementEmbeddedThumbnailPixelBuffer, [NullAllowed] AVDepthData replacementDepthData);
Expand Down
5 changes: 4 additions & 1 deletion src/corebluetooth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ interface CBPeripheral : NSCopying {
[Model]
[Protocol]
interface CBPeripheralDelegate {
[Availability (Deprecated=Platform.iOS_8_0, Message="Use 'RssiRead' instead.")]
[Deprecated (PlatformName.MacOSX, 10, 13, message : "Use 'RssiRead' instead.")]
[Deprecated (PlatformName.iOS, 8, 0, message : "Use 'RssiRead' instead.")]
[Export ("peripheralDidUpdateRSSI:error:"), EventArgs ("NSError", true)]
void RssiUpdated (CBPeripheral peripheral, NSError error);

Expand Down Expand Up @@ -636,6 +637,8 @@ interface CBUUID : NSCopying {
CBUUID FromData (NSData theData);

[Availability (Deprecated = Platform.iOS_9_0)]
[Deprecated (PlatformName.MacOSX, 10, 13)]
[Deprecated (PlatformName.iOS, 9, 0)]
[NoWatch]
[Static]
[Export ("UUIDWithCFUUID:")]
Expand Down
Loading