-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply google-java-format to all code. #165
Conversation
Also adds Gradle commands to format the code and verify formatting on all files in the tree. CONTRIBUTING.md has been updated with the steps to format + verify changes, and the format verification has been added to the continuous integration setup (but if it fails, the rest of the build will still be attempted to minimize churn). Fixes google#99
} | ||
}); | ||
mainThread.post( | ||
new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the stance on lambdas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant to use them right now just because of how many places Volley code is exported compiled. It might work - we'd need recent Gradle plugins which can desugar the Lambdas, and that desugar library would need to work on minSdkVersion 8+. (Or, we'd need to bump Volley's minSdkVersion). I'll try it and see if it's feasible.
SystemClock.elapsedRealtime() - requestStart, responseHeaders); | ||
return new NetworkResponse( | ||
HttpURLConnection.HTTP_NOT_MODIFIED, | ||
null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to also require inline comments for params like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, but I'm not sure if there's an easy way to enforce it, though we could do a one-off cleanup at least.
@@ -505,7 +510,7 @@ public int read(byte[] buffer, int offset, int count) throws IOException { | |||
return result; | |||
} | |||
|
|||
//VisibleForTesting | |||
// VisibleForTesting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should come back and replace these with the annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to do this, but that would require a new dependency. That being said, android-support-annotations is probably reasonably well enough isolated from the rest of the support library that it could be reasonable, especially if the dependency didn't propagate to clients (e.g. compile time but not runtime).
@@ -1,11 +1,20 @@ | |||
package com.android.volley.toolbox; | |||
|
|||
import android.util.Pair; | |||
import static org.junit.Assert.assertEquals; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some inconsistency (not from this change) with whether to not to use wildcards. I vote for removing the wildcards in favor of explicit imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
Filed #166 to investigate what we can do for each of your comments. Thanks! |
Also adds Gradle commands to format the code and verify formatting on
all files in the tree. CONTRIBUTING.md has been updated with the
steps to format + verify changes, and the format verification has
been added to the continuous integration setup (but if it fails, the
rest of the build will still be attempted to minimize churn).
Fixes #99