Added lightweight generic annotations

Summary: public

Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.

Fixed some type bugs and improved bridge validation in a few places.

Reviewed By: javache

Differential Revision: D2600189

fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
This commit is contained in:
Nick Lockwood
2015-11-03 14:45:46 -08:00
committed by facebook-github-bot-7
parent 31565781f2
commit c5b990f65f
78 changed files with 497 additions and 422 deletions

View File

@@ -47,7 +47,7 @@ RCT_EXPORT_MODULE()
- (BOOL)canHandleRequest:(NSURLRequest *)request
{
static NSSet *schemes = nil;
static NSSet<NSString *> *schemes = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// technically, RCTHTTPRequestHandler can handle file:// as well,

View File

@@ -37,7 +37,7 @@ typedef RCTURLRequestCancellationBlock (^RCTHTTPQueryResult)(NSError *error, NSD
@implementation RCTHTTPFormDataHelper
{
NSMutableArray *_parts;
NSMutableArray<NSDictionary *> *_parts;
NSMutableData *_multipartBody;
RCTHTTPQueryResult _callback;
NSString *_boundary;
@@ -122,7 +122,7 @@ static NSString *RCTGenerateFormBoundary()
@implementation RCTNetworking
{
NSMutableDictionary *_tasksByRequestID;
NSArray *_handlers;
NSArray<id<RCTURLRequestHandler>> *_handlers;
}
@synthesize bridge = _bridge;
@@ -133,10 +133,10 @@ RCT_EXPORT_MODULE()
- (void)setBridge:(RCTBridge *)bridge
{
// get handlers
NSMutableArray *handlers = [NSMutableArray array];
NSMutableArray<id<RCTURLRequestHandler>> *handlers = [NSMutableArray array];
for (id<RCTBridgeModule> module in bridge.modules.allValues) {
if ([module conformsToProtocol:@protocol(RCTURLRequestHandler)]) {
[handlers addObject:module];
[handlers addObject:(id<RCTURLRequestHandler>)module];
}
}