Skip to content

Latest commit

 

History

History
1418 lines (843 loc) · 71.3 KB

CHANGELOG.md

File metadata and controls

1418 lines (843 loc) · 71.3 KB

Changelog

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.

[3.17.4] - 2024-11-29

  • Fixes bug where the wrong generic type was provided when multiple fields of the same type but with different generic parameters exist. (Issue 1022)

Changed

  • The internal instantiation logic has been further refactored, to be more robust and extensible for future enhancements.

3.17.3 - 2024-11-07

Fixed

  • 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

Fixed

  • It's now possible to pass a subclass of a field's type into #withPrefabValuesForField(). (Issue 1012)

Changed

  • The internal instantiation logic has been further refactored, to be more robust and extensible for future enhancements.

3.17.1 - 2024-10-02

Fixed

  • Instantiates java.sql.Date only when available, so EqualsVerifier no longer throws NoClassDefFoundError 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

Added

  • #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)

Changed

  • The internal instantiation logic has been heavily refactored, to be more robust and extensible for future enhancements.

Deprecated

  • Warning.ZERO_FIELDS: the use case for this Warning is better handled by the new #withPrefabValuesForField method.

3.16.2 - 2024-08-23

Changed

  • 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.

Deprecated

  • withResetCaches() was once needed for use in Quarkus, but caches are now reset automatically on every run.

3.16.1 - 2024-04-03

Fixed

  • IllegalArgumentException argument type mismatch when a field's type has a wildcard generic and the underlying type has a type bound (such as T 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

Added

Changed

  • 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 or null ids are always unequal), so it's more discoverable what to do in that situation. (Issue 932)

3.15.8 - 2024-03-01

Fixed

  • Final entities with @GeneratedValue could not be verified. (Issue 929)

3.15.7 - 2024-02-23

Fixed

  • 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

Fixed

  • Protected JPA entity getters were ignored. (Issue 909)

3.15.5 - 2023-12-22

Changed

  • Check that getters are used for all generated JPA id fields. (Issue 892)

3.15.4 - 2023-11-29

Added

  • 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

Changed

  • Improves error message when packages are not "open" to EqualsVerifier. (Issue 868)

3.15.2 - 2023-09-23

Fixed

  • 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

Fixed

  • For mapped fields in JPA entities, an error was thrown if the getter wasn't used in equals and hashCode even if the field wasn't used at all. (Issue 816)

Changed

  • Improves error messages when calling #withPrefabValues incorrectly.

3.15 - 2023-07-08

Changed

  • 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 suppressing Warning.JPA_GETTER. See the manual page about JPA entities, specifically the section on Materialized fields, for more details.

Added

  • #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

Fixed

  • Adds prefab values for Throwable, Exception and RuntimeException. (Issue 831)

3.14.2 - 2023-05-31

Fixed

  • Adds prefab values for DoubleAdder, DoubleAccumulator, LongAdder and LongAccumulator. (Issue 817)

3.14.1 - 2023-03-16

Fixed

  • Fixes incorrect error message when a sealed type has multiple permitted subtypes. (Issue 786)

3.14 - 2023-02-27

Added

3.13.2 - 2023-02-16

Added

  • Verifies hashCode consistency when String.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

Fixed

  • Warning.SURROGATE_KEY was ignored when @Id annotation is in entity's superclass. (Issue 763)

3.13 - 2023-02-02

Changed

  • Made it possible to suppress both Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY and Warning.SURROGATE_KEY. Note that in some cases when suppressing Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY on a class with a surrogate key, it is now necessary to also explicitly suppress Warning.SURROGATE_KEY (Issue 755)

3.12.4 - 2023-01-28

Changed

  • Automates release procedure using JReleaser and GitHub Actions.

Fixed

  • Added prefab values for java.io.PrintStream. (Issue 753)

3.12.3 - 2022-12-14

Fixed

  • Getters for lazy fields in entities could not be found in a superclass. (Issue 744)

3.12.2 - 2022-12-08

Added

  • Warning.SURROGATE_OR_BUSINESS_KEY for JPA entities that insist on using all fields in equals() and hashCode(), whether they are @Id or not.

Changed

  • Removed duplicated website urls and diagnostic output when using forPackage() or forClasses() and multiple classes have issues.

3.12.1 - 2022-12-02

Changed

  • Improved error message output for objects that throw exceptions in their toString() methods. (Issue 716)

Fixed

  • 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

Added

  • Diagnostic output in all error messages.

Changed

  • 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

Added

  • Verifies Map.Entry's extended hashCode contract. (Issue 603; thanks scordio!)

3.11 - 2022-11-02

Added

  • 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)

Fixed

  • Fix issue when the project path contains whitespaces. (Issue 723; thanks Kobee1203!)

3.10.1 - 2022-07-26

Changed

3.10 - 2022-03-22

Fixed

  • Support records that don't allow 0 values in their fields, with Warning.ZERO_FIELDS. (Issue 613)

3.9.1 - 2022-03-19

Fixed

  • Support null checks in record constructors with Warning.NULL_FIELDS. (Issue 610)
  • Restores javadoc and sources jar files on Maven Central. (Issue 598)

Changed

  • Made submodule dependencies in published pom.xml optional, so the Maven Enforcer Plugin won't complain. (Issue 587)

3.9 - 2022-01-31

Changed

  • EqualsVerifier is now released as a multi-release JAR file, in two variants: equalsverifier and equalsverifier-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

Added

  • Support for Jakarta persistence annotations. (Issue 576; thanks Ahli!)

Fixed

  • Exception when testing sealed classes that redefine equals. (Issue 564)

3.8.2 - 2022-01-04

Fixed

  • 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

Fixed

  • Uncaught NullPointerException in certain cases when a used field throws it. (Issue 552)

3.8 - 2021-12-03

Added

  • 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.

Changed

  • Verifies equality for BigDecimal using compareTo(). (Issue 540; thanks ac183!)

3.7.2 - 2021-10-15

Fixed

  • #forPackage() no longer fails in presence of anonymous or local inner classes. (Issue 517; thanks kilink!)

3.7.1 - 2021-08-13

Fixed

  • Added prefab values for java.util.concurrent.Semaphore. (Issue 476)

3.7 - 2021-07-09

Added

  • Support for Lombok's @EqualsAndHashCode(cacheStrategy = LAZY). (Issue 460; thanks janeisklar!)

3.6.1 - 2021-05-21

Fixed

  • Support for recursion into sub-packages using #forPackage() when combined with #simple(). (Issue 437; thanks Kobee1203!)

3.6 - 2021-04-19

Added

  • Support for recursion into sub-packages using #forPackage(). (Issue 423; thanks Kobee1203!)

Fixed

  • Allows static methods that are named equals. (Issue 417)

3.5.5 - 2021-02-24

Changed

  • Improves performace by reusing Objenesis instance. (Issue 400; thanks selckin!)

Fixed

  • Added prefab values for java.awt.Image. (Issue 399)

3.5.4 - 2021-02-08

Fixed

  • Added prefab values for java.nio.charset.Charset. (Issue 391; thanks sullis!)

3.5.3 - 2021-02-03

Fixed

  • Added prefab values for java.util.DoubleSummaryStatistics, java.util.IntSummaryStatistics and java.util.LongSummaryStatistics. (Issue 385)

3.5.2 - 2021-01-19

Fixed

  • Added prefab values for java.time.Clock. (Issue 384; thanks sullis!)

3.5.1 - 2021-01-05

Changed

  • Website is migrated from gh-pages branch to docs folder to make it more accessible.
  • JDK-specific unit tests, such as the RecordsTest which targets JDK16+, have now been migrated to src/test/javaXX (where XX 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.

Fixed

  • Added prefab values for java.text.NumberFormat and java.text.DecimalFormat. (Issue 379)

3.5 - 2020-10-20

Added

  • Updated support for Java 15's records.

3.4.3 - 2020-09-08

Changed

  • 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)

Fixed

  • 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

Changed

Fixed

  • Added prefab values for java.net.InetSocketAddress. (Issue 336)

3.4.1 - 2020-06-15

Fixed

  • Warning.STRICT_INHERITANCE doesn't take away the requirement to call #usingGetClass() when superclass has fields. (Issue 316)

3.4 - 2020-06-13

Added

  • EqualsVerifier.simple(), which gives you an EqualsVerifier that's not so strict and will immediately approve an equals method generated by your IDE. Under the hood, it suppresses Warning.STRICT_INHERITANCE and Warning.NONFINAL_FIELDS.
  • Initial support for Java 14's records and their new equality invariant.
  • Support for JSR305's ParametersAreNonnullByDefault annotation. (Issue 308)

Changed

  • 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()

Fixed

  • 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

Added

  • 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 an Iterable<Class<?>>. (Issue 271)

3.2 - 2020-05-10

Added

  • 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

Fixed

  • Added prefab values for java.util.OptionalDouble, java.util.OptionalInt, java.util.OptionalLong, java.util.EventObject, java.awt.Font, javax.swing.tree.DefaultMutableTreeNode and java.beans.PropertyChangeSupport. (Issue 286)

3.1.12 - 2020-01-27

Fixed

  • Added prefab values for java.util.Currency. (Issue 268; thanks sullis!)

3.1.11 - 2019-12-26

Changed

  • Error message now shows fully qualified class name. (Issue 261; thanks sullis!)

Fixed

  • Updated Byte-Buddy to support Java 14 EA.

3.1.10 - 2019-09-29

Fixed

  • 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

Changed

  • Fixed spelling of Apache License, Version 2.0. (Issue 241; thanks Vincent!)

Fixed

  • Updated to Byte-Buddy to support Java 13 EA. (Issue 239; thanks William!)

3.1.8 - 2019-04-04

Fixed

  • Testing a class with Guava TypeToken causes AbstractMethodError. (Issue 238)

3.1.7 - 2019-03-15

Changed

3.1.6 - 2019-03-11

Fixed

  • Testing a class with StringBuilder causes StringIndexOutOfBoundsException. (Issue 234)

3.1.5 - 2019-02-18

Fixed

  • Verifying interfaces directly causes NullPointerException. (Issue 232)
  • Improved error messages regarding JPA's @EmbeddedId annotation. (Issue 231)

3.1.4 - 2018-12-31

Added

  • Support for JPA's @EmbeddedId annotation: it is now handled in the same way as @Id. (Issue 228)

3.1.3 - 2018-12-29

Fixed

  • McAfee falsely flags EqualsVerifierBugException as a Exploit-ByteVerify virus. (Issue 229; thanks Matt!)

3.1.2 - 2018-12-26

Fixed

  • Classes or fields with an annotation that contains a primitive array cause ClassCastException. (Issue 227)

3.1.1 - 2018-12-26

Fixed

  • Classes with a method named get() cause StringIndexOutOfBoundsException. (Issue 226)

3.1 - 2018-12-24

Added

  • Support for JPA's @Id and Hibernate's @NaturalId annotations. See the manual for more details. (Issue 225)

Changed

  • 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.

Fixed

  • #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

Fixed

  • An incorrect module-info was shaded into the jar file. (Issue 222)

3.0.2 - 2018-10-31

Fixed

  • java.time fields cause illegal reflective access warning on Java 9+: added prefab values. Issue 217)

3.0.1 - 2018-10-29

Fixed

  • 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.

Added

  • 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.

Changed

  • 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.

Removed

  • 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!)

Fixed

  • 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

Fixed

  • Inet4Address, Inet6Address, java.sql.Date, java.sql.Time and java.sql.Timestamp cause illegal reflective access warnings on Java 9+: added prefab values.

2.5.1 - 2018-08-05

Fixed

  • AssertionError when class under test has stateless fields: you can now use #withIgnoredFields(). (Issue 203)

2.5 - 2018-07-30

Added

  • Warning.ALL_NONFINAL_FIELDS_SHOULD_BE_USED when only the final fields are relevant to your equals method. (Issue 200)

Fixed

  • 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

Fixed

  • Java NIO buffer fields cause Significant field error. (Issue 198)
  • Java 11 compatibility. (Issue 197)

2.4.7 - 2018-06-20

Changed

  • Performance improvements, because part of the processing of annotations is now cached. (Issue 190; thanks Андрей!)

Fixed

  • 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

Fixed

  • An AWT frame pops up while EqualsVerifier is running. (Issue 192)

2.4.5 - 2018-03-20

Changed

  • Updates internal Byte Buddy dependency to support Java 10 GA. (Issue 189; thanks Vincent!)

2.4.4 - 2018-03-12

Changed

  • Initial support for Java 10.
  • Support for building and releasing EqualsVerifier from Java 9.

2.4.3 - 2018-02-03

Fixed

  • Support for Guava 24's Multisets. (Issue 185; thanks Stephan!)

2.4.2 - 2018-01-20

Fixed

  • 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

Fixed

  • 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

Added

  • 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

Fixed

  • 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)

Changed

  • 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

Changed

2.3.1 - 2017-07-03

Changed

  • Non-final equals and hashCode in JPA entities no longer cause an error. (Issue 170)

2.3 - 2017-05-24

Added

  • #withIgnoredAnnotations to disable specific annotations. For instance, you can disable @Nonnull to gain 100% test coverage on equals 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)

Fixed

  • The MANIFEST.MF file is back in the EqualsVerifier jar. (Issue 169)

2.2.2 - 2017-04-03

Fixed

  • 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

Fixed

  • Fields of Map type where a single value enum is used as key. (Issue 166)

2.2 - 2017-01-14

Added

  • #withNonnullFields() to be more specific about which fields may be null. (Issue 134)

Changed

  • Error messages are more helpful.

Fixed

  • Uninitialized static arrays cause NullPointerException. (Issue 165)

2.1.8 - 2016-12-13

Fixed

  • Classes that implement an abstract class that calls an abstract method in its equals or hashCode method, throw AbstractMethodError when EqualsVerifier is called with #usingGetClass(). (Issue 161)

2.1.7 - 2016-11-18

Fixed

  • Single value enums cause Significant fields error. (Issue 157; thanks Stephan!)

2.1.6 - 2016-10-01

Fixed

  • 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

Fixed

  • java.util.Vector and java.util.Stack fields throw ArrayIndexOutOfBoundsException. (Issue 151)

2.1.4 - 2016-07-25

Fixed

  • Full generics support for Guava's Range. (Issue 150; thanks Stephan!)

2.1.3 - 2016-07-17

Fixed

  • Older versions of Google Guava cause ReflectionException. (Issue 149)

2.1.2 - 2016-06-20

Fixed

  • Race condition when EqualsVerifier is run concurrently. (Issue 148; thanks Borys!)

2.1.1 - 2016-06-14

Changed

  • Updated ByteBuddy dependency. (Issue 145; thanks Vincent!)

Fixed

  • In certain situations, for example when running unit tests with coverage in IntelliJ, VerifyErrors are thrown. (Issue 147)

2.1 - 2016-05-22

Added

  • Warning.STRICT_HASHCODE to let EqualsVerifier allow hashCode methods that don't use all the fields that are also used in equals, or even constant hashCodes. (Issue 142)

Fixed

  • Unexpected behaviour when a class's equals or hashCode 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

Fixed

  • Classes that implement an abstract class that calls an abstract method in its equals or hashCode method, throws AbstractMethodError. (Issue 138)
  • javax.naming.Reference throws IllegalStateException on certain JVMs. (Issue 114)

2.0.1 - 2016-03-13

Changed

  • com.google.code.findbugs.annotations dependency now has provided scope. (Issue 135; thanks Stephan!)

Fixed

  • 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.

Added

  • #withIgnoredFields() to disregard specific fields, while expecting all remaining fields to be used in equals.
  • #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 from Object). (Issue 66)
    • Warning.INHERITED_DIRECTLY_FROM_OBJECT to revert back to the old behaviour.

Changed

  • 'All fields should be used' is now the default behaviour. (Issue 65)
  • #forRelaxedEqualExamples() implicitly suppresses Warning.ALL_FIELDS_SHOULD_BE_USED.
  • Suppressing Warning.IDENTICAL_COPY_FOR_VERSIONED_ENTITY implicitly suppresses Warning.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.

Removed

  • Support for Java 6.
  • EqualsVerifier#forExamples(). Use #forClass() or #forRelaxedEqualExamples() instead.
  • EqualsVerifier#debug(). (It didn't do anything anymore, anyway.)

Fixed

  • Referring to the generic contents of containers such as List and Optional in the implementation of equals and hashCode can throw ClassCastException. (Issue 84)

1.7.8 - 2016-12-26

Fixed

  • EqualsVerifier throws RuntimeException when used together with Java 8's -parameters compiler option.

1.7.7 - 2016-01-18

Fixed

  • EqualsVerifier throws NullPointerException when used together with Cobertura. (Issue 132)

1.7.6 - 2015-12-21

Changed

  • EqualsVerifier gives 100% mutation coverage with PIT on your equals and hashCode methods. (Issue 131)

Fixed

  • Implementing an interface that defines equals causes Reflexivity error. (Issue 130)

1.7.5 - 2015-08-29

Changed

  • 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)

Fixed

  • EqualsVerifier throws NullPointerException on singleton enum fields. (Issue 125)

1.7.4 - 2015-08-17

Fixed

  • 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

Changed

  • cachedHashCode field can now have protected or default visibility for #withCachedHashCode(). (Issue 110)
  • Several behind-the-scenes improvements :).

Fixed

  • Static final fields with value null throw NullPointerException. (Issue 116)

1.7.2 - 2015-03-28

Added

  • Support for Eclipse's JDT null annotations, including the Java 8 style type annotations.

Changed

  • All internal dependencies have been updated. (Issue 107)

Fixed

  • Static fields with an empty array throw ArrayIndexOutOfBoundsException. (Issue 106)
  • Several potential bugs, using PIT.

1.7.1 - 2015-03-11

Fixed

  • EqualsVerifier throws Reflexivity errors (which then need to be suppressed with version 1.7's Warning.REFERENCE_EQUALITY) on
    • certain interfaces, and classes which don't redefine equals. (issue 104, comment 6)
    • static final lambda fields. (Issue 105)

1.7 - 2015-03-04

Added

  • #withCachedHashCode() to verify classes that cache their hashCode. (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 of equals on an object field inside the equals method. (Issue 104)
  • Warning.REFERENCE_EQUALITY to suppress the above error. (Issue 104)

Fixed

  • Several Java Collections interface classes, including SortedSet and TreeSet, throw AbstractMethodError: added prefab values. (Issue 103)

1.6 - 2015-01-17

Added

  • 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.
  • 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)

Fixed

  • 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

Changed

  • EqualsVerifier now build with Maven instead of ANT+Ivy.

Fixed

  • 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

Added

  • 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)

Changed

  • Improved error messages when equals or hashCode are themselves abstract.
  • Heavily refactored EqualsVerifier's unit tests to make them easier to find and understand.

Fixed

  • 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 on Object[] fields doesn't work; only Arrays#deepEquals() does. (Issue 94)
  • Using #allFieldsShouldBeUsed() requires overriding equals. (Issue 95; thanks Dean!)

1.4.1 - 2014-03-18

Changed

  • Improved EqualsVerifier's unit tests for reflexivity and symmetry, to catch small mistakes such as the one in Issue 88.

Fixed

  • Verifying an enum causes Identical Copy and Symmetry errors. (Issue 87)

1.4 - 2013-12-27

Added

  • #allFieldsShouldBeUsedExcept() to specifically ignore certain fields. (Issue 82)

Changed

  • EqualsVerifier now covers 100% of your equals and hashCode methods. (FAQ)
  • Error messages around abstract delegation are clearer. This clarifies especially classes that contain Joda-Time LocalDate fields.

Fixed

  • 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

Added

  • 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)

Changed

  • 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)

Fixed

  • Exceptions thrown in #toString() break EqualsVerifier. (Issue 79)
  • java.util.UUID fields cause Recursion error: added prefab value. (Issue 81)

Deprecated

  • #debug(), because relevant exceptions are now included as a cause in the stack trace.

1.3 - 2013-06-09

Please don't use version 1.3; it's a broken release. Use 1.3.1 instead.

1.2 - 2013-03-26

Changed

  • EqualsVerifier no longer fails on single value enums (and hence, singletons), even if they don't count for equals and hashCode. (Issue 74)
  • EqualsVerifier can now be built using Ant 1.9. (Issue 76)

Fixed

  • 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

Changed

  • 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.

Fixed

  • Issue when the class under test has a superclass that has no declarations for equals and hashCode. (Issue 63)
  • No error when using #allFieldsShouldBeUsed() and the class under test has fields, but no declarations for equals and hashCode (and hence doesn't use these fields). (Issue 67)

1.1.3 - 2012-04-21

Fixed

  • #allFieldsShouldBeUsed() includes static fields. EqualsVerifier will now no longer complain if these static fields aren't used in your equals and hashCode 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

Fixed

  • 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

Added

  • Warning.IDENTICAL_COPY, to suppress when you want to use reference equality in an overridden equals method. (Issue 56)

1.1 - 2012-02-11

Added

  • #allFieldsShouldBeUsed() to get a warning if you forgot to include a field in equals or hashCode method. (Issue 53)

Fixed

  • EqualsVerifier passes when you include a reference-equality check (this == obj), followed by an incorrect instanceof check in your equals 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 and Collection fields give unjustified warnings: added prefab values. (Issue 49 and Issue 51)

1.0.2 - 2011-08-14

Changed

  • EqualsVerifier is now in Maven Central! (Issue 36)

Fixed

  • EqualsVerifier passes when you forget to include an instanceof check or a getClass() check in your equals method. (Issue 47)
  • EqualsVerifier throws AbstractMethodError on a class whose superclass has abstract declarations for equals and hashCode. (Issue 48)

1.0.1 - 2011-04-17

Added

  • Warning.ANNOTATION to disable annotation processing. This is useful for dynamically generated classes. (Issue 41)

Fixed

  • 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 or double fields but no equals method. (Issue 44)
  • Throwable and Exception fields cause Recursion error: added prefab values. (Issue 45)

1.0 - 2011-02-23

Added

  • 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 potential NullPointerExceptions 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 for javax.persistence.Entity, not for Entity annotations from other packages. (Issue 37)
    • @Transient: Fields marked with this annotation (again, only from javax.persistence.Transient), will be treated the same as fields marked with Java's transient modifier; i.e., EqualsVerifier will complain if they are used in the equals contract.

Changed

  • EqualsVerifier now shows the name of the field that throws a potential NullPointerException. (Issue 39)

Fixed

  • EqualsVerifier detects recursive data structures where there are none. (Issue 34)
  • BigDecimal and BigInteger fields cause Recursion error: added prefab values. (Issue 34)

0.7 - 2010-11-15

Added

  • #usingGetClass() to test equals methods that use a call to getClass() instead of an instanceof check to determine the type of the object passed in.

Changed

  • EqualsVerifier warns when you use a transient field in your equals or hashCode 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.

Fixed

  • Certain Java API classes, like Date, GregorianCalendar and Pattern, cause Recursion error: added prefab values.
  • Many Javadoc improvements (including the one in Issue 32).

0.6.5 - 2010-08-05

Changed

  • 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 or toString throws something other than a NullPointerException when one of the fields is null, are now more helpful. (Issue 31)

0.6.4 - 2010-06-13

Fixed

  • Error message that a certain field is used in equals but not in hashCode or the other way around, when really Arrays.hashCode() or Arrays.deepHashCode() should have been used. (Issue 27)
  • Many non-nullity errors on toString.

0.6.3 - 2010-05-18

Fixed

  • EqualsVerifier gives hashCode error on classes that don't override equals or hashCode. (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

Fixed

  • Regression with #withPrefabValues() for recursive data structure fields in superclasses. (Issue 20)

0.6.1 - 2010-02-06

Changed

  • Renamed #verbose() to #debug() to access #verify() more quickly using autocompletion in IDEs.

Fixed

  • Regression with #withPrefabValues() for fields which delegate to abstract methods. (Issue 14)

0.6 - 2010-01-30

Changed

  • 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 on EqualsVerifier: #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 and hashCode, which cannot be resolved, are now detected and properly reported. (Issue 14)

Fixed

  • 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

Changed

  • 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)

Fixed

  • Fields of interface of abstract class types (such as Lists and other Collection types) throw InstantiationError. (Issue 12)

0.4 - 2009-08-29

Added

  • #withRelaxedEqualExamples() to verify equality rules that are more relaxed than simple field-by-field comparisons. (Issue 9)

0.3 - 2009-08-01

Changed

  • EqualsVerifier now recursively instantiates objects so #withPrefabValues() is now only needed for actual recursive data structures. (Issue 7)

0.2 - 2009-07-03

Changed

  • EqualsVerifier now checks if Arrays.deepEquals() was used for multidimensional and Object 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)

Fixed

  • 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!