Skip to content

Commit c50bbc4

Browse files
authored
Merge pull request #1070 from jqno/equalsverifier-4
Prepare for release of EqualsVerifier 4.0
2 parents 6152990 + 7102c99 commit c50bbc4

File tree

474 files changed

+6379
-5452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

474 files changed

+6379
-5452
lines changed

.github/dependabot.yml

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ updates:
88
dependencies:
99
patterns:
1010
- "*"
11-
ignore:
12-
- dependency-name: "com.github.spotbugs:*"
1311
- package-ecosystem: "github-actions"
1412
directory: "/"
1513
schedule:

.github/workflows/ci.yml

-12
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
include:
18-
- title: "Supported JDK 8"
19-
experimental: false
20-
cache-id: "jdk8"
21-
java: 8
22-
dist: temurin
23-
flags: "-DdisableStaticAnalysis"
24-
- title: "Supported JDK 11"
25-
experimental: false
26-
cache-id: "jdk11"
27-
java: 11
28-
dist: temurin
29-
flags: "-DdisableStaticAnalysis"
3018
- title: "Supported JDK 17"
3119
experimental: false
3220
cache-id: "jdk17"

.github/workflows/pitest-comment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ jobs:
4040
# The updatePR maven goal is used here with an explicit version. This allows us to upload without checking out
4141
# the code, but does mean the version here must be maintained. An alternative would be to checkout the code and use
4242
# the github goal. This will work as long as the artifact is extracted to the maven target directory
43-
run: mvn -DrepoToken=${{ secrets.GITHUB_TOKEN }} com.arcmutate:pitest-github-maven-plugin:2.1.0:updatePR
43+
run: mvn -DrepoToken=${{ secrets.GITHUB_TOKEN }} pitest-github-maven-plugin:updatePR

.github/workflows/pitest.yml

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
with:
2424
# important to set a fetch depth of 2. By default the checkout action make no history available
2525
fetch-depth: 2
26-
2726
- name: Cache Maven repository
2827
uses: actions/cache@v4
2928
with:

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
uses: jreleaser/release-action@v2
4343
with:
4444
setup-java: false
45-
version: 1.17.0
45+
version: 1.18.0
4646
env:
4747
JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }}
4848
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}

CHANGELOG.md

+32-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,42 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
- Jump to [version 4.x](#4.x)
89
- Jump to [version 3.x](#3.x)
910
- Jump to [version 2.x](#2.x)
1011
- Jump to [version 1.x](#1.x)
1112

12-
<a name="3.x"/>
13+
<a name="4.x"/>
1314

1415
## [Unreleased]
1516

17+
If you're upgrading from EqualsVerifier 3.x, please see the [migration guide](http://jqno.nl/equalsverifier/migration3to4).
18+
19+
### Added
20+
21+
- Mockito integration: if Mockito is on the classpath or modulepath, EqualsVerifier will use it to instantiate values. This reduces the need for providing prefab values. If Mockito is not available, or if `EqualsVerifier.set(Mode.skipMockito())` is used, EqualsVerifier will fall back to its previous behaviour.
22+
- `forExamples(T red, T blue)` as an alternative to `forClass()` or `forPackage()`. Give it two instances of a type, and it will test that type using the values already present in the fields of the instances. This way, you don't have to use `withPrefabValues` anymore.
23+
- Prefab value for `java.util.HexFormat`. ([Issue 981](https://github.com/jqno/equalsverifier/issues/981))
24+
25+
### Changed
26+
27+
- EqualsVerifier now requires Java 17.
28+
- EqualsVerifier is now properly modularized according to the JPMS.
29+
- When using EqualsVerifier as a module, it's no longer needed to `requires net.bytebuddy` (this is now a proper transitive requirement).
30+
- Improved error message when ClassCastException is encountered.
31+
32+
### Removed
33+
34+
- Built-in prefab values for Google Guava, Joda-Time and Javafx.
35+
- `#withResetCaches()`, which was deprecated since version 3.16.2.
36+
- `Warning.ZERO_FIELDS`, which was deprecated since version 3.17.
37+
- `forPackage(String packageName, boolean scanRecursively)`, which was deprecated since version 3.19.
38+
- `forPackage(String packageName, Class<?> mustExtend)`, which was deprecated since version 3.19.
39+
- `forPackage(...).except(Class<?>... types)`, which was deprecated since version 3.19.
40+
- `forPackage(...).except(Predicate<Class<?>>... exclusionPredicate)`, which was deprecated since version 3.19.
41+
42+
<a name="3.x"/>
43+
1644
## [3.19.4] - 2025-04-30
1745

1846
### Fixed
@@ -42,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4270

4371
- Bug in `withPrefabValueForField` where in some cases the prefab value is not used.
4472

73+
<a name="ScanOption"/>
4574
## [3.19] - 2025-02-06
4675

4776
### Added
@@ -671,7 +700,7 @@ If you're upgrading from EqualsVerifier 2.x, please see the [migration guide](ht
671700
### Added
672701

673702
- Full support for Java 11. ([Issue 197](https://github.com/jqno/equalsverifier/issues/197))
674-
- Re-usable EqualsVerifier configurations: see [the manual](http://jqno.nl/equalsverifier/manual/reusing-configurations).
703+
- Re-usable EqualsVerifier configurations: see [the manual](http://jqno.nl/equalsverifier/manual/several-classes-at-once).
675704
- `#report()` method to ask EqualsVerifier for a report, instead of making it fail a test.
676705
- `#withGenericPrefabValues()` method added to supply values for specific generic types: see [here](http://jqno.nl/equalsverifier/errormessages/recursive-datastructure#generics).
677706

@@ -1329,7 +1358,7 @@ Please don't use version 1.3; [it's a broken release](https://jqno.nl/post/2013/
13291358

13301359
### Added
13311360

1332-
- `#withRelaxedEqualExamples()` to verify equality rules that are more relaxed than simple field-by-field comparisons. ([Issue 9](https://github.com/jqno/equalsverifier/issues/9))
1361+
- `#forRelaxedEqualExamples()` to verify equality rules that are more relaxed than simple field-by-field comparisons. ([Issue 9](https://github.com/jqno/equalsverifier/issues/9))
13331362

13341363
## [0.3] - 2009-08-01
13351364

README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,16 @@ To build EqualsVerifier, you need [Maven](https://maven.apache.org/). Just call
7575

7676
There are several Maven profiles that can be enabled or disabled:
7777

78-
| profile | activation | purpose |
79-
| ---------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
80-
| `modules-jdk8` | JDK 8 up to but not including 11 | Build only the modules that are compatible with Java 8 and up. |
81-
| `modules-jdk11` | JDK 11 up to but not including 16 | Build only the modules that are compatible with Java 11 and up. |
82-
| `modules-jdk16` | JDK 16 | Build only the modules that are compatible with Java 16 and up. |
83-
| `modules-jdk17` | JDK 17 and up | Build all modules and build releaseable artifacts. |
84-
| `static-analysis` | JDK 17 and up, _and_ `disableStaticAnalysis` property must be off | Run static analysis checks. This only happens on a recent JDK. Can be disabled by running `mvn verify -DdisableStaticAnalysis` |
85-
| `release-verification` | JDK 17 and up, _and_ `disableReleaseVerification` property must be off | Run release verification checks. This only happens on a recent JDK. Can be disabled by running `mvn verify -DdisableReleaseVerification` |
86-
| `argline-preview` | `preview` property must be on | Enable Java preview features. Can be activated by running `mvn verify -Dpreview` |
87-
| `argline-experimental` | `experimental` property must be on | Enables ByteBuddy experimental features; useful for testing EqualsVerifier on Early Access JDK builds. Can be activated by running `mvn verify -Dexperimental` |
88-
| `pitest` | `pitest` property must be on | Used by PITest integration on GitHub. Can be activated by running `mvn verify -Dpitest` |
78+
| profile | activation | purpose |
79+
| ------------------------------ | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
80+
| `modules-jdk17` | JDK 17 up to 20 | Build all modules and build releasable artifacts. |
81+
| `modules-jdk21` | JDK 21 and up | Build all modules and build releasable artifacts. |
82+
| `static-analysis` | `disableStaticAnalysis` property must be off | Run static analysis checks. This only happens on a recent JDK. Can be disabled by running `mvn verify -DdisableStaticAnalysis`. |
83+
| `static-analysis-checkstyle` | - | Run Checkstyle checks, for Checkstyle's regression CI. |
84+
| `argline-preview` | `preview` property must be on | Enable Java preview features. Can be activated by running `mvn verify -Dpreview`. |
85+
| `argline-experimental` | `experimental` property must be on | Enables ByteBuddy experimental features; useful for testing EqualsVerifier on Early Access JDK builds. Can be activated by running `mvn verify -Dexperimental` |
86+
| `pitest` | `pitest` property must be on | Used by PITest integration on GitHub. Can be activated by running `mvn verify -Dpitest`. |
87+
| `modules-jdk21-without-pitest` | JDK 21 and up, _and_ `pitest` property must be off | Like `modules-jdk21`, but with additional verifications that are incompatible with PITest. |
8988

9089
## Formatting
9190

@@ -101,15 +100,16 @@ Here's a description of the modules:
101100
| ----------------------------- | --------------------------------------------------------------------- |
102101
| docs | project's Jekyll website |
103102
| equalsverifier-core | the actual EqualsVerifier code |
104-
| equalsverifier-11 | logic for modules, tests for Java 11 and up |
105-
| equalsverifier-16 | logic for records, and corresponding tests |
106-
| equalsverifier-17 | logic for sealed classes, and corresponding tests |
107103
| equalsverifier-21 | tests for record pattern matching |
104+
| equalsverifier-testhelpers | shared types and helpers for use in tests |
105+
| equalsverifier-test | integration tests (without access to Mockito) |
106+
| equalsverifier-test-jpms | tests for the Java module system (with access to Mockito) |
107+
| equalsverifier-test-kotlin | tests for Kotlin classes |
108+
| equalsverifier-test-mockito | tests for instantiation using Mockito |
108109
| equalsverifier-aggregator | generic release assembly description, and shared jacoco configuration |
109110
| equalsverifier-release-main | release assembly for jar with dependencies |
110111
| equalsverifier-release-nodep | release assembly for fat jar (with dependencies shaded in) |
111112
| equalsverifier-release-verify | validation tests for the releases |
112-
| equalsverifier-test-kotlin | tests for Kotlin classes |
113113

114114
## Signed JAR
115115

@@ -129,10 +129,10 @@ The signed JAR itself can be found in [this repo](https://github.com/jqno/equals
129129

130130
To generate the website
131131

132-
- Using Docker: start the server by running `docker-compose up` or `docker compose run jekyll serve`.
133-
- Using Jekyll: install the Ruby 3.x toolchain and run `bundle exec jekyll serve --watch`
132+
- Using Docker: start the server by running `docker-compose up` or `docker compose run jekyll serve`.
133+
- Using Jekyll: install the Ruby 3.x toolchain and run `bundle exec jekyll serve --watch`
134134

135-
Note that thepage uses the [TilburgsAns](https://www.tilburgsans.nl/) font but references it from the main site at [jqno.nl](https://jqno.nl). In development, it will fall back to a `sans-serif` font. See the font license [here](assets/tilburgsans/Ans%20Font%20License-AFL.pdf).
135+
Note that the page uses the [TilburgsAns](https://www.tilburgsans.nl/) font but references it from the main site at [jqno.nl](https://jqno.nl). In development, it will fall back to a `sans-serif` font. See the font license [here](assets/tilburgsans/Ans%20Font%20License-AFL.pdf).
136136

137137
# Disclaimer
138138

File renamed without changes.

build/checkstyle-config.xml

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
<property name="charset" value="UTF-8"/>
88
<property name="severity" value="error"/>
99

10+
<module name="BeforeExecutionExclusionFileFilter">
11+
<property name="fileNamePattern" value="module\-info\.java$"/>
12+
</module>
13+
1014
<module name="FileLength"/>
1115
<module name="FileTabCharacter"/>
1216
<module name="NewlineAtEndOfFile">

build/eclipse-formatter-config.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
9191
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
9292
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
93-
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
93+
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="1"/>
9494
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
9595
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="16"/>
9696
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
@@ -147,7 +147,7 @@
147147
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="48"/>
148148
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
149149
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
150-
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
150+
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
151151
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/>
152152
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
153153
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>

docs/_manual/14-jpms.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
title: "The Java Platform Module System"
33
permalink: /manual/jpms/
44
---
5-
EqualsVerifier is compatible with the Java Platform Module System (JPMS). However, since it does some reflection, you have to open up some packages. Perhaps you have already done so, as test frameworks like JUnit also require this.
5+
EqualsVerifier supports the Java Platform Module System (JPMS). However, since it does some reflection, you have to open up some packages. Perhaps you have already done so, as test frameworks like JUnit also require this.
66

7-
The recommended approach is to put a `module-info.java` file in your `src/test/java` folder, that copies the content the `module-info.java` file in `src/main/java`. Let's say this is your `src/main/java/module-info.java`:
7+
The recommended approach is to put a `module-info.java` file in your `src/test/java` folder, that mirrors the content the `module-info.java` file in `src/main/java`. Let's say this is your `src/main/java/module-info.java`:
88

99
{% highlight java %}
1010
module my.module {
@@ -20,7 +20,6 @@ open module my.module { // Note: open
2020

2121
requires org.junit.jupiter.api; // For JUnit
2222
requires nl.jqno.equalsverifier; // For EqualsVerifier
23-
requires net.bytebuddy; // Dependency of EqualsVerifier
2423
}
2524
{% endhighlight %}
2625

@@ -33,12 +32,9 @@ module my.module {
3332

3433
requires org.junit.jupiter.api;
3534
requires nl.jqno.equalsverifier;
36-
requires net.bytebuddy;
3735
}
3836
{% endhighlight %}
3937

40-
Note that the line `requires net.bytebuddy` is not necessary if you use the uberjar dependency `equalsverifier-nodep`.
41-
4238
Note that if you do this, and you have model classes or dependencies for model classes in other packages, you will have to open these packages as well, or provide prefab values for these dependencies:
4339

4440
{% highlight java %}
@@ -59,3 +55,4 @@ If the class is accessible, but the class for one of its fields isn't, you will
5955
Field foo of type Bar is not accessible via the Java Module System.
6056
Consider opening the module that contains it, or add prefab values for type Bar.
6157

58+
In those cases, you need to open up their package in `module-info.java` or provide prefab values, as discussed above.

0 commit comments

Comments
 (0)