Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SE_BAD_FIELD with records and spotbugs-4.8.4 #2935

Closed
rovarga opened this issue Apr 10, 2024 · 4 comments
Closed

SE_BAD_FIELD with records and spotbugs-4.8.4 #2935

rovarga opened this issue Apr 10, 2024 · 4 comments

Comments

@rovarga
Copy link
Contributor

rovarga commented Apr 10, 2024

A simple non-serializable record as available here: https://github.com/opendaylight/yangtools/blob/2e257731e354e6cc2fd45a6f6eec79bd01490c07/parser/yang-parser-api/src/main/java/org/opendaylight/yangtools/yang/parser/api/YangLibModule.java triggers:

[ERROR] Low: Class org.opendaylight.yangtools.yang.parser.api.YangLibModule defines non-transient non-serializable instance field source [org.opendaylight.yangtools.yang.parser.api.YangLibModule] In YangLibModule.java SE_BAD_FIELD
[ERROR] Low: Class org.opendaylight.yangtools.yang.parser.api.YangLibModule defines non-transient non-serializable instance field submodules [org.opendaylight.yangtools.yang.parser.api.YangLibModule] In YangLibModule.java SE_BAD_FIELD

with spotbugs-4.8.4. No warning is reported with spotbugs-4.8.3.

@gtoison
Copy link
Contributor

gtoison commented Apr 10, 2024

Does it only happen for these two record fields?
It seems a bit strange indeed that it complains for @NonNull SourceRepresentation source but not for @NonNull SourceIdentifier identifier
I tried reproducing the problem but no luck so far

@rovarga
Copy link
Contributor Author

rovarga commented Apr 10, 2024

Yes, it's only those two, and the reported warnings would be correct, as all the referenced types are Serializable except SourceRepresentation and YangLibSubmodule (and YangLibSubmodule is again a record referencing SourceRepresetation) -- except neither YangLibModule nor YangLibSubmodule are marked as Serializable, which is very weird.

@gtoison
Copy link
Contributor

gtoison commented Apr 10, 2024

Hum, there seems to be some kind of heuristic going on, SpotBugs does this test: if (isSerializable < 0.9)
I'll try to figure out what this code is doing

@hazendaz
Copy link
Member

fixed by #2962

This was referenced May 4, 2024
This was referenced May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants