[xcode12.2] [tests][xtro] Consider class (static) methods when checking for deprecation. Fix #9026 (#9781)

ref: https://github.com/xamarin/xamarin-macios/issues/9026
This commit is contained in:
monojenkins 2020-10-05 16:00:51 -04:00 коммит произвёл GitHub
Родитель 3b36acecba
Коммит 6018db4d39
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 9 добавлений и 14 удалений

Просмотреть файл

@ -59,8 +59,9 @@ namespace Extrospection
void ProcessObjcSelector (string fullname, VersionTuple objcVersion)
{
var class_method = fullname [0] == '+';
var n = fullname.IndexOf ("::");
string objcClassName = fullname.Substring (0, n);
string objcClassName = fullname.Substring (class_method ? 1: 0, n);
string selector = fullname.Substring (n + 2);
TypeDefinition managedType = ManagedTypes.FirstOrDefault (x => Helpers.GetName (x) == objcClassName);
@ -73,7 +74,7 @@ namespace Extrospection
if (AttributeHelpers.HasAnyDeprecationForCurrentPlatform (managedType))
return;
var matchingMethod = managedType.Methods.FirstOrDefault (x => x.GetSelector () == selector && x.IsPublic);
var matchingMethod = managedType.Methods.FirstOrDefault (x => x.GetSelector () == selector && x.IsPublic && x.IsStatic == class_method);
if (matchingMethod != null)
ProcessItem (matchingMethod, fullname, objcVersion, framework);
}
@ -152,8 +153,12 @@ namespace Extrospection
public override void VisitObjCMethodDecl (ObjCMethodDecl decl, VisitKind visitKind)
{
if (visitKind == VisitKind.Enter && AttributeHelpers.FindObjcDeprecated(decl.Attrs, out VersionTuple version))
ObjCDeprecatedSelectors[decl.QualifiedName] = version;
if (visitKind == VisitKind.Enter && AttributeHelpers.FindObjcDeprecated (decl.Attrs, out VersionTuple version)) {
var qn = decl.QualifiedName;
if (decl.IsClassMethod)
qn = "+" + qn;
ObjCDeprecatedSelectors [qn] = version;
}
}
public override void VisitFunctionDecl (FunctionDecl decl, VisitKind visitKind)

Просмотреть файл

@ -12,7 +12,6 @@
!missing-selector! CBCentralManager::init not bound
## short lived instance property being replaced with a static one
!deprecated-attribute-missing! CBManager::authorization missing a [Deprecated] attribute
!missing-selector! CBManager::authorization not bound
# Initial result from new rule missing-null-allowed

Просмотреть файл

@ -1,11 +1,6 @@
# We have our own managed ctor
!missing-pinvoke! CLLocationCoordinate2DMake is not bound
# xtro is confused because objc has two properties with the same name on objc, one static and the other one an instance one.
# we did add the deprecation in the correct one. Reported issue: https://github.com/xamarin/xamarin-macios/issues/9026
!deprecated-attribute-missing! CLLocationManager::authorizationStatus missing a [Deprecated] attribute
## unsorted
!missing-field! kCLHeadingFilterNone not bound

Просмотреть файл

@ -13,7 +13,3 @@
!missing-selector! CLLocationManager::startMonitoringForRegion:desiredAccuracy: not bound
!missing-selector! CLLocationManager::allowDeferredLocationUpdatesUntilTraveled:timeout: not bound
!missing-selector! CLLocationManager::disallowDeferredLocationUpdates not bound
# xtro confuse the instance vs the class property
!deprecated-attribute-missing! CLLocationManager::locationServicesEnabled missing a [Deprecated] attribute
!deprecated-attribute-missing! CLLocationManager::headingAvailable missing a [Deprecated] attribute