]> source.dussan.org Git - jgit.git/commitdiff
ErrorProne: Enable check for misuse of ExpectedException 44/126144/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Tue, 17 Jul 2018 01:43:04 +0000 (10:43 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Mon, 23 Jul 2018 06:14:00 +0000 (07:14 +0100)
Any additional statements after the statement that is expected to
throw will never be executed in a passing test. This can lead to
inappropriately passing tests where later incorrect assertions are
skipped by the thrown exception. See [1] for examples.

There are no cases of this in the code base, but by enabling the
checker with severity ERROR we can ensure that we don't overlook
any future misuse of ExpectedException.

[1] http://errorprone.info/bugpattern/ExpectedExceptionChecker

Change-Id: I266d4f73f6075bfc1e39fa3d8aee7dee96db61b9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
pom.xml

diff --git a/pom.xml b/pom.xml
index 2758844ff070ca25661009091cca8b5d5b30c1a7..61869ff43f91ba7d791543754f45788f9074be22 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                 <configuration>
                   <compilerId>javac-with-errorprone</compilerId>
                   <forceJavacCompilerUse>true</forceJavacCompilerUse>
+                  <compilerArgs>
+                    <arg>-Xep:ExpectedExceptionChecker:ERROR</arg>
+                  </compilerArgs>
                   <excludes>
                     <exclude>org/eclipse/jgit/transport/InsecureCipherFactory.java</exclude>
                   </excludes>