All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Jump to version 3.x
- Jump to version 2.x
- Jump to version 1.x
- Fixes bug where the wrong generic type was provided when multiple fields of the same type but with different generic parameters exist. (Issue 1022)
- The internal instantiation logic has been further refactored, to be more robust and extensible for future enhancements.
3.17.3 - 2024-11-07
- Fixes bug when passing a subclass of a field's type into
#withPrefabValues()
(which was introduced in the previous version). (Issue 1014) - In Windows builds, the handling of line endings didn't work properly. (Issue 1015)
3.17.2 - 2024-11-05
- It's now possible to pass a subclass of a field's type into
#withPrefabValuesForField()
. (Issue 1012)
- The internal instantiation logic has been further refactored, to be more robust and extensible for future enhancements.
3.17.1 - 2024-10-02
- Instantiates
java.sql.Date
only when available, so EqualsVerifier no longer throwsNoClassDefFoundError
when it's not available (for instance, when running EqualsVerifier standalone instead of as part of a test suite). (Issue 746)
3.17 - 2024-09-24
- #withPrefabValuesForField method, where you can assign prefab values to a field instead of to a class. The values will then be used for that field only. (Issue 747)
- The internal instantiation logic has been heavily refactored, to be more robust and extensible for future enhancements.
Warning.ZERO_FIELDS
: the use case for this Warning is better handled by the new#withPrefabValuesForField
method.
3.16.2 - 2024-08-23
- The error message in some edge cases involving complex generics and abstract classes is now improved. (Issue 983)
- The line in the error message that shows the version of EqualsVerifier and the JDK, now also indicates whether EqualsVerifier runs on the classpath or the modulepath.
withResetCaches()
was once needed for use in Quarkus, but caches are now reset automatically on every run.
3.16.1 - 2024-04-03
- IllegalArgumentException
argument type mismatch
when a field's type has a wildcard generic and the underlying type has a type bound (such asT extends Serializable
). (Issue 940) - AbstractMethodError when a the
equals
method in a field's class calls an abstract method. (Issue 938)
3.16 - 2024-03-22
- Support for Spring Framework's
@NonNullFields
annotation and JSpecify's@NullMarked
annotation. (Issue 936)
- When
Warning.SURROGATE_OR_BUSINESS_KEY
is suppressed, it is now possible to use#withOnlyTheseFields
, and the fields may include both@Id
fields and regular fields. (Issue 934) - Improved the error message for so called 'versioned entities' (where entities with
0
ornull
ids are always unequal), so it's more discoverable what to do in that situation. (Issue 932)
3.15.8 - 2024-03-01
- Final entities with @GeneratedValue could not be verified. (Issue 929)
3.15.7 - 2024-02-23
- StackOverflowError when a class has a field of a sealed type whose only permitted subtype has a reference to the original class. (Issue 920)
3.15.6 - 2024-01-09
- Protected JPA entity getters were ignored. (Issue 909)
3.15.5 - 2023-12-22
- Check that getters are used for all generated JPA id fields. (Issue 892)
3.15.4 - 2023-11-29
- A check for Scala with its
-Xcheckinit
flag switched on. This flag generates a field that should have been marked as synthetic, but isn't, so EqualsVerifier has to check for this field explicitly.
3.15.3 - 2023-11-01
- Improves error message when packages are not "open" to EqualsVerifier. (Issue 868)
3.15.2 - 2023-09-23
- For JPA entities with a hashCode that doesn't use all fields, and with
Warning.STRICT_HASHCODE
suppressed, an error was thrown. (Issue 853)
3.15.1 - 2023-08-02
- For mapped fields in JPA entities, an error was thrown if the getter wasn't used in
equals
andhashCode
even if the field wasn't used at all. (Issue 816)
- Improves error messages when calling
#withPrefabValues
incorrectly.
3.15 - 2023-07-08
- Check that getters are used for all mapped fields in JPA entities, not just the ones with
FetchType.LAZY
. (Issue 830)
Note that this is a breaking change for JPA entity tests. This can be disabled by suppressingWarning.JPA_GETTER
. See the manual page about JPA entities, specifically the section on Materialized fields, for more details.
#withFieldnameToGetterConverter()
to override the derivation of getter names from field names when testing JPA entities. (Issue 829)Warning.JPA_GETTER
to suppress the check that getters should be used instead of direct field references in JPA entities.
3.14.3 - 2023-06-23
- Adds prefab values for
Throwable
,Exception
andRuntimeException
. (Issue 831)
3.14.2 - 2023-05-31
- Adds prefab values for
DoubleAdder
,DoubleAccumulator
,LongAdder
andLongAccumulator
. (Issue 817)
3.14.1 - 2023-03-16
- Fixes incorrect error message when a sealed type has multiple permitted subtypes. (Issue 786)
3.14 - 2023-02-27
3.13.2 - 2023-02-16
- Verifies
hashCode
consistency whenString.equalsIgnoreCase
is used. (Issue 748) - Improves error messages for detected NullPointerExceptions: if a field causes one, EqualsVerifier will indicate whether it's the field on the 'this' object or the one on the parameter object.
3.13.1 - 2023-02-10
Warning.SURROGATE_KEY
was ignored when@Id
annotation is in entity's superclass. (Issue 763)
3.13 - 2023-02-02
- Made it possible to suppress both
Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY
andWarning.SURROGATE_KEY
. Note that in some cases when suppressingWarning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY
on a class with a surrogate key, it is now necessary to also explicitly suppressWarning.SURROGATE_KEY
(Issue 755)
3.12.4 - 2023-01-28
- Automates release procedure using JReleaser and GitHub Actions.
- Added prefab values for
java.io.PrintStream
. (Issue 753)
3.12.3 - 2022-12-14
- Getters for lazy fields in entities could not be found in a superclass. (Issue 744)
3.12.2 - 2022-12-08
Warning.SURROGATE_OR_BUSINESS_KEY
for JPA entities that insist on using all fields inequals()
andhashCode()
, whether they are@Id
or not.
- Removed duplicated website urls and diagnostic output when using
forPackage()
orforClasses()
and multiple classes have issues.
3.12.1 - 2022-12-02
- Improved error message output for objects that throw exceptions in their
toString()
methods. (Issue 716)
- Fix
ClassFormatError
when attempting to create a dynamic subclass for a class that has no package. (Issue 638) - Fix
LinkageError
when running Quarkus dev mode and testing an abstract class. (Issue 550)
3.12 - 2022-11-30
- Diagnostic output in all error messages.
- Check that getters are used for lazily fetched fields in JPA entities. (Issue 650)
- Improves error messages around
Warning.SURROGATE_KEY
. (Issue 698)
3.11.1 - 2022-11-18
- Verifies
Map.Entry
's extendedhashCode
contract. (Issue 603; thanks scordio!)
3.11 - 2022-11-02
- Allow filtering
forPackage()
based on a superclass: it only tests only subclasses of the given class. Note: it is recursive, and the superclass itself is NOT included! (Issue 706)
- Fix issue when the project path contains whitespaces. (Issue 723; thanks Kobee1203!)
3.10.1 - 2022-07-26
3.10 - 2022-03-22
- Support records that don't allow 0 values in their fields, with Warning.ZERO_FIELDS. (Issue 613)
3.9.1 - 2022-03-19
- Support null checks in record constructors with Warning.NULL_FIELDS. (Issue 610)
- Restores javadoc and sources jar files on Maven Central. (Issue 598)
- Made submodule dependencies in published
pom.xml
optional, so the Maven Enforcer Plugin won't complain. (Issue 587)
3.9 - 2022-01-31
- EqualsVerifier is now released as a multi-release JAR file, in two variants:
equalsverifier
andequalsverifier-nodep
.equalsverifier-nodep
has all its dependencies shaded into a fat jar file;equalsverifier
has dependencies. Note that until now,equalsverifier
was the only artifact, and it was a shaded fat jar. (Issue 575)
3.8.3 - 2022-01-25
- Support for Jakarta persistence annotations. (Issue 576; thanks Ahli!)
- Exception when testing sealed classes that redefine equals. (Issue 564)
3.8.2 - 2022-01-04
- Exception when testing sealed classes that redefine equals. (Issue 564)
- References to the EqualsVerifier wesbite are now switched to https. (Issue 559; thanks dfa1!)
3.8.1 - 2021-12-15
- Uncaught NullPointerException in certain cases when a used field throws it. (Issue 552)
3.8 - 2021-12-03
withResetCaches()
to reset the Objenesis caches. This can be useful if the test framework uses multiple class loaders; see for instance this question on StackOverflow.
- Verifies equality for
BigDecimal
usingcompareTo()
. (Issue 540; thanks ac183!)
3.7.2 - 2021-10-15
#forPackage()
no longer fails in presence of anonymous or local inner classes. (Issue 517; thanks kilink!)
3.7.1 - 2021-08-13
- Added prefab values for
java.util.concurrent.Semaphore
. (Issue 476)
3.7 - 2021-07-09
- Support for Lombok's
@EqualsAndHashCode(cacheStrategy = LAZY)
. (Issue 460; thanks janeisklar!)
3.6.1 - 2021-05-21
- Support for recursion into sub-packages using
#forPackage()
when combined with#simple()
. (Issue 437; thanks Kobee1203!)
3.6 - 2021-04-19
- Support for recursion into sub-packages using
#forPackage()
. (Issue 423; thanks Kobee1203!)
- Allows static methods that are named
equals
. (Issue 417)
3.5.5 - 2021-02-24
- Improves performace by reusing
Objenesis
instance. (Issue 400; thanks selckin!)
- Added prefab values for
java.awt.Image
. (Issue 399)
3.5.4 - 2021-02-08
- Added prefab values for
java.nio.charset.Charset
. (Issue 391; thanks sullis!)
3.5.3 - 2021-02-03
- Added prefab values for
java.util.DoubleSummaryStatistics
,java.util.IntSummaryStatistics
andjava.util.LongSummaryStatistics
. (Issue 385)
3.5.2 - 2021-01-19
- Added prefab values for
java.time.Clock
. (Issue 384; thanks sullis!)
3.5.1 - 2021-01-05
- Website is migrated from
gh-pages
branch todocs
folder to make it more accessible. - JDK-specific unit tests, such as the
RecordsTest
which targets JDK16+, have now been migrated tosrc/test/javaXX
(whereXX
is the version number of the JDK the test targets) so there is no longer a need to compile classes at run-time inside the test. - Upgraded unit tests to JUnit 5.
- Replaced Google Fava Format with Prettier-Java, which makes the code look less jagged and messy.
- CI is migrated from CircleCI to GitHub Actions.
- Added prefab values for
java.text.NumberFormat
andjava.text.DecimalFormat
. (Issue 379)
3.5 - 2020-10-20
- Updated support for Java 15's records.
3.4.3 - 2020-09-08
- Added more helpful error message explaining why EqualsVerifier can't verify subclasses of
java.util.ArrayList
. (Issue 341) - Changes order of processing fields (non-statics first, statics later) so static fields don't obscure issues that are really in non-static fields. (Issue 159)
- Added prefab values for
java.net.URL
. (Issue 340) - Fixed support for records with static fields in JDK 14. (Issue 346; thanks Edgar!)
- ByteBuddy experimental support (needed for Java 16 support) can now be accessed via
-Dnet.bytebuddy.experimental=true
again instead of-Dnl.jqno.equalsverifier.internal.lib.bytebuddy.experimental=true
. (Issue 339; thanks Stefano!)
3.4.2 - 2020-08-20
- Updated Byte-Buddy to support Java 16 EA. (11fd38c28c and 2fcf9a0117)
- Added prefab values for
java.net.InetSocketAddress
. (Issue 336)
3.4.1 - 2020-06-15
Warning.STRICT_INHERITANCE
doesn't take away the requirement to call#usingGetClass()
when superclass has fields. (Issue 316)
3.4 - 2020-06-13
EqualsVerifier.simple()
, which gives you an EqualsVerifier that's not so strict and will immediately approve anequals
method generated by your IDE. Under the hood, it suppressesWarning.STRICT_INHERITANCE
andWarning.NONFINAL_FIELDS
.- Initial support for Java 14's records and their new equality invariant.
- Support for JSR305's
ParametersAreNonnullByDefault
annotation. (Issue 308)
- Renames the project's main branch to
main
. - Replaces all references to the word 'black' to 'blue', including those in internal (but accessible) API's.
Warning.STRICT_INHERITANCE
now also takes away the requirement to call#usingGetClass()
- Testing a class with that has fields but doesn't override
equals
causes "Mutability: equals depends on mutable field" error. (Issue 315)
3.3 - 2020-05-14
- Overload for
#except()
when using#forPackage()
that takes a predicate instead of a set list of elements. (Issue 307; thanks Tom!) #forClasses()
overload that takes anIterable<Class<?>>
. (Issue 271)
3.2 - 2020-05-10
- Support for testing multiple classes at once, through
#forClasses()
and#forPackage()
. See the manual entry for more information. (Issue 271)
3.1.13 - 2020-03-14
- Added prefab values for
java.util.OptionalDouble
,java.util.OptionalInt
,java.util.OptionalLong
,java.util.EventObject
,java.awt.Font
,javax.swing.tree.DefaultMutableTreeNode
andjava.beans.PropertyChangeSupport
. (Issue 286)
3.1.12 - 2020-01-27
- Added prefab values for
java.util.Currency
. (Issue 268; thanks sullis!)
3.1.11 - 2019-12-26
- Error message now shows fully qualified class name. (Issue 261; thanks sullis!)
- Updated Byte-Buddy to support Java 14 EA.
3.1.10 - 2019-09-29
java.lang.reflect.Method
and other reflection types cause illegal reflective access warnings on Java 9+: added prefab values. (Issue 248)
3.1.9 - 2019-05-16
- Fixed spelling of Apache License, Version 2.0. (Issue 241; thanks Vincent!)
- Updated to Byte-Buddy to support Java 13 EA. (Issue 239; thanks William!)
3.1.8 - 2019-04-04
- Testing a class with Guava
TypeToken
causes AbstractMethodError. (Issue 238)
3.1.7 - 2019-03-15
- Performance improvement. (Issue 235)
3.1.6 - 2019-03-11
- Testing a class with
StringBuilder
causes StringIndexOutOfBoundsException. (Issue 234)
3.1.5 - 2019-02-18
- Verifying interfaces directly causes NullPointerException. (Issue 232)
- Improved error messages regarding JPA's
@EmbeddedId
annotation. (Issue 231)
3.1.4 - 2018-12-31
- Support for JPA's
@EmbeddedId
annotation: it is now handled in the same way as@Id
. (Issue 228)
3.1.3 - 2018-12-29
- McAfee falsely flags
EqualsVerifierBugException
as aExploit-ByteVerify
virus. (Issue 229; thanks Matt!)
3.1.2 - 2018-12-26
- Classes or fields with an annotation that contains a primitive array cause ClassCastException. (Issue 227)
3.1.1 - 2018-12-26
- Classes with a method named
get()
cause StringIndexOutOfBoundsException. (Issue 226)
3.1 - 2018-12-24
- Support for JPA's
@Id
and Hibernate's@NaturalId
annotations. See the manual for more details. (Issue 225)
- Removed direct dependency on ASM by re-writing the annotation processor to Byte-Buddy. (Issue 208)
- Various precondition checks now give slightly different error messages if they fail.
#withPrefabValues()
no longer throws InaccessibleObjectException when the prefab value is from a module that is not open for reflection and the--illegal-access=deny
flag is activated. (It will still issue illegal reflective access warnings when--illegal-access=warn
, though. This is the default setting.) (Issue 206 and Issue 215)- EqualsVerifier's test suite now runs on Java 12 EA. (Issue 209)
3.0.3 - 2018-11-16
- An incorrect
module-info
was shaded into the jar file. (Issue 222)
3.0.2 - 2018-10-31
java.time
fields cause illegal reflective access warning on Java 9+: added prefab values. Issue 217)
3.0.1 - 2018-10-29
java.net.URI
fields cause illegal reflective access warning on Java 9+: added prefab values. (Issue 214)- Java 11 support is no longer experimental because internal ASM dependency is updated to version 7.0.
- Updated internal ASM dependency to version 7.0, so Java 11 support is no longer experimental.
3.0 - 2018-09-26
If you're upgrading from EqualsVerifier 2.x, please see the migration guide.
- Full support for Java 11. (Issue 197)
- Re-usable EqualsVerifier configurations: see the manual.
#report()
method to ask EqualsVerifier for a report, instead of making it fail a test.#withGenericPrefabValues()
method added to supply values for specific generic types: see here.
- Error messages are more readable, because:
- the name of a failing class is mentioned more clearly in the error message (Issue 202);
- the error message no longer edits out EqualsVerifier-internal calls from the stack trace;
- the layout of the text in the error messages has been improved.
- Performance improvements. (Issue 190; see also this tweet)
- Code base now uses Java 8 language features.
- JavaDoc has been updated.
- Support for Java 7.
Warning.ANNOTATION
, because it's no longer needed.- The annoying license and copyright headers in each file. (Don't worry: EqualsVerifier is still licensed under the Apache 2.0 license!)
java.util.function.Supplier
,java.util.concurrent.atomic.Atomic*
and some RMI-specific fields cause illegal reflective access warnings on Java 9+: added prefab values. (Issue 207)
2.5.2 - 2018-08-17
Inet4Address
,Inet6Address
,java.sql.Date
,java.sql.Time
andjava.sql.Timestamp
cause illegal reflective access warnings on Java 9+: added prefab values.
2.5.1 - 2018-08-05
- AssertionError when class under test has stateless fields: you can now use
#withIgnoredFields()
. (Issue 203)
2.5 - 2018-07-30
Warning.ALL_NONFINAL_FIELDS_SHOULD_BE_USED
when only the final fields are relevant to yourequals
method. (Issue 200)
- Using both abstract methods and lazy initializers throws an unexplained
NullPointerException
. (Issue 201) - Empty enum fields throw
ReflectionException
. (Issue 199)
2.4.8 - 2018-07-04
- Java NIO buffer fields cause Significant field error. (Issue 198)
- Java 11 compatibility. (Issue 197)
2.4.7 - 2018-06-20
- Performance improvements, because part of the processing of annotations is now cached. (Issue 190; thanks Андрей!)
java.lang.Thread
fields cause illegal reflective access warning on Java 9+: added prefab values. (Issue 193)@Transient
fields are not ignored, as discussed in the manual. (Issue 196)
2.4.6 - 2018-04-28
- An AWT frame pops up while EqualsVerifier is running. (Issue 192)
2.4.5 - 2018-03-20
- Updates internal Byte Buddy dependency to support Java 10 GA. (Issue 189; thanks Vincent!)
2.4.4 - 2018-03-12
- Initial support for Java 10.
- Support for building and releasing EqualsVerifier from Java 9.
2.4.3 - 2018-02-03
- Support for Guava 24's Multisets. (Issue 185; thanks Stephan!)
2.4.2 - 2018-01-20
- AWT classes cause illegal reflective access warnings on Java 9+, and recursive data structure errors: prefab values added. (Issue 183)
2.4.1 - 2018-01-12
- EqualsVerifier's test suite (and probably your own EqualsVerifier tests!) now run on Java 9 without any illegal reflective access warnings. (Issue 172)
2.4 - 2017-11-11
- An official Java 9 module name:
nl.jqno.equalsverifier
. - Initial support for Java 10 Early Access. (Issue 177; thanks Vincent!)
2.3.3 - 2017-08-24
- Chaining calls to
#withIgnoredFields
and#withOnlyTheseFields
throws IllegalArgumentException. (Issue 171; thanks Nathan!) - Having a field from the Java library's
org.w3c.dom
package throws IllegalArgumentException. (Issue 174)
- EqualsVerifier's jar file is smaller again due to better Maven support of Java 9. (Issue 152, Comment 18)
2.3.2 - 2017-08-06
- Support for Java 9. (Issue 152)
2.3.1 - 2017-07-03
- Non-final
equals
andhashCode
in JPA entities no longer cause an error. (Issue 170)
2.3 - 2017-05-24
#withIgnoredAnnotations
to disable specific annotations. For instance, you can disable@Nonnull
to gain 100% test coverage onequals
methods generated by Lombok. (Mailinglist threads 1 and 2; for more info see 'Coverage is not 100%')- Support for classes derived from classes that live in a signed jar. (Issue 163)
- The
MANIFEST.MF
file is back in the EqualsVerifier jar. (Issue 169)
2.2.2 - 2017-04-03
java.inet.InetAddress
fields cause "Cannot inject classes into the bootstrap class loader" error. (Issue 168)- Fields of other types also cause class loader errors. (Also issue 168)
2.2.1 - 2017-01-29
- Fields of
Map
type where a single value enum is used as key. (Issue 166)
2.2 - 2017-01-14
#withNonnullFields()
to be more specific about which fields may be null. (Issue 134)
- Error messages are more helpful.
- Uninitialized static arrays cause NullPointerException. (Issue 165)
2.1.8 - 2016-12-13
- Classes that implement an abstract class that calls an abstract method in its
equals
orhashCode
method, throw AbstractMethodError when EqualsVerifier is called with#usingGetClass()
. (Issue 161)
2.1.7 - 2016-11-18
- Single value enums cause Significant fields error. (Issue 157; thanks Stephan!)
2.1.6 - 2016-10-01
- Annotations which are available at compile-time but not at run-time sometimes throw NullPointerException. (Issue 153 and Issue 154)
2.1.5 - 2016-08-06
java.util.Vector
andjava.util.Stack
fields throw ArrayIndexOutOfBoundsException. (Issue 151)
2.1.4 - 2016-07-25
- Full generics support for Guava's
Range
. (Issue 150; thanks Stephan!)
2.1.3 - 2016-07-17
- Older versions of Google Guava cause ReflectionException. (Issue 149)
2.1.2 - 2016-06-20
- Race condition when EqualsVerifier is run concurrently. (Issue 148; thanks Borys!)
2.1.1 - 2016-06-14
- Updated ByteBuddy dependency. (Issue 145; thanks Vincent!)
- In certain situations, for example when running unit tests with coverage in IntelliJ, VerifyErrors are thrown. (Issue 147)
2.1 - 2016-05-22
Warning.STRICT_HASHCODE
to let EqualsVerifier allowhashCode
methods that don't use all the fields that are also used inequals
, or even constanthashCode
s. (Issue 142)
- Unexpected behaviour when a class's
equals
orhashCode
asserts on the length of its array field. (Issue 143) - Objenesis's meta-data carries into EqualsVerifier's jar file's
META-INF
folder. (Issue 144) - EqualsVerifier throws ReflectionException when it's unable to read annotations on fields in certain situations. (Issue 114, Comment 21)
2.0.2 - 2016-04-03
- Classes that implement an abstract class that calls an abstract method in its
equals
orhashCode
method, throws AbstractMethodError. (Issue 138) javax.naming.Reference
throws IllegalStateException on certain JVMs. (Issue 114)
2.0.1 - 2016-03-13
com.google.code.findbugs.annotations
dependency now hasprovided
scope. (Issue 135; thanks Stephan!)
- Classes that have a static final reference to a recursive data structure, without adding a prefab value.
- Classes that have a generic parameter that extends
Comparable
throw IllegalArgumentException. (Issue 136)
2.0 - 2016-03-06
If you're upgrading from EqualsVerifier 1.x, please see the migration guide.
#withIgnoredFields()
to disregard specific fields, while expecting all remaining fields to be used inequals
.#withOnlyTheseFields()
to expect that the given fields are used, and that the remaining fields are not used. (Issue 128)Warning.ALL_FIELDS_SHOULD_BE_USED
to suppress Significant field errors.- EqualsVerifier fails when
equals
isn't overridden (i.e., inherited directly fromObject
). (Issue 66)Warning.INHERITED_DIRECTLY_FROM_OBJECT
to revert back to the old behaviour.
- 'All fields should be used' is now the default behaviour. (Issue 65)
#forRelaxedEqualExamples()
implicitly suppressesWarning.ALL_FIELDS_SHOULD_BE_USED
.- Suppressing
Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY
implicitly suppressesWarning.ALL_FIELDS_SHOULD_BE_USED
. - EqualsVerifier puts more useful information on the stack trace if it fails.
- Replaced internal dependency to CGLib with Byte Buddy, for better support of Java 8. (Issue 115)
- Improved EqualsVerifier's code quality by adding Checkstyle and FindBugs, and doing mutation tests with PIT.
- Support for Java 6.
EqualsVerifier#forExamples()
. Use#forClass()
or#forRelaxedEqualExamples()
instead.EqualsVerifier#debug()
. (It didn't do anything anymore, anyway.)
- Referring to the generic contents of containers such as
List
andOptional
in the implementation ofequals
andhashCode
can throw ClassCastException. (Issue 84)
1.7.8 - 2016-12-26
- EqualsVerifier throws RuntimeException when used together with Java 8's
-parameters
compiler option.
1.7.7 - 2016-01-18
- EqualsVerifier throws NullPointerException when used together with Cobertura. (Issue 132)
1.7.6 - 2015-12-21
- EqualsVerifier gives 100% mutation coverage with PIT on your
equals
andhashCode
methods. (Issue 131)
- Implementing an interface that defines
equals
causes Reflexivity error. (Issue 130)
1.7.5 - 2015-08-29
- EqualsVerifier gives Symmetry errors if the symmetry violation only occurs in the subclass of a versioned entity. (Issue 123, Comment 10)
- EqualsVerifier gives a warning when the id check on a versioned entity is implemented incorrectly. (Issue 123, Comment 17)
- Suppressing
Warning.NONFINAL_FIELDS
on classes marked@Embeddable
and@MappedSuperclass
is no longer needed. (Issue 124 and Issue 123, Comment 15)
- EqualsVerifier throws NullPointerException on singleton enum fields. (Issue 125)
1.7.4 - 2015-08-17
- JavaFX fields (on Java 8) cause RecursionException: added prefab values. (Issue 120)
javax.naming.Reference
fields cause ClassCastException: added prefab value. (Issue 118)- SBT throws ClassNotFoundException when running EqualsVerifier. (Issue 119)
- Reporting on subclasses of versioned entities. (Issue 123)
1.7.3 - 2015-07-18
cachedHashCode
field can now have protected or default visibility for#withCachedHashCode()
. (Issue 110)- Several behind-the-scenes improvements :).
- Static final fields with value
null
throw NullPointerException. (Issue 116)
1.7.2 - 2015-03-28
- Support for Eclipse's JDT null annotations, including the Java 8 style type annotations.
- All internal dependencies have been updated. (Issue 107)
- Static fields with an empty array throw ArrayIndexOutOfBoundsException. (Issue 106)
- Several potential bugs, using PIT.
1.7.1 - 2015-03-11
- EqualsVerifier throws Reflexivity errors (which then need to be suppressed with version 1.7's
Warning.REFERENCE_EQUALITY
) on
1.7 - 2015-03-04
#withCachedHashCode()
to verify classes that cache theirhashCode
. (Issue 60; thanks Niall!)Warning.NO_EXAMPLE_FOR_CACHED_HASHCODE
to avoid giving an example value for#withCachedHashCode()
. (Issue 60)- An error message when you accidentally use
==
instead ofequals
on an object field inside theequals
method. (Issue 104) Warning.REFERENCE_EQUALITY
to suppress the above error. (Issue 104)
- Several Java Collections interface classes, including
SortedSet
andTreeSet
, throw AbstractMethodError: added prefab values. (Issue 103)
1.6 - 2015-01-17
- Support for default
@Nonnull
annotations. (Issue 50)- Using FindBugs's
@DefaultAnnotation
or@DefaultAnnotationForFields
, - Using a JSR 305 annotation (see this StackOverflow question),
- Placing them either on the class or on the package,
- With the ability to override the default annotation by placing
@Nullable
or@CheckForNull
on a field.
- Using FindBugs's
- Check for
hashCode
consistency when object is stateless. (Issue 97) - Support for classes where equality is fully defined in a superclass, for example using Apache Commons's
EqualsBuilder.reflectionEquals
. (Issue 102)
- Stateless classes cause Precondition error. (Issue 46)
- Classes with stateless fields cause Precondition error. (Issue 100 and Issue 101)
1.5.1 - 2014-12-05
- EqualsVerifier now build with Maven instead of ANT+Ivy.
- Dependency issues when incompatible versions of ASM and/or CGLib are on the classpath: EqualsVerifier is now shipped as an "uber jar" which contains all its dependencies inside. (Issue 96)
- EqualsVerifier throws ReflectionException with older versions of Google Guava on the classpath. (Issue 98)
1.5 - 2014-08-20
- Support for Java 8! Classes containing Java 8 language features are now supported, and prefab values for new Java 8 API classes have been added. (Issue 92)
- Improved error messages when
equals
orhashCode
are themselves abstract. - Heavily refactored EqualsVerifier's unit tests to make them easier to find and understand.
- Classes from Joda-Time and Google Guava throw AbstractMethodError: added prefab values. (Issue 83)
- Multi-dimensional arrays cause incorrect error messages. (Issue 90 and Issue 94)
Arrays#equals
onObject[]
fields doesn't work; onlyArrays#deepEquals()
does. (Issue 94)- Using
#allFieldsShouldBeUsed()
requires overridingequals
. (Issue 95; thanks Dean!)
1.4.1 - 2014-03-18
- Improved EqualsVerifier's unit tests for reflexivity and symmetry, to catch small mistakes such as the one in Issue 88.
- Verifying an enum causes Identical Copy and Symmetry errors. (Issue 87)
1.4 - 2013-12-27
#allFieldsShouldBeUsedExcept()
to specifically ignore certain fields. (Issue 82)
- EqualsVerifier now covers 100% of your
equals
andhashCode
methods. (FAQ) - Error messages around abstract delegation are clearer. This clarifies especially classes that contain Joda-Time
LocalDate
fields.
- Classes that have an array field but don't declare an
equals
method cause an error. java.util.BitSet
fields cause ArrayIndexOutOfBoundsException: added prefab value. (Issue 86)
1.3.1 - 2013-06-09
Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY
which can be suppressed when testing "versioned entity" classes where a zero id field indicates that the object is new. (Issue 80)
- Explanations for EqualsVerifier's error messages can now be read on the new EqualsVerifier website at jqno.nl, which matches EqualsVerifier's fully qualified name:
nl.jqno.equalsverifier.EqualsVerifier
. - Transitivity errors are more accurate. (Issue 78)
- Exceptions thrown in
#toString()
break EqualsVerifier. (Issue 79) java.util.UUID
fields cause Recursion error: added prefab value. (Issue 81)
#debug()
, because relevant exceptions are now included as a cause in the stack trace.
Please don't use version 1.3; it's a broken release. Use 1.3.1 instead.
1.2 - 2013-03-26
- EqualsVerifier no longer fails on single value enums (and hence, singletons), even if they don't count for
equals
andhashCode
. (Issue 74) - EqualsVerifier can now be built using Ant 1.9. (Issue 76)
- Non-transitive
equals
methods (using||
) pass. (Issue 75; blog post about the problem and the solution) - Errors when the
toString
method of the class under test throws exceptions. - Classes containing null fields throw NullPointerExample in
#forRelaxedEqualExamples
. (Issue 73) - Some false negatives when running EqualsVerifier's test suite. (Issue 77)
1.1.4 - 2013-01-14
- Fork EqualsVerifier on GitHub! The code has been moved to GitHub. The project frontpage will remain on Google Code.
- Error messages on Abstract Delegation are more informative: EqualsVerifier now also mentions the name of the abstract method that was called.
- Issue when the class under test has a superclass that has no declarations for
equals
andhashCode
. (Issue 63) - No error when using
#allFieldsShouldBeUsed()
and the class under test has fields, but no declarations forequals
andhashCode
(and hence doesn't use these fields). (Issue 67)
1.1.3 - 2012-04-21
#allFieldsShouldBeUsed()
includes static fields. EqualsVerifier will now no longer complain if these static fields aren't used in yourequals
andhashCode
methods. (Issue 57)- EqualsVerifier passes when an
equals
method works incorrectly if a field in the class under test is null. (Issue 59)
1.1.2 - 2012-03-01
- EqualsVerifier recursively changes the value of non-final static fields, causing other tests to fail. (Issue 55, Comment 8)
1.1.1 - 2012-02-21
Warning.IDENTICAL_COPY
, to suppress when you want to use reference equality in an overriddenequals
method. (Issue 56)
1.1 - 2012-02-11
#allFieldsShouldBeUsed()
to get a warning if you forgot to include a field inequals
orhashCode
method. (Issue 53)
- EqualsVerifier passes when you include a reference-equality check (
this == obj
), followed by an incorrect instanceof check in yourequals
method. EqualsVerifier will now notice if you do an instanceof check for a class other than the one that you are testing. (Issue 55, Comment 2) - EqualsVerifier changes the values of non-final static fields, causing other tests to fail. (Issue 52 and Issue 55)
File
,List
,Set
,Map
andCollection
fields give unjustified warnings: added prefab values. (Issue 49 and Issue 51)
1.0.2 - 2011-08-14
- EqualsVerifier is now in Maven Central! (Issue 36)
- EqualsVerifier passes when you forget to include an
instanceof
check or agetClass()
check in yourequals
method. (Issue 47) - EqualsVerifier throws AbstractMethodError on a class whose superclass has abstract declarations for
equals
andhashCode
. (Issue 48)
1.0.1 - 2011-04-17
Warning.ANNOTATION
to disable annotation processing. This is useful for dynamically generated classes. (Issue 41)
- Issue when EqualsVerifier tests a class that is a subclass of one of the classes from
rt.jar
, which are loaded by the system classloader. (Issue 43) - EqualsVerifier fails on classes with
float
ordouble
fields but noequals
method. (Issue 44) Throwable
andException
fields cause Recursion error: added prefab values. (Issue 45)
1.0 - 2011-02-23
- Support for annotations. Use any of the following annotations on your classes and fields: EqualsVerifier will know what to do!
@Immutable
: EqualsVerifier will not complain about non-final fields if your class is@Immutable
. (It doesn't matter in which package the annotation is defined;javax.annotations.concurrent.Immutable
,net.jcip.annotations.Immutable
or your own implementation will all work fine.)@Nonnull
,@NonNull
and@NotNull
: EqualsVerifier will not check for potentialNullPointerException
s for any field marked with any of these annotations. (Again: the source package doesn't matter.) This is similar to calling#suppress(Warning.NULL_FIELDS)
, but on a per-field basis, instead of all-or-nothing. (Issue 28)@Entity
: EqualsVerifier will not complain about non-final fields if your class is a JPA Entity. Note that this only works forjavax.persistence.Entity
, not forEntity
annotations from other packages. (Issue 37)@Transient
: Fields marked with this annotation (again, only fromjavax.persistence.Transient
), will be treated the same as fields marked with Java'stransient
modifier; i.e., EqualsVerifier will complain if they are used in theequals
contract.
- EqualsVerifier now shows the name of the field that throws a potential NullPointerException. (Issue 39)
- EqualsVerifier detects recursive data structures where there are none. (Issue 34)
BigDecimal
andBigInteger
fields cause Recursion error: added prefab values. (Issue 34)
0.7 - 2010-11-15
#usingGetClass()
to testequals
methods that use a call togetClass()
instead of aninstanceof
check to determine the type of the object passed in.
- EqualsVerifier warns when you use a transient field in your
equals
orhashCode
method. Don't worry, you can suppress this warning too. - Error messages contain a link to the Error messages page to get more help.
- The back end is almost completely re-written.
- Certain Java API classes, like
Date
,GregorianCalendar
andPattern
, cause Recursion error: added prefab values. - Many Javadoc improvements (including the one in Issue 32).
0.6.5 - 2010-08-05
- EqualsVerifier now contains an internal list of prefab values for a wide variety of Java API types, to avoid getting 'Recursive datastructure' errors all the time. (Issue 30)
- Error messages when
equals
,hashCode
ortoString
throws something other than a NullPointerException when one of the fields isnull
, are now more helpful. (Issue 31)
0.6.4 - 2010-06-13
- Error message that a certain field is used in
equals
but not inhashCode
or the other way around, when reallyArrays.hashCode()
orArrays.deepHashCode()
should have been used. (Issue 27) - Many non-nullity errors on
toString
.
0.6.3 - 2010-05-18
- EqualsVerifier gives hashCode error on classes that don't override
equals
orhashCode
. (Issue 23) - IllegalAccessException when EqualsVerifier is used together with the EclEmma code coverage tool. (Issue 22)
- Classes that contain (indirect) references to non-static inner classes cause recursive data structure errors. (Issue 21)
0.6.2 - 2010-02-11
- Regression with
#withPrefabValues()
for recursive data structure fields in superclasses. (Issue 20)
0.6.1 - 2010-02-06
- Renamed
#verbose()
to#debug()
to access#verify()
more quickly using autocompletion in IDEs.
- Regression with
#withPrefabValues()
for fields which delegate to abstract methods. (Issue 14)
0.6 - 2010-01-30
- The API is more consistent.
#with(Feature)
is now#suppress(Warning)
, which feels more Java-y. Former features that were not warnings, are now proper methods onEqualsVerifier
:#verbose()
and#withRedefinedSuperclass()
. - Error messages have been improved:
- many messages now span multiple lines for improved readability;
- hashCodes are printed (where relevant);
- unexpected exceptions are no longer eaten by EqualsVerifier, so they can be read without calling
#verbose()
; - calls to abstract methods from within
equals
andhashCode
, which cannot be resolved, are now detected and properly reported. (Issue 14)
- EqualsVerifier fails on classes that contain fields whose
equals
methods might throw NullPointerExceptions. (Issue 19) - EqualsVerifier detects recursive data structures where there are none. (Issue 18)
Class
fields throw IllegalAccessError: added prefab value. (Issue 17)
0.5 - 2009-09-01
- EqualsVerifier is now compiled with debug information, so you can step through the source in Eclipse after adding the EqualsVerifier jar to your project. (Issue 11)
- Fields of interface of abstract class types (such as Lists and other Collection types) throw InstantiationError. (Issue 12)
0.4 - 2009-08-29
#withRelaxedEqualExamples()
to verify equality rules that are more relaxed than simple field-by-field comparisons. (Issue 9)
0.3 - 2009-08-01
- EqualsVerifier now recursively instantiates objects so
#withPrefabValues()
is now only needed for actual recursive data structures. (Issue 7)
0.2 - 2009-07-03
- EqualsVerifier now checks if
Arrays.deepEquals()
was used for multidimensional andObject
arrays. (Issue 3) - Optional features are now accessed through a clean enum instead of through lots of different method calls. (Issue 4)
- EqualsVerifier can now be used in unit test frameworks other than JUnit 4. (Issue 5)
- Stack traces are now printed to
System.err
. (Issue 6)
- Can't use the fields are never null feature on classes instantiated with
#forClass()
. (Issue 1)
0.1 - 2009-06-01
You can now use EqualsVerifier!