Format everything

Reviewed By: jeremydubreil

Differential Revision: D10844347

fbshipit-source-id: 5a374da82
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent ecedb27d77
commit ce34dcb695

@ -7,7 +7,6 @@
package android.app; package android.app;
public abstract class AlarmManager { public abstract class AlarmManager {
void cancel(PendingIntent operation) { void cancel(PendingIntent operation) {

@ -7,7 +7,6 @@
package android.database; package android.database;
import java.io.IOException; import java.io.IOException;
public class CursorWrapper implements Cursor { public class CursorWrapper implements Cursor {

@ -7,7 +7,6 @@
package java.util; package java.util;
// abstract so we don't have to implement every method of List // abstract so we don't have to implement every method of List
public abstract class ArrayList<T> extends AbstractList<T> { public abstract class ArrayList<T> extends AbstractList<T> {

@ -7,7 +7,6 @@
package java.util; package java.util;
// abstract so we don't have to implement every method of List // abstract so we don't have to implement every method of List
public abstract class List<T> extends AbstractList<T> { public abstract class List<T> extends AbstractList<T> {

@ -7,7 +7,6 @@
package org.assertj.core.util; package org.assertj.core.util;
import static com.facebook.infer.builtins.InferBuiltins.assume; import static com.facebook.infer.builtins.InferBuiltins.assume;
public final class Preconditions { public final class Preconditions {

@ -19,12 +19,11 @@
return [NSRunLoop alloc]; return [NSRunLoop alloc];
}; };
- (void)acceptInputForMode:(NSString*)mode beforeDate:(NSDate*)limit_date{}; - (void)acceptInputForMode:(NSString*)mode beforeDate:(NSDate*)limit_date {
};
- (void)addTimer:(NSTimer*)timer
forMode:(NSString*)mode{
}; - (void)addTimer:(NSTimer*)timer forMode:(NSString*)mode {
};
- (NSString*)currentMode { - (NSString*)currentMode {
return @""; return @"";
@ -35,7 +34,8 @@
return [NSDate alloc]; return [NSDate alloc];
}; };
- (void)run{}; - (void)run {
};
- (BOOL)runMode:(NSString*)mode beforeDate:(NSDate*)date { - (BOOL)runMode:(NSString*)mode beforeDate:(NSDate*)date {
@ -43,6 +43,7 @@
return res; return res;
}; };
- (void)runUntilDate:(NSDate*)date{}; - (void)runUntilDate:(NSDate*)date {
};
@end @end

@ -10,7 +10,7 @@
@interface SomeClass : CKCompositeComponent @interface SomeClass : CKCompositeComponent
@end @end
@implementation SomeClass @implementation SomeClass
+ (instancetype) new { + (instancetype)new {
if (1 == 3) { if (1 == 3) {
return nil; return nil;
} else if (2 == 4) { } else if (2 == 4) {

@ -16,7 +16,7 @@ struct D {};
@interface SomeClass : CKCompositeComponent @interface SomeClass : CKCompositeComponent
@end @end
@implementation SomeClass @implementation SomeClass
+ (instancetype) new { + (instancetype)new {
int i; // error int i; // error
for (int i = 0; i < 10; i++) { // no error for (int i = 0; i < 10; i++) { // no error

@ -9,7 +9,7 @@
@interface SomeClass : CKCompositeComponent @interface SomeClass : CKCompositeComponent
@end @end
@implementation SomeClass @implementation SomeClass
+ (instancetype) new { + (instancetype)new {
int i; // error int i; // error
return nil; return nil;
} }

@ -7,7 +7,6 @@
package codetoanalyze.java.infer; package codetoanalyze.java.infer;
public class IntegerExample { public class IntegerExample {
private static void testIntegerEqualsGood() { private static void testIntegerEqualsGood() {

@ -115,8 +115,8 @@ class RaceWithMainThread {
void conditional1_Ok(boolean b) { void conditional1_Ok(boolean b) {
if (b) { if (b) {
/*People not literally putting this assert inside if's, /*People not literally putting this assert inside if's,
but implicitly by method calls */ but implicitly by method calls */
OurThreadUtils.assertMainThread(); OurThreadUtils.assertMainThread();
ff = 88; ff = 88;
} }

@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree. * LICENSE file in the root directory of this source tree.
*/ */
class InnerClass { class InnerClass {
synchronized void outerInnerOk(InnerClassA a) { synchronized void outerInnerOk(InnerClassA a) {
a.foo(); a.foo();

@ -20,8 +20,8 @@ codetoanalyze/java/starvation/FutureGet.java, FutureGet.getTimeoutOneDayBad():vo
codetoanalyze/java/starvation/FutureGet.java, FutureGet.getTimeoutOneHourBad():void, 59, STARVATION, no_bucket, ERROR, [`void FutureGet.getTimeoutOneHourBad()`,calls `Object Future.get(long,TimeUnit)` from `void FutureGet.getTimeoutOneHourBad()`,[Trace on UI thread] `void FutureGet.getTimeoutOneHourBad()`,`void FutureGet.getTimeoutOneHourBad()` is annotated `UiThread`] codetoanalyze/java/starvation/FutureGet.java, FutureGet.getTimeoutOneHourBad():void, 59, STARVATION, no_bucket, ERROR, [`void FutureGet.getTimeoutOneHourBad()`,calls `Object Future.get(long,TimeUnit)` from `void FutureGet.getTimeoutOneHourBad()`,[Trace on UI thread] `void FutureGet.getTimeoutOneHourBad()`,`void FutureGet.getTimeoutOneHourBad()` is annotated `UiThread`]
codetoanalyze/java/starvation/IndirectBlock.java, IndirectBlock.takeExpensiveLockOnUiThreadBad():void, 23, STARVATION, no_bucket, ERROR, [[Trace 1] `void IndirectBlock.takeExpensiveLockOnUiThreadBad()`,locks `this.IndirectBlock.expensiveLock` in class `IndirectBlock*`,[Trace 2] `void IndirectBlock.doTransactUnderLock()`,locks `this.IndirectBlock.expensiveLock` in class `IndirectBlock*`,calls `boolean Binder.transact(int,Parcel,Parcel,int)` from `void IndirectBlock.doTransactUnderLock()`,[Trace 1 on UI thread] `void IndirectBlock.takeExpensiveLockOnUiThreadBad()`,`void IndirectBlock.takeExpensiveLockOnUiThreadBad()` is annotated `UiThread`] codetoanalyze/java/starvation/IndirectBlock.java, IndirectBlock.takeExpensiveLockOnUiThreadBad():void, 23, STARVATION, no_bucket, ERROR, [[Trace 1] `void IndirectBlock.takeExpensiveLockOnUiThreadBad()`,locks `this.IndirectBlock.expensiveLock` in class `IndirectBlock*`,[Trace 2] `void IndirectBlock.doTransactUnderLock()`,locks `this.IndirectBlock.expensiveLock` in class `IndirectBlock*`,calls `boolean Binder.transact(int,Parcel,Parcel,int)` from `void IndirectBlock.doTransactUnderLock()`,[Trace 1 on UI thread] `void IndirectBlock.takeExpensiveLockOnUiThreadBad()`,`void IndirectBlock.takeExpensiveLockOnUiThreadBad()` is annotated `UiThread`]
codetoanalyze/java/starvation/IndirectBlock.java, IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc):void, 35, STARVATION, no_bucket, ERROR, [[Trace 1] `void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)`,Method call: `void IndirectInterproc.takeLock()`,locks `this` in class `IndirectInterproc*`,[Trace 2] `void IndirectInterproc.doTransactUnderLock(Binder)`,locks `this` in class `IndirectInterproc*`,calls `boolean Binder.transact(int,Parcel,Parcel,int)` from `void IndirectInterproc.doTransactUnderLock(Binder)`,[Trace 1 on UI thread] `void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)`,`void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)` is annotated `UiThread`] codetoanalyze/java/starvation/IndirectBlock.java, IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc):void, 35, STARVATION, no_bucket, ERROR, [[Trace 1] `void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)`,Method call: `void IndirectInterproc.takeLock()`,locks `this` in class `IndirectInterproc*`,[Trace 2] `void IndirectInterproc.doTransactUnderLock(Binder)`,locks `this` in class `IndirectInterproc*`,calls `boolean Binder.transact(int,Parcel,Parcel,int)` from `void IndirectInterproc.doTransactUnderLock(Binder)`,[Trace 1 on UI thread] `void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)`,`void IndirectBlock.takeRemoteExpensiveLockOnUiThreadBad(IndirectInterproc)` is annotated `UiThread`]
codetoanalyze/java/starvation/InnerClass.java, InnerClass$InnerClassA.<init>(InnerClass,java.lang.Object), 48, DEADLOCK, no_bucket, ERROR, [[Trace 1] `InnerClass$InnerClassA.<init>(InnerClass,Object)`,locks `this` in class `InnerClass$InnerClassA*`,Method call: `void InnerClass.bar()`,locks `this` in class `InnerClass*`,[Trace 2] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`,locks `this` in class `InnerClass*`,Method call: `void InnerClass$InnerClassA.baz()`,locks `this` in class `InnerClass$InnerClassA*`] codetoanalyze/java/starvation/InnerClass.java, InnerClass$InnerClassA.<init>(InnerClass,java.lang.Object), 47, DEADLOCK, no_bucket, ERROR, [[Trace 1] `InnerClass$InnerClassA.<init>(InnerClass,Object)`,locks `this` in class `InnerClass$InnerClassA*`,Method call: `void InnerClass.bar()`,locks `this` in class `InnerClass*`,[Trace 2] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`,locks `this` in class `InnerClass*`,Method call: `void InnerClass$InnerClassA.baz()`,locks `this` in class `InnerClass$InnerClassA*`]
codetoanalyze/java/starvation/InnerClass.java, InnerClass$InnerClassA.innerOuterBad():void, 34, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void InnerClass$InnerClassA.innerOuterBad()`,locks `this` in class `InnerClass$InnerClassA*`,Method call: `void InnerClass.bar()`,locks `this` in class `InnerClass*`,[Trace 2] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`,locks `this` in class `InnerClass*`,Method call: `void InnerClass$InnerClassA.baz()`,locks `this` in class `InnerClass$InnerClassA*`] codetoanalyze/java/starvation/InnerClass.java, InnerClass$InnerClassA.innerOuterBad():void, 33, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void InnerClass$InnerClassA.innerOuterBad()`,locks `this` in class `InnerClass$InnerClassA*`,Method call: `void InnerClass.bar()`,locks `this` in class `InnerClass*`,[Trace 2] `void InnerClass.outerInnerBad(InnerClass$InnerClassA)`,locks `this` in class `InnerClass*`,Method call: `void InnerClass$InnerClassA.baz()`,locks `this` in class `InnerClass$InnerClassA*`]
codetoanalyze/java/starvation/Interclass.java, Interclass.interclass1Bad(InterclassA):void, 10, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Interclass.interclass1Bad(InterclassA)`,locks `this` in class `Interclass*`,Method call: `void InterclassA.interclass1Bad()`,locks `this` in class `InterclassA*`,[Trace 2] `void InterclassA.interclass2Bad(Interclass)`,locks `this` in class `InterclassA*`,Method call: `void Interclass.interclass2Bad()`,locks `this` in class `Interclass*`] codetoanalyze/java/starvation/Interclass.java, Interclass.interclass1Bad(InterclassA):void, 10, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Interclass.interclass1Bad(InterclassA)`,locks `this` in class `Interclass*`,Method call: `void InterclassA.interclass1Bad()`,locks `this` in class `InterclassA*`,[Trace 2] `void InterclassA.interclass2Bad(Interclass)`,locks `this` in class `InterclassA*`,Method call: `void Interclass.interclass2Bad()`,locks `this` in class `Interclass*`]
codetoanalyze/java/starvation/Interproc.java, Interproc.interproc1Bad(InterprocA):void, 9, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Interproc.interproc1Bad(InterprocA)`,locks `this` in class `Interproc*`,Method call: `void Interproc.interproc2Bad(InterprocA)`,locks `b` in class `InterprocA*`,[Trace 2] `void InterprocA.interproc1Bad(Interproc)`,locks `this` in class `InterprocA*`,Method call: `void InterprocA.interproc2Bad(Interproc)`,locks `d` in class `Interproc*`] codetoanalyze/java/starvation/Interproc.java, Interproc.interproc1Bad(InterprocA):void, 9, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Interproc.interproc1Bad(InterprocA)`,locks `this` in class `Interproc*`,Method call: `void Interproc.interproc2Bad(InterprocA)`,locks `b` in class `InterprocA*`,[Trace 2] `void InterprocA.interproc1Bad(Interproc)`,locks `this` in class `InterprocA*`,Method call: `void InterprocA.interproc2Bad(Interproc)`,locks `d` in class `Interproc*`]
codetoanalyze/java/starvation/Intraproc.java, Intraproc.intraBad(IntraprocA):void, 10, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Intraproc.intraBad(IntraprocA)`,locks `this` in class `Intraproc*`,locks `o` in class `IntraprocA*`,[Trace 2] `void IntraprocA.intraBad(Intraproc)`,locks `this` in class `IntraprocA*`,locks `o` in class `Intraproc*`] codetoanalyze/java/starvation/Intraproc.java, Intraproc.intraBad(IntraprocA):void, 10, DEADLOCK, no_bucket, ERROR, [[Trace 1] `void Intraproc.intraBad(IntraprocA)`,locks `this` in class `Intraproc*`,locks `o` in class `IntraprocA*`,[Trace 2] `void IntraprocA.intraBad(Intraproc)`,locks `this` in class `IntraprocA*`,locks `o` in class `Intraproc*`]

@ -18,8 +18,8 @@
@implementation CADisplay @implementation CADisplay
- (instancetype)init { - (instancetype)init {
_displayLink = _displayLink = [CADisplayLink displayLinkWithTarget:self
[CADisplayLink displayLinkWithTarget:self selector:@selector(bla)]; selector:@selector(bla)];
return self; return self;
} }
@ -31,7 +31,8 @@
selector:@selector(handleDisplayLink:)]; selector:@selector(handleDisplayLink:)];
} }
- (void)bla{}; - (void)bla {
};
- (void)invalidate { - (void)invalidate {
// unregister displayLink target // unregister displayLink target

@ -31,8 +31,9 @@
"file.txt", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); "file.txt", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fileDescriptor == -1) { if (fileDescriptor == -1) {
if (error) if (error)
*error = *error = [NSError errorWithDomain:NSPOSIXErrorDomain
[NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:nil]; code:errno
userInfo:nil];
return nil; return nil;
} else { } else {
if (self) if (self)

@ -26,10 +26,9 @@ BOOL ExampleSanitizer(NSURL* u, int f) {
return self; return self;
} }
- (void)loadURL:(NSURL*)URL - (void)loadURL:(NSURL*)URL trackingCodes:(NSArray*)trackingCodes {
trackingCodes:(NSArray*)trackingCodes{ // Require untainted URL
// Require untainted URL };
};
@end @end
@interface VCB : NSObject @interface VCB : NSObject

@ -20,5 +20,5 @@ NSDictionary* get_array1() {
NSDictionary* get_array2() { NSDictionary* get_array2() {
return @{ @"firstName" : @"Matt", @"lastName" : @"Galloway", @"age" : @28 }; return @{@"firstName" : @"Matt", @"lastName" : @"Galloway", @"age" : @28};
} }

@ -124,9 +124,8 @@
NSDictionary* destinationPixelBufferAttributes; NSDictionary* destinationPixelBufferAttributes;
if (kCFCoreFoundationVersionNumber >= if (kCFCoreFoundationVersionNumber >=
kCFCoreFoundationVersionNumber_iOS_9_0) { kCFCoreFoundationVersionNumber_iOS_9_0) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }
@ -134,16 +133,15 @@
- (void)m2 { - (void)m2 {
NSDictionary* destinationPixelBufferAttributes; NSDictionary* destinationPixelBufferAttributes;
destinationPixelBufferAttributes = destinationPixelBufferAttributes =
@{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES }; @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
} }
// bug // bug
- (void)m3:(BOOL)ok { - (void)m3:(BOOL)ok {
NSDictionary* destinationPixelBufferAttributes; NSDictionary* destinationPixelBufferAttributes;
if (ok) { if (ok) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }
@ -153,9 +151,8 @@
if (kCFCoreFoundationVersionNumber >= if (kCFCoreFoundationVersionNumber >=
kCFCoreFoundationVersionNumber_iOS_9_0 && kCFCoreFoundationVersionNumber_iOS_9_0 &&
ok) { ok) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }
@ -166,9 +163,8 @@
kCFCoreFoundationVersionNumber_iOS_9_0 && kCFCoreFoundationVersionNumber_iOS_9_0 &&
kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber >=
kCFCoreFoundationVersionNumber_iOS_7_0) { kCFCoreFoundationVersionNumber_iOS_7_0) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }
@ -176,9 +172,8 @@
- (void)m6 { - (void)m6 {
NSDictionary* destinationPixelBufferAttributes; NSDictionary* destinationPixelBufferAttributes;
if (AT_LEAST_IOS9) { if (AT_LEAST_IOS9) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }
@ -186,9 +181,8 @@
- (void)m7 { - (void)m7 {
NSDictionary* destinationPixelBufferAttributes; NSDictionary* destinationPixelBufferAttributes;
if (CK_AT_LEAST_IOS9) { if (CK_AT_LEAST_IOS9) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }
@ -196,9 +190,8 @@
- (void)m8 { - (void)m8 {
NSDictionary* destinationPixelBufferAttributes; NSDictionary* destinationPixelBufferAttributes;
if (AT_LEAST_IOS10) { if (AT_LEAST_IOS10) {
destinationPixelBufferAttributes = @{ destinationPixelBufferAttributes =
(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES @{(NSString*)kCVPixelBufferOpenGLESTextureCacheCompatibilityKey : @YES};
};
} }
} }

@ -15,7 +15,8 @@
@implementation B @implementation B
- (void)foo{}; - (void)foo {
};
@end @end

@ -94,7 +94,7 @@ int good4(NSNumber* number, Simple* simple) {
} }
int bad5(NSNumber* number, Simple* simple) { int bad5(NSNumber* number, Simple* simple) {
if ([simple fooWithCondition:(number ? 1 : 2)andNumber:number] != nil) { if ([simple fooWithCondition:(number ? 1 : 2) andNumber:number] != nil) {
return 0; return 0;
} }
return 1; return 1;
@ -108,8 +108,8 @@ int bad6(NSNumber* number, Simple* simple) {
} }
int good5(NSNumber* number, Simple* simple) { int good5(NSNumber* number, Simple* simple) {
if ([simple fooWithCondition:(number == nil ? 1 : 2) andNumber:number] != if ([simple fooWithCondition:(number == nil ? 1 : 2)
nil) { andNumber:number] != nil) {
return 0; return 0;
} }
return 1; return 1;

@ -40,7 +40,7 @@ CTFontRef cfautorelease_test() {
} }
void bridgeDictionaryNoLeak() { void bridgeDictionaryNoLeak() {
NSDictionary* bufferAttributes = @{(NSString*)@"key" : @{} }; NSDictionary* bufferAttributes = @{(NSString*)@"key" : @{}};
CFDictionaryRef dict = (__bridge CFDictionaryRef)bufferAttributes; CFDictionaryRef dict = (__bridge CFDictionaryRef)bufferAttributes;
} }

@ -40,14 +40,14 @@
// OK - unavailable initializers shouldn't count // OK - unavailable initializers shouldn't count
@interface UnavailableInitializer1 : CKCompositeComponent @interface UnavailableInitializer1 : CKCompositeComponent
+ (instancetype) new // shouldn't count since it's unavailable + (instancetype)new // shouldn't count since it's unavailable
__attribute__((unavailable("Must use designated initializer"))); __attribute__((unavailable("Must use designated initializer")));
+ (instancetype)newWithObject:(NSObject*)obj; + (instancetype)newWithObject:(NSObject*)obj;
@end @end
// Not OK - there are 2 static initialzers, even w/out the unavailable one // Not OK - there are 2 static initialzers, even w/out the unavailable one
@interface UnavailableInitializer2 : CKCompositeComponent @interface UnavailableInitializer2 : CKCompositeComponent
+ (instancetype) new // shouldn't count since it's unavailable + (instancetype)new // shouldn't count since it's unavailable
__attribute__((unavailable("Must use designated initializer"))); __attribute__((unavailable("Must use designated initializer")));
+ (instancetype)newWithObject1:(NSObject*)obj; + (instancetype)newWithObject1:(NSObject*)obj;
+ (instancetype)newWithObject2:(NSObject*)obj; + (instancetype)newWithObject2:(NSObject*)obj;

@ -83,7 +83,7 @@ class BarClass {
@interface BarComponent : CKCompositeComponent @interface BarComponent : CKCompositeComponent
@end @end
@implementation BarComponent @implementation BarComponent
+ (instancetype) new { + (instancetype)new {
// C++ classes // C++ classes
BarClass s1; // error BarClass s1; // error
const BarClass& s2 = s1; // no error const BarClass& s2 = s1; // no error

Loading…
Cancel
Save