Last active
April 1, 2016 00:29
-
-
Save emopers/ad4c0ebef6b782578359 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, we're rethinking about the usability of the property Comparable_CompareToNull in finding bugs. | |
As stated in Java API doc, "e.compareTo(null) should throw a NullPointerException even though e.equals(null) returns false.", | |
so intuitively this property would be violated when and only when NullPointerException is thrown by JVM given | |
how this property is written. Though there is possibility that some implementations of Comparable interface may not throw NullPointerException as | |
required by Java specification, this could be detected by property Comparable_CompareToNullException. | |
In our samples of this property's violations from monitoring it on 200 open source projects, | |
all violations of this kind are triggered by developers' intentionally passing null in negative tests, | |
which conforms with the argument above. Furthermore, violations of this property do not provide more useful debugging information than | |
the NullPointerException itself. | |
For now, we cannot think of any conditions that this property can actually help to eliminate bugs in code. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment