You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EqualsVerifier.forPackage picks up anonymous/local inner classes, which causes verification to fail.
Contrived example, we have a package net.kilink.example with a single class Thing.java, which happens to have methods with inner anonymous and local class referrences:
EqualsVerifier found a problem in class net.kilink.example.Thing$1ThingNameSupplier.
-> Equals is inherited directly from Object.
Suppress Warning.INHERITED_DIRECTLY_FROM_OBJECT to skip this check.
...
EqualsVerifier found a problem in class net.kilink.example.Thing$1.
-> Equals is inherited directly from Object.
Suppress Warning.INHERITED_DIRECTLY_FROM_OBJECT to skip this check.
Note that this happens regardless of whether the anonymous / local class is returned from the method.
This fails even worse in the presence of a Guava / Gson TypeToken anonymous class. I think the package scanner can simply skip anonymous and local classes to work around the issue; the test suite all passes with that change, and I am struggling to think fo a legitimate scenario for scanning these.
The text was updated successfully, but these errors were encountered:
Thinking about it, in practice it can never be a synthetic class, which is a runtime generated class like a proxy. I've just removed the line filtering for synthetic classes altogether.
EqualsVerifier.forPackage picks up anonymous/local inner classes, which causes verification to fail.
Contrived example, we have a package
net.kilink.example
with a single classThing.java
, which happens to have methods with inner anonymous and local class referrences:And then running EqualsVerifier like so:
We end up with the following failures:
Note that this happens regardless of whether the anonymous / local class is returned from the method.
This fails even worse in the presence of a Guava / Gson TypeToken anonymous class. I think the package scanner can simply skip anonymous and local classes to work around the issue; the test suite all passes with that change, and I am struggling to think fo a legitimate scenario for scanning these.
The text was updated successfully, but these errors were encountered: