[MNG-8493] 'serialVersionUID' can be annotated with '@Serial' annotation#2025
[MNG-8493] 'serialVersionUID' can be annotated with '@Serial' annotation#2025RainYuY wants to merge 1 commit intoapache:masterfrom RainYuY:MNG-8493
Conversation
elharo
left a comment
There was a problem hiding this comment.
Honestly this feels like noise to me. I don't think it's important enough to justify the screen real estate it takes
| */ | ||
| public class MavenBaseLogger extends LegacyAbstractLogger { | ||
|
|
||
| @Serial |
There was a problem hiding this comment.
Why does org.slf4j.helpers.AbstractLogger implements Serializable in the first place ?
What's the use case for serialising those ?
There was a problem hiding this comment.
Maybe only the SLF4J team knows the exact use case. My guess is that it might involve transmitting logger objects over a network. However, if AbstractClass implements Serializable, I think we should also define a serialVersionUID.
There was a problem hiding this comment.
Honestly there is none. It's just something developers put in 20 years ago because maybe it would help someone somewhere. Java object serialization isn't much used these days, and Brian Goetz uses it as a canonical example of a really interesting antipattern in software design and development:
https://www.youtube.com/watch?v=n6K_8s3Sx4s
https://www.youtube.com/watch?v=dOgfWXw9VrI&t=1957s
What can I say? It was 1997 and none of us really knew what we were doing yet, Sun included.
Interestingly, some of the initialization issues that make Java serialization dangerous are the same reasons we should move away from field injection with Plexus to constructor injection with Guice.
There was a problem hiding this comment.
I think we can safely remove the serialVersionUID from MavenBaseLogger
There was a problem hiding this comment.
I think so.I have done it.
|
Resolve #9944 |
No description provided.