diff --git a/CHANGELOG.md b/CHANGELOG.md index 887c17d966f..3d9c0c7f62c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,6 +125,12 @@ supported version. attempting to connect to the old URL and getting redirected rather than only the first connection after the deployment location changed. ([Core #6630](https://github.com/realm/realm-core/issues/6630), since v10.38.2) +* `-[RLMAsymmetricObject createObject:withValue:]` was marked as having a + non-null return value despite always returning `nil` (since v10.29.0). +* Eliminate several clang static analyzer warnings which did not report actual + bugs. + + ### Compatibility diff --git a/Realm/ObjectServerTests/RLMObjectServerTests.mm b/Realm/ObjectServerTests/RLMObjectServerTests.mm index 6c477b90b55..f86d1c6cdbd 100644 --- a/Realm/ObjectServerTests/RLMObjectServerTests.mm +++ b/Realm/ObjectServerTests/RLMObjectServerTests.mm @@ -1176,7 +1176,7 @@ - (void)testLogBackInSameRealmDownload { // Log out the user. [self logOutUser:user]; // Log the user back in. - user = [self logInUserForCredentials:credentials]; + [self logInUserForCredentials:credentials]; RLMRunChildAndWait(); @@ -1205,7 +1205,7 @@ - (void)testLogBackInDeferredRealmUpload { [self addPersonsToRealm:realm persons:@[[Person john]]]; CHECK_COUNT(1, Person, realm); - user = [self logInUserForCredentials:credentials]; + [self logInUserForCredentials:credentials]; [self addPersonsToRealm:realm persons:@[[Person john], [Person paul], [Person ringo]]]; [self waitForUploadsForRealm:realm]; diff --git a/Realm/ObjectServerTests/RLMSyncTestCase.h b/Realm/ObjectServerTests/RLMSyncTestCase.h index a64e87875fd..168b64fbc37 100644 --- a/Realm/ObjectServerTests/RLMSyncTestCase.h +++ b/Realm/ObjectServerTests/RLMSyncTestCase.h @@ -118,17 +118,14 @@ RLM_HEADER_AUDIT_BEGIN(nullability, sendability) /// Wait for downloads to complete; drop any error. - (void)waitForDownloadsForRealm:(RLMRealm *)realm; -- (void)waitForDownloadsForRealm:(RLMRealm *)realm error:(NSError **)error; /// Wait for uploads to complete; drop any error. - (void)waitForUploadsForRealm:(RLMRealm *)realm; -- (void)waitForUploadsForRealm:(RLMRealm *)realm error:(NSError **)error; /// Wait for downloads to complete while spinning the runloop. This method uses expectations. - (void)waitForDownloadsForUser:(RLMUser *)user partitionValue:(NSString *)partitionValue - expectation:(nullable XCTestExpectation *)expectation - error:(NSError **)error; + expectation:(nullable XCTestExpectation *)expectation; /// Manually set the access token for a user. Used for testing invalid token conditions. - (void)manuallySetAccessTokenForUser:(RLMUser *)user value:(NSString *)tokenValue; diff --git a/Realm/ObjectServerTests/RLMSyncTestCase.mm b/Realm/ObjectServerTests/RLMSyncTestCase.mm index e9c87f5eb91..7164ae64b42 100644 --- a/Realm/ObjectServerTests/RLMSyncTestCase.mm +++ b/Realm/ObjectServerTests/RLMSyncTestCase.mm @@ -159,7 +159,7 @@ - (void)waitForDownloadsForUser:(RLMUser *)user NSAssert(realms.count == counts.count && realms.count == partitionValues.count, @"Test logic error: all array arguments must be the same size."); for (NSUInteger i = 0; i < realms.count; i++) { - [self waitForDownloadsForUser:user partitionValue:partitionValues[i] expectation:nil error:nil]; + [self waitForDownloadsForUser:user partitionValue:partitionValues[i] expectation:nil]; [realms[i] refresh]; CHECK_COUNT([counts[i] integerValue], Person, realms[i]); } @@ -372,24 +372,14 @@ - (RLMCredentials *)jwtCredentialWithAppId:(NSString *)appId { return [RLMCredentials credentialsWithJWT:[self createJWTWithAppId:appId]]; } -- (void)waitForDownloadsForRealm:(RLMRealm *)realm { - [self waitForDownloadsForRealm:realm error:nil]; -} - -- (void)waitForUploadsForRealm:(RLMRealm *)realm { - [self waitForUploadsForRealm:realm error:nil]; -} - - (void)waitForDownloadsForUser:(RLMUser *)user partitionValue:(NSString *)partitionValue - expectation:(XCTestExpectation *)expectation - error:(NSError **)error { + expectation:(XCTestExpectation *)expectation { RLMSyncSession *session = [user sessionForPartitionValue:partitionValue]; NSAssert(session, @"Cannot call with invalid partition value"); XCTestExpectation *ex = expectation ?: [self expectationWithDescription:@"Wait for download completion"]; - __block NSError *theError = nil; BOOL queued = [session waitForDownloadCompletionOnQueue:dispatch_get_global_queue(0, 0) callback:^(NSError *err) { - theError = err; + XCTAssertNil(err); [ex fulfill]; }]; if (!queued) { @@ -397,18 +387,14 @@ - (void)waitForDownloadsForUser:(RLMUser *)user return; } [self waitForExpectations:@[ex] timeout:60.0]; - if (error) { - *error = theError; - } } -- (void)waitForUploadsForRealm:(RLMRealm *)realm error:(NSError **)error { +- (void)waitForUploadsForRealm:(RLMRealm *)realm { RLMSyncSession *session = realm.syncSession; NSAssert(session, @"Cannot call with invalid Realm"); XCTestExpectation *ex = [self expectationWithDescription:@"Wait for upload completion"]; - __block NSError *completionError; BOOL queued = [session waitForUploadCompletionOnQueue:dispatch_get_global_queue(0, 0) callback:^(NSError *error) { - completionError = error; + XCTAssertNil(error); [ex fulfill]; }]; if (!queued) { @@ -416,17 +402,14 @@ - (void)waitForUploadsForRealm:(RLMRealm *)realm error:(NSError **)error { return; } [self waitForExpectations:@[ex] timeout:60.0]; - if (error) - *error = completionError; } -- (void)waitForDownloadsForRealm:(RLMRealm *)realm error:(NSError **)error { +- (void)waitForDownloadsForRealm:(RLMRealm *)realm { RLMSyncSession *session = realm.syncSession; NSAssert(session, @"Cannot call with invalid Realm"); XCTestExpectation *ex = [self expectationWithDescription:@"Wait for download completion"]; - __block NSError *completionError; BOOL queued = [session waitForDownloadCompletionOnQueue:nil callback:^(NSError *error) { - completionError = error; + XCTAssertNil(error); [ex fulfill]; }]; if (!queued) { @@ -434,9 +417,6 @@ - (void)waitForDownloadsForRealm:(RLMRealm *)realm error:(NSError **)error { return; } [self waitForExpectations:@[ex] timeout:60.0]; - if (error) { - *error = completionError; - } [realm refresh]; } diff --git a/Realm/RLMAsymmetricObject.h b/Realm/RLMAsymmetricObject.h index 09deb787e13..5bda8f9f674 100644 --- a/Realm/RLMAsymmetricObject.h +++ b/Realm/RLMAsymmetricObject.h @@ -76,7 +76,7 @@ RLM_HEADER_AUDIT_BEGIN(nullability, sendability) @return Returns `nil` */ -+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value; ++ (nullable instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value; #pragma mark - Properties diff --git a/Realm/RLMMigration.mm b/Realm/RLMMigration.mm index bddf6d894ee..7d516ef2393 100644 --- a/Realm/RLMMigration.mm +++ b/Realm/RLMMigration.mm @@ -38,6 +38,8 @@ using namespace realm; @implementation RLMMigration { + RLMRealm *_oldRealm; + RLMRealm *_realm; realm::Schema *_schema; } @@ -52,11 +54,11 @@ - (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm sc } - (RLMSchema *)oldSchema { - return self.oldRealm.schema; + return _oldRealm.schema; } - (RLMSchema *)newSchema { - return self.realm.schema; + return _realm.schema; } - (void)enumerateObjects:(NSString *)className block:(__attribute__((noescape)) RLMObjectMigrationBlock)block { diff --git a/Realm/RLMMigration_Private.h b/Realm/RLMMigration_Private.h index 393f4118450..7680e6e3ba1 100644 --- a/Realm/RLMMigration_Private.h +++ b/Realm/RLMMigration_Private.h @@ -27,14 +27,8 @@ namespace realm { RLM_HEADER_AUDIT_BEGIN(nullability, sendability) @interface RLMMigration () - -@property (nonatomic, strong) RLMRealm *oldRealm; -@property (nonatomic, strong) RLMRealm *realm; - - (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema; - - (void)execute:(RLMMigrationBlock)block objectClass:(_Nullable Class)cls; - @end RLM_HEADER_AUDIT_END(nullability, sendability) diff --git a/Realm/RLMQueryUtil.mm b/Realm/RLMQueryUtil.mm index 45f343cff60..388a220f378 100644 --- a/Realm/RLMQueryUtil.mm +++ b/Realm/RLMQueryUtil.mm @@ -731,16 +731,14 @@ Query make_diacritic_insensitive_constraint(NSPredicateOperatorType operatorType void QueryBuilder::add_diacritic_sensitive_string_constraint(NSPredicateOperatorType operatorType, NSComparisonPredicateOptions predicateOptions, C&& column, T&& value) { - if constexpr (is_any_v>) { - // This nesting isnt pretty but without it the compiler will complain about `T` having no known - // conversion from Columns to Mixed. This is due to the fact that all values on a - // dictionary column are boxed in Mixed. - if constexpr (is_any_v) { - do_add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward(column), value); - } + + if constexpr (is_any_v> && is_any_v, Columns>) { + // Core only implements these for Columns due to Dictionary being Mixed internall + throwException(@"Unsupported predicate", + @"String comparisons on a Dictionary and another property are only implemented for AnyRealmValue properties."); } else { - do_add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward(column), value); + do_add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward(column), std::forward(value)); } } @@ -749,7 +747,7 @@ Query make_diacritic_insensitive_constraint(NSPredicateOperatorType operatorType NSComparisonPredicateOptions predicateOptions, C&& column, T&& value) { if (!(predicateOptions & NSDiacriticInsensitivePredicateOption)) { - add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward(column), std::move(value)); + add_diacritic_sensitive_string_constraint(operatorType, predicateOptions, std::forward(column), std::forward(value)); return; } @@ -998,7 +996,7 @@ void convert_null(T&& value, Fn&& fn) { fn(null()); } else { - fn(value); + fn(std::forward(value)); } } @@ -1382,15 +1380,15 @@ auto collection_operation_expr(CollectionOperation operation) { CollectionOperation const& collectionOperation, R&& rhs, NSComparisonPredicateOptions options) { - convert_null(rhs, [&](auto&& rhs) { + convert_null(std::forward(rhs), [&](T&& rhs) { if (collectionOperation.link_column().is_link()) { - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), options); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), options); } else if (collectionOperation.column().property().dictionary) { - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), options); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), options); } else { - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), options); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), options); } }); } @@ -1420,8 +1418,8 @@ void get_collection_type(__unsafe_unretained RLMProperty *prop, Fn&& fn) { auto& column = collectionOperation.link_column(); RLMPropertyType type = column.type(); auto rhsValue = value_of_type(rhs); - auto continuation = [&](auto t) { - add_numeric_constraint(type, operatorType, column.resolve>().size(), rhsValue); + auto continuation = [&](T *) { + add_numeric_constraint(type, operatorType, column.resolve().size(), rhsValue); }; switch (type) { @@ -1453,16 +1451,16 @@ void get_collection_type(__unsafe_unretained RLMProperty *prop, Fn&& fn) { } } case CollectionOperation::Minimum: - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), comparisonOptions); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), comparisonOptions); break; case CollectionOperation::Maximum: - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), comparisonOptions); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), comparisonOptions); break; case CollectionOperation::Sum: - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), comparisonOptions); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), comparisonOptions); break; case CollectionOperation::Average: - add_collection_operation_constraint(operatorType, collectionOperation, std::move(rhs), comparisonOptions); + add_collection_operation_constraint(operatorType, collectionOperation, std::forward(rhs), comparisonOptions); break; case CollectionOperation::AllKeys: { // BETWEEN and IN are not supported by @allKeys as the parsing for collection diff --git a/Realm/RLMRealm.mm b/Realm/RLMRealm.mm index 059fa60bc9e..710e98408fe 100644 --- a/Realm/RLMRealm.mm +++ b/Realm/RLMRealm.mm @@ -215,18 +215,18 @@ bool copySeedFile(RLMRealmConfiguration *configuration, NSError **error) { if (!configuration.seedFilePath) { return false; } + NSError *copyError; + bool didCopySeed = false; @autoreleasepool { - bool didCopySeed = false; - NSError *copyError; DB::call_with_lock(configuration.path, [&](auto const&) { didCopySeed = [[NSFileManager defaultManager] copyItemAtURL:configuration.seedFilePath toURL:configuration.fileURL error:©Error]; }); - if (!didCopySeed && copyError != nil && copyError.code != NSFileWriteFileExistsError) { - RLMSetErrorOrThrow(copyError, error); - return true; - } + } + if (!didCopySeed && copyError && copyError.code != NSFileWriteFileExistsError) { + RLMSetErrorOrThrow(copyError, error); + return true; } return false; } diff --git a/Realm/RLMSyncConfiguration.h b/Realm/RLMSyncConfiguration.h index 54ea2ecfce7..c2f41ab3c0b 100644 --- a/Realm/RLMSyncConfiguration.h +++ b/Realm/RLMSyncConfiguration.h @@ -145,7 +145,7 @@ typedef void(^RLMClientResetAfterBlock)(RLMRealm * _Nonnull beforeFrozen, RLMRea Atlas App Services. All classes with a property with this value will be synchronized to the Realm. */ -@property (nonatomic, readonly) id partitionValue; +@property (nonatomic, readonly, nullable) id partitionValue; /** An enum which determines file recovery behavior in the event of a client reset. diff --git a/Realm/RLMSyncSubscription.mm b/Realm/RLMSyncSubscription.mm index a31c26bf010..4aedf2dc061 100644 --- a/Realm/RLMSyncSubscription.mm +++ b/Realm/RLMSyncSubscription.mm @@ -127,7 +127,9 @@ @interface RLMSyncSubscriptionEnumerator() { } @end -@implementation RLMSyncSubscriptionEnumerator +@implementation RLMSyncSubscriptionEnumerator { + RLMSyncSubscriptionSet *_subscriptionSet; +} - (instancetype)initWithSubscriptionSet:(RLMSyncSubscriptionSet *)subscriptionSet { if (self = [super init]) { diff --git a/Realm/RLMSyncSubscription_Private.h b/Realm/RLMSyncSubscription_Private.h index dc438a20e45..33e1651fccb 100644 --- a/Realm/RLMSyncSubscription_Private.h +++ b/Realm/RLMSyncSubscription_Private.h @@ -37,14 +37,10 @@ RLM_HEADER_AUDIT_BEGIN(nullability, sendability) #pragma mark - SubscriptionSet @interface RLMSyncSubscriptionEnumerator : NSObject - -@property (nonatomic, readonly) RLMSyncSubscriptionSet *subscriptionSet; - - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state count:(NSUInteger)len; - (instancetype)initWithSubscriptionSet:(RLMSyncSubscriptionSet *)subscriptionSet; - @end @interface RLMSyncSubscriptionSet () diff --git a/Realm/RLMUtil.mm b/Realm/RLMUtil.mm index d99e4029235..4ec397cb65e 100644 --- a/Realm/RLMUtil.mm +++ b/Realm/RLMUtil.mm @@ -412,10 +412,10 @@ BOOL RLMIsRunningInPlayground() { RLMAccessorContext c{objBase->_info ? *objBase->_info : realm->_info[objBase->_objectSchema.className]}; auto obj = c.unbox(v, createPolicy); return obj.is_valid() ? realm::Mixed(obj) : realm::Mixed(); - }, [&](auto t) { + }, [&](T *) { RLMStatelessAccessorContext c; - return realm::Mixed(c.unbox>(v)); - }, [&](realm::Mixed*) -> realm::Mixed { + return realm::Mixed(c.unbox(v)); + }, [](realm::Mixed*) -> realm::Mixed { REALM_UNREACHABLE(); }}); } diff --git a/Realm/Tests/AsyncTests.mm b/Realm/Tests/AsyncTests.mm index ed2c85751ac..46f46b6866b 100644 --- a/Realm/Tests/AsyncTests.mm +++ b/Realm/Tests/AsyncTests.mm @@ -437,6 +437,7 @@ - (void)testCancellationTokenKeepsSubscriptionAlive { }]; } [self waitForExpectationsWithTimeout:2.0 handler:nil]; + [token invalidate]; } - (void)testCancellationTokenPreventsOpeningRealmWithMismatchedConfig { diff --git a/Realm/Tests/MigrationTests.mm b/Realm/Tests/MigrationTests.mm index c4893f2c488..d56dec39576 100644 --- a/Realm/Tests/MigrationTests.mm +++ b/Realm/Tests/MigrationTests.mm @@ -1603,6 +1603,10 @@ - (void)testConvertToEmbeddedAddingMoreLinks { XCTAssertNotNil(oldObject); XCTAssertNotNil(newObject); RLMObject *childObject = newObject[@"object"]; + XCTAssertNotNil(childObject); + if (childObject == nil) { + return; + } [migration createObject:EmbeddedIntParentObject.className withValue:@[@43, childObject, NSNull.null]]; }]; }]; diff --git a/Realm/Tests/QueryTests.m b/Realm/Tests/QueryTests.m index e8fcacbdb83..029e9f05538 100644 --- a/Realm/Tests/QueryTests.m +++ b/Realm/Tests/QueryTests.m @@ -312,7 +312,7 @@ - (void)testPredicateMisuse // malformed keypath operators RLMAssertThrowsWithReason([PersonObject objectsWhere:@"@count == 0"], @"Invalid keypath '@count': collection operation '@count' must be applied to a collection"); - NSPredicate *pred = [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:@"name.@"] rightExpression:[NSExpression expressionForConstantValue:@0] modifier:0 type:NSEqualToPredicateOperatorType options:0]; + [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:@"name.@"] rightExpression:[NSExpression expressionForConstantValue:@0] modifier:0 type:NSEqualToPredicateOperatorType options:0]; RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@"children.@")], @"Unsupported collection operation '@'"); RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:predicateWithKeyPath(@"children@")], @@ -344,6 +344,7 @@ - (void)testPredicateMisuse RLMAssertThrowsWithReason([PersonObject objectsWhere:@"age BETWEEN {0, age}"], @"must be constant values"); RLMAssertThrowsWithReason([PersonObject objectsWhere:@"age BETWEEN {0, {1, 10}}"], @"must be constant values"); + NSPredicate *pred; pred = [NSPredicate predicateWithFormat:@"age BETWEEN %@", @[@1]]; RLMAssertThrowsWithReason([PersonObject objectsWithPredicate:pred], @"exactly two objects"); @@ -3120,7 +3121,7 @@ - (void)testCountOnArrayCollection { [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @2 ]]]; [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @3 ]]]; - arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @0, @[]]]; + [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @0, @[]]]; [realm commitWriteTransaction]; @@ -3159,7 +3160,7 @@ - (void)testCountOnSetCollection { [set.set addObject:[IntObject createInRealm:realm withValue:@[ @2 ]]]; [set.set addObject:[IntObject createInRealm:realm withValue:@[ @3 ]]]; - set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @0, @[]]]; + [IntegerSetPropertyObject createInRealm:realm withValue:@[ @0, @[]]]; [realm commitWriteTransaction]; @@ -3198,7 +3199,7 @@ - (void)testCountOnDictionaryCollection { idpo.dictionary[@"2"] = [IntObject createInRealm:realm withValue:@[ @2 ]]; idpo.dictionary[@"3"] = [IntObject createInRealm:realm withValue:@[ @3 ]]; - idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @0, @[]]]; + [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @0, @[]]]; [realm commitWriteTransaction]; @@ -3237,7 +3238,7 @@ - (void)testAggregateArrayCollectionOperators { arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @2222, @[] ]]; [arr.array addObject:[IntObject createInRealm:realm withValue:@[ @100 ]]]; - arr = [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]]; + [IntegerArrayPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]]; [realm commitWriteTransaction]; @@ -3306,7 +3307,7 @@ - (void)testAggregateSetCollectionOperators { set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @2222, @[] ]]; [set.set addObject:[IntObject createInRealm:realm withValue:@[ @100 ]]]; - set = [IntegerSetPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]]; + [IntegerSetPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]]; [realm commitWriteTransaction]; @@ -3375,7 +3376,7 @@ - (void)testAggregateDictionaryCollectionOperators { idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @2222, @[] ]]; idpo.dictionary[@"3"] = [IntObject createInRealm:realm withValue:@[ @100 ]]; - idpo = [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]]; + [IntegerDictionaryPropertyObject createInRealm:realm withValue:@[ @3333, @[] ]]; [realm commitWriteTransaction]; diff --git a/Realm/Tests/RealmTests.mm b/Realm/Tests/RealmTests.mm index 91fd596c74c..b6f617d3721 100644 --- a/Realm/Tests/RealmTests.mm +++ b/Realm/Tests/RealmTests.mm @@ -2842,20 +2842,20 @@ - (void)testAuxiliaryFilesAreExcludedFromBackupPerformance { RLMSetSkipBackupAttribute(true); [self measureBlock:^{ @autoreleasepool { - RLMRealm *realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; - realm = [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; + [RLMRealm defaultRealm]; } @autoreleasepool { [RLMRealm defaultRealm]; } }]; diff --git a/Realm/Tests/ResultsTests.m b/Realm/Tests/ResultsTests.m index 9955761869b..684ce7c3eaf 100644 --- a/Realm/Tests/ResultsTests.m +++ b/Realm/Tests/ResultsTests.m @@ -1088,7 +1088,7 @@ - (void)testResultsDependingOnLinkingObjects { XCTestExpectation *expectation = [self expectationWithDescription:@""]; RLMResults *results = [DogObject objectsWhere:@"ANY owners.name == 'James'"]; - id token = [results addNotificationBlock:^(__unused RLMResults *results, RLMCollectionChange *change, __unused NSError *error) { + RLMNotificationToken *token = [results addNotificationBlock:^(__unused RLMResults *results, RLMCollectionChange *change, __unused NSError *error) { if (change != nil) { [expectation fulfill]; } @@ -1108,7 +1108,7 @@ - (void)testResultsDependingOnLinkingObjects { XCTAssertEqualObjects(dog.dogName, [results.firstObject dogName]); [self waitForExpectationsWithTimeout:1.0 handler:nil]; - token = nil; + [token invalidate]; } - (void)testDistinctQuery { diff --git a/Realm/Tests/SetPropertyTests.m b/Realm/Tests/SetPropertyTests.m index dcdfc6eb763..a4f19b8bab5 100644 --- a/Realm/Tests/SetPropertyTests.m +++ b/Realm/Tests/SetPropertyTests.m @@ -271,7 +271,7 @@ - (void)testPopulateEmptySet { XCTAssertEqualObjects(results[0].intSet, setObj1.intSet); RLMSet *setProp = setObj1.set; - RLMAssertThrowsWithReasonMatching([setProp addObject:@"another one"], @"write transaction"); + RLMAssertThrowsWithReasonMatching([setProp addObject:(id)@"another one"], @"write transaction"); // make sure we can fast enumerate for (RLMObject *obj in setObj1.set) {