Skip to content

Commit 7c89d92

Browse files
mbouazizfacebook-github-bot
authored andcommitted
[RFC] Format all java files
Reviewed By: jeremydubreil Differential Revision: D10067033 fbshipit-source-id: 73975664e
1 parent d4f943e commit 7c89d92

File tree

342 files changed

+4113
-4823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+4113
-4823
lines changed

examples/android_hello/app/src/androidTest/java/infer/inferandroidexample/ApplicationTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
import android.app.Application;
1111
import android.test.ApplicationTestCase;
1212

13-
/**
14-
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
15-
*/
13+
/** <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */
1614
public class ApplicationTest extends ApplicationTestCase<Application> {
17-
public ApplicationTest() {
18-
super(Application.class);
19-
}
15+
public ApplicationTest() {
16+
super(Application.class);
17+
}
2018
}

examples/android_hello/app/src/main/java/infer/inferandroidexample/Generated.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ public class Generated {
1414
static Object returnsNull() {
1515
return null;
1616
}
17-
1817
}

examples/android_hello/app/src/main/java/infer/inferandroidexample/MainActivity.java

Lines changed: 46 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,79 +7,76 @@
77

88
package infer.inferandroidexample;
99

10-
import android.support.v7.app.ActionBarActivity;
1110
import android.os.Bundle;
11+
import android.support.v7.app.ActionBarActivity;
1212
import android.view.Menu;
1313
import android.view.MenuItem;
14-
1514
import java.io.FileOutputStream;
1615
import java.io.IOException;
1716
import java.util.Calendar;
1817

19-
2018
public class MainActivity extends ActionBarActivity {
2119

22-
@Override
23-
protected void onCreate(Bundle savedInstanceState) {
24-
super.onCreate(savedInstanceState);
25-
setContentView(R.layout.activity_main);
26-
String s = getDay();
27-
int length = s.length();
28-
writeToFile();
29-
}
30-
31-
private String getDay() {
32-
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
33-
return "Wednesday";
34-
} else {
35-
return otherOutput();
36-
}
37-
}
20+
@Override
21+
protected void onCreate(Bundle savedInstanceState) {
22+
super.onCreate(savedInstanceState);
23+
setContentView(R.layout.activity_main);
24+
String s = getDay();
25+
int length = s.length();
26+
writeToFile();
27+
}
3828

39-
private String otherOutput() {
40-
return null;
29+
private String getDay() {
30+
if (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
31+
return "Wednesday";
32+
} else {
33+
return otherOutput();
4134
}
35+
}
4236

43-
private void writeToFile() {
44-
byte[] arr = {1, 2, 3};
45-
FileOutputStream fis;
46-
try {
47-
fis = new FileOutputStream("file.txt");
48-
fis.write(arr);
49-
fis.close();
50-
} catch (IOException e) {
51-
//Deal with exception
52-
}
53-
}
37+
private String otherOutput() {
38+
return null;
39+
}
5440

55-
@Override
56-
public boolean onCreateOptionsMenu(Menu menu) {
57-
// Inflate the menu; this adds items to the action bar if it is present.
58-
getMenuInflater().inflate(R.menu.menu_main, menu);
59-
return true;
41+
private void writeToFile() {
42+
byte[] arr = {1, 2, 3};
43+
FileOutputStream fis;
44+
try {
45+
fis = new FileOutputStream("file.txt");
46+
fis.write(arr);
47+
fis.close();
48+
} catch (IOException e) {
49+
// Deal with exception
6050
}
51+
}
6152

62-
@Override
63-
public boolean onOptionsItemSelected(MenuItem item) {
64-
// Handle action bar item clicks here. The action bar will
65-
// automatically handle clicks on the Home/Up button, so long
66-
// as you specify a parent activity in AndroidManifest.xml.
67-
int id = item.getItemId();
53+
@Override
54+
public boolean onCreateOptionsMenu(Menu menu) {
55+
// Inflate the menu; this adds items to the action bar if it is present.
56+
getMenuInflater().inflate(R.menu.menu_main, menu);
57+
return true;
58+
}
6859

69-
//noinspection SimplifiableIfStatement
70-
if (id == R.id.action_settings) {
71-
return true;
72-
}
60+
@Override
61+
public boolean onOptionsItemSelected(MenuItem item) {
62+
// Handle action bar item clicks here. The action bar will
63+
// automatically handle clicks on the Home/Up button, so long
64+
// as you specify a parent activity in AndroidManifest.xml.
65+
int id = item.getItemId();
7366

74-
return super.onOptionsItemSelected(item);
67+
//noinspection SimplifiableIfStatement
68+
if (id == R.id.action_settings) {
69+
return true;
7570
}
7671

72+
return super.onOptionsItemSelected(item);
73+
}
74+
7775
private void inferShouldNotReport() {
7876
// Generated.java is supposed to be skipped by infer, thus even though
7977
// Generated.returnsNull() returns null, infer is not supposed to know
8078
// about it hence should not report an NPE here
8179
Object o = Generated.returnsNull();
8280
o.toString();
8381
}
84-
8582
}

examples/android_hello/app/src/main/java/infer/other/MainActivity.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
package infer.other;
99

1010
import android.annotation.SuppressLint;
11-
import android.support.v7.app.ActionBarActivity;
1211
import android.os.Bundle;
12+
import android.support.v7.app.ActionBarActivity;
1313

1414
public class MainActivity extends ActionBarActivity {
1515

@@ -26,5 +26,4 @@ protected void onCreate(Bundle savedInstanceState) {
2626
void shouldNotBeReported() {
2727
source().toString();
2828
}
29-
3029
}

examples/java_hello/Hello.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ void mayLeakResource() throws IOException {
4242
}
4343

4444
/**
45-
* This method should be rewritten with nested try { ... } finally {
46-
* ... } statements, or the possible exception raised by fis.close()
47-
* should be swallowed.
45+
* This method should be rewritten with nested try { ... } finally { ... } statements, or the
46+
* possible exception raised by fis.close() should be swallowed.
4847
*/
4948
void twoResources() throws IOException {
5049
FileInputStream fis = null;
@@ -54,9 +53,12 @@ void twoResources() throws IOException {
5453
fos = new FileOutputStream(new File("everwhat.txt"));
5554
fos.write(fis.read());
5655
} finally {
57-
if (fis != null) { fis.close(); }
58-
if (fos != null) { fos.close(); }
56+
if (fis != null) {
57+
fis.close();
58+
}
59+
if (fos != null) {
60+
fos.close();
61+
}
5962
}
6063
}
61-
6264
}

examples/java_hello/Pointers.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
public class Pointers {
1111

1212
public static class A {
13-
public void method() {
14-
}
13+
public void method() {}
1514
}
1615

1716
public static A mayReturnNull(int i) {
@@ -20,5 +19,4 @@ public static A mayReturnNull(int i) {
2019
}
2120
return null;
2221
}
23-
2422
}

examples/java_hello/Resources.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@ public static FileOutputStream allocateResource() {
2121
return null;
2222
}
2323
}
24-
2524
}

infer/annotations/src/main/java/com/facebook/infer/annotation/Assertions.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
package com.facebook.infer.annotation;
99

10-
import javax.annotation.Nullable;
1110
import java.util.List;
1211
import java.util.Map;
12+
import javax.annotation.Nullable;
1313

1414
public class Assertions {
1515

@@ -53,11 +53,9 @@ public static <K, V> V getAssertingNotNull(Map<K, V> map, K key) {
5353
return assertNotNull(map.get(key));
5454
}
5555

56-
public static void assumeCondition(boolean condition) {
57-
}
56+
public static void assumeCondition(boolean condition) {}
5857

59-
public static void assumeCondition(boolean condition, String explanation) {
60-
}
58+
public static void assumeCondition(boolean condition, String explanation) {}
6159

6260
public static void assertCondition(boolean condition) {
6361
if (!condition) {

infer/annotations/src/main/java/com/facebook/infer/annotation/Expensive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
import java.lang.annotation.Target;
1414

1515
@Retention(RetentionPolicy.CLASS)
16-
@Target({ ElementType.METHOD, ElementType.TYPE })
16+
@Target({ElementType.METHOD, ElementType.TYPE})
1717
public @interface Expensive {}

infer/annotations/src/main/java/com/facebook/infer/annotation/FalseOnNull.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
import java.lang.annotation.RetentionPolicy;
1313
import java.lang.annotation.Target;
1414

15-
/**
16-
* Annotation for a boolean function returning false when the argument is null.
17-
*/
15+
/** Annotation for a boolean function returning false when the argument is null. */
1816
@Retention(RetentionPolicy.CLASS)
1917
@Target({ElementType.METHOD})
2018
public @interface FalseOnNull {}

0 commit comments

Comments
 (0)