Java transient key word method sugar?
•
Java
Why not resolve transients by using annotations instead of introducing keywords?
It seems that the transient keyword does not really provide any native functionality for the language and seems more syntactic to prevent accidental serialization
Did I miss anything?
Solution
The Java transient keyword was added from the first java version, while annotations was later added in version 1.5
In fact, use ad hoc annotation mechanism:
Note that Scala has @ transient and is also volatile:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码