-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Enable error-prone static analysis checks #1266
Conversation
3fe7ff1
to
de2c216
Compare
Hmm. My understanding of Vintage Test Engine is very limited, to say the least, so I'm stumped as to why one of its corresponding tests is failing. Any thoughts would be appreciated. :) |
You only changed a single file in "vintage": Does reverting the comparison help? |
@sormuras It does, actually! I'll push a new commit with that section reverted. |
See the javadoc of
|
Oh, doh! Thanks @sormuras. :P I must've made that change thinking that error-prone was going to complain about the usage of |
Codecov Report
@@ Coverage Diff @@
## master #1266 +/- ##
============================================
- Coverage 92.02% 91.99% -0.03%
- Complexity 3160 3163 +3
============================================
Files 296 296
Lines 7686 7695 +9
Branches 630 631 +1
============================================
+ Hits 7073 7079 +6
- Misses 447 451 +4
+ Partials 166 165 -1
Continue to review full report at Codecov.
|
6ef3d12
to
f134504
Compare
Welp, I'm thoroughly stumped once again. For some reason, task @sormuras Do you have any ideas as to where I could seek help, or any other thoughts? |
@jbduncan There are two things that I've discovered when working with Kotlin that might help you.
|
@JLLeitschuh Wow, thanks a lot for the pointers! 👍 Both of the approaches you listed look promising to me, so I'll look into them when I'm next free. |
@JLLeitschuh Many thanks for your help! As you suspected, the error-prone Java compiler needed the .class files produced by the Kotlin compiler, so after doing some digging around in the sources of the Gradle Kotlin Plugin, I discovered that adding the .class files to the classpath of the error-prone Java compiler fixes things. Cheers! 🎉 |
f5a2732
to
0c0da26
Compare
@sormuras The JDK 10 build on Travis is complaining about being unable to find I've done a Google search on It's not clear to me if this is happening because of the changes I made to |
I have no idea. |
Unless if anyone else in the JUnit 5 team has encountered this sort of error before (https://travis-ci.org/junit-team/junit5/jobs/345033831), I wonder if the best course of action in the meantime would be to make it optional for the JDK 10 build to pass. WDYT @sormuras? |
@sormuras I believe that the error is caused by error-prone issue google/error-prone#860. error-prone uses a pretty recent Java compiler, but not the absolute bleeding-edge one, so it doesn't yet recognise Java 10 classfiles. I think that's the reason why Travis's JDK 10 build is producing strange messages. For that reason, I'm opting to only enable error-prone when running on JDK 9, and I'll work on making that change next. |
I'm ready for another review whenever the JUnit team's ready. :) |
…m usages to Array.stream(String.split(..., (0|-1)) so that we're explicit about trailing-empty-string-trimming behaviour)
This reverts commit 0eb0f65.
Currently, it doesn't run on Java 10. See google/error-prone#860
…ed errors"" This reverts commit 3ff428c.
…y reported errors""" This reverts commit 5c508ff.
…oduce too much churn. Also fix errors that were reintroduced in recent commit reverts.
de7579f
to
cf18c7d
Compare
@jbduncan Thanks for keeping this PR up-to-date and sorry if we've been stringing you along. My gut feeling is that using error-prone for this project might be more trouble than it's worth. We have to make sure that JUnit always works with the latest JDK, even EA releases. Naturally, error-prone lags behind in that regard. Thus, I think we should abandon this effort, at least for now. @junit-team/junit-lambda Thoughts? |
@marcphilipp No worries! I was aware that JUnit 5 is tested against the latest JDK releases, so I knew that there was risk that this PR wouldn't be accepted; I was keeping it up-to-date as I find this sort of thing enjoyable. (And I was also secretly hoping that the fact that error-prone cannot keep up with the latest stable and EA releases would not be that big a problem. 😉) If it is decided that this effort should be abandoned, then I'll accept that decision with grace. :) |
Isn't error prone a fork of the eclipse java compiler? @jbduncan I'm sorry to hear this might get canned, I know you put a significant amount of effort into it. |
@JLLeitschuh IIRC error-prone is actually a fork of OpenJDK's javac. |
@JLLeitschuh I'd be interested to understand why you ask, though. :) |
@marcphilipp |
Unfortunately ("unfortunate" because of the amount of effort invested in this by @jbduncan), I have to agree with @marcphilipp as well: it appears that staying on top of issues with error prone will be... well... error prone for the maintainers of the build. In any case, thanks for all of the hard work, @jbduncan! And... I'm glad you at least found the work "enjoyable". 😉 |
I'm closing this PR since the team seems to be in consensus on this topic. @jbduncan Sorry again and thanks for trying to convince us! I'm sure we can find another issue for you to work on if you want. 😉 |
Well, there were times where I got maddeningly stuck, as I think you already knew... 😉 ...but overall I found the process very enjoyable, even though it was just a dead end all along. 😁 |
@marcphilipp Thanks! I'll likely decide to go back to #955 in the foreseeable future, either to choose another static analysis tool if any exist that follow the latest stable releases and/or EA releases, or to close the issue altogether if no such tools apparently exist. :) |
PMD as an alternative?
Because I've found that the eclipse compiler is a PITA as well. It can't handle generic inference correctly in many cases. Wondering if I was going to deal with these same issues moving some of my projects forward to JDK 9 support. |
Overview
Following issue #955 and closed PR #961, this is a PR to introduce error-prone checks to JUnit 5.
Feedback is welcome!
I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@API
annotations