-
Notifications
You must be signed in to change notification settings - Fork 455
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
Extend FileSignature to be sensitive to file order and duplicates. #85
Conversation
@jbduncan Please have another look.
Sorry that I bothered you with my first PR. I had a better look now at all the callers this time. Let me know whether you think I still missed some of the intentions of the original code. |
Please, no worries! I realise that I overwhelmed you with feedback, so need to feel sorry. :)
Yeah, we're pretty inconsistent with how we deal with nullable and non-null stuff in Spotless. :P I'm happy that we skip nulls in this PR - I'll raise an issue later to make NPEs be thrown eagerly (my preferred method) more consistently. All the other modifications you've made to my original proposal look very reasonable to me, except for,
Once those 2 minor things are fixed, I'm happy to merge this. :) |
OK, sorry, just saw why ArrayList makes more sense here. |
As you discovered, it's because If the sizing of the list really bothers you, consider changing /** Returns a shallow copy of input elements omitting null elements */
private static <T> List<T> asNonNullList(Iterable<T> input) {
List<T> shallowCopy =
(input instanceof Collection)
? new ArrayList<>(((Collection) input).size())
: new ArrayList<>();
. . .
return shallowCopy;
} |
Actually, I was not thinking about the RandomAccess, which we should not have. |
Please put the |
About the @SuppressWarnings("unused"): |
Hmm, interesting. I'm not sure why moving the calculations from But yes, please keep the |
Maybe I should have mentioned that with the code change Eclipse now complains when I reinsert the @SuppressWarnings. Just installing IntelliJ IDEA, since I always wanted to try it. |
I'm happy to give you the time you need to see how it looks with and without the annotations on IntelliJ. If after seeing it you think I was mistaken in my assessment of needing the annotations, then I'd be very happy to be proven so! Otherwise, if you agree with my assessment, add the annotations back in. When that's done, squash your commits. |
Ok, back again. |
I introduced the |
I am afraid I still have a few blind spots in my understanding of spotless and the whole set -up. Update to original comment (misinterpreted the test, confused by test error): So the feature branch should be now in line with the previous agreements. |
Travis runs
If you're coming from a maven background, Gradle is a little different. It has its own, gradle-specific cache. Here is their blog post explaining why. mavenCentral() = In maven, things from
Spotless caching (the whole The problem is that to resolve a JarState in a unit test, we have to make a fake Gradle build, add the dependency, and ask gradle to resolve it. It's very slow. Soooo, in order to make the unit tests faster, we added this little caching hack so that once a JarState has resolved once during testing, we won't have to create the fake Gradle build again.
Strange... What OS are you on? I just ran SubstanceThis LGTM, except for two minor changes:
/** Deprecated for {@link FileSignature::asList yada yada */
@Deprecated
public static FileSignature from(Iterable<File> files) throws IOException {
return asList(files)
}
// this looks easier to understand to me
Iterable<File> filesToSign = ...
FileSignature setSignature = FileSignature.signAsSet(filesToSign);
FileSignature listSignature = FileSignature.signAsList(filesToSign);
// than this
Iterable<File> filesToSign = ...
FileSignature setSignature = FileSignature.fromList(filesToSign);
FileSignature listSignature = FileSignature.fromSet(filesToSign); |
FileSignature#signAsSet corresponds to original behavior FileSignature#from. FileSignature#signAsList is sensitive to file order and duplicates. Moved checks for 'null' files from caller into FileSignature
I implemented the requested changes. @nedtwigg About the checking of the entire project: Thanks for the background information about Maven repository usage by Gradle and Spotless. |
Looking back through the history of |
This LGTM now. @nedtwigg, anything else you'd like to be done before I merge? |
Merge-ho!!!
On Sun, Mar 12, 2017 at 3:17 AM Jonathan Bluett-Duncan < ***@***.***> wrote:
This LGTM now.
@nedtwigg <https://github.com/nedtwigg>, anything else you'd like to be
done before I merge?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#85 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACyhwGmjC_MHNNhGXA0gQtb3yr51YpsUks5rk8ZDgaJpZM4MaMSc>
.
--
Ned Twigg
Lead Software Architect, DiffPlug LLC
540-336-8043 (cell)
888-513-6870 (fax)
340 S Lemon Ave #3433, Walnut, CA 91789
|
Done! Thank you very much for your work so far @fvgh. We'll be ready to accept your next PR whenever you're ready. :) |
Thanks again for your support and help. Hopefully I am getting into the
work flow and more used to the code style so that there will be less
effort on your side for the next PRs.
|
FileSignature#fromSet corresponds to original behavior FileSignature#from.
FileSignature#fromList is sensitive to file order and duplicates.
Moved checks for 'null' files from caller into FileSignature