Skip to content
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

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

jpd236
Copy link
Collaborator

@jpd236 jpd236 commented Apr 11, 2018

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

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
@jpd236 jpd236 requested a review from jjoslin April 11, 2018 01:06
}
});
mainThread.post(
new Runnable() {
Copy link
Collaborator

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?

Copy link
Collaborator Author

@jpd236 jpd236 Apr 11, 2018

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,
Copy link
Collaborator

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.

Copy link
Collaborator Author

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
Copy link
Collaborator

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.

Copy link
Collaborator Author

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;
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed

@jpd236
Copy link
Collaborator Author

jpd236 commented Apr 11, 2018

Filed #166 to investigate what we can do for each of your comments. Thanks!

@jpd236 jpd236 merged commit bdc8055 into google:master Apr 11, 2018
@jpd236 jpd236 deleted the google-java-format branch April 11, 2018 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants