When -copy
is specified on the command line,
ASN1C will generate overridden clone
methods in Java
code. These methods perform a deep copy.
It is noted by many that writing a good clone()
method is non-trivial, and we found this to be true. In general, users
can expect clone
to act as it is specified in the
Java documentation. The sole exception to this is that
Asn1Enumerated
instances are immutable and will
return themselves rather than a new instance.
The clone
method is provided in the following
form:
@Override public Object clone() throws CloneNotSupportedException { /* ... */ }
When users generate code compatible with the CLDC or Java Micro
Edition, the @Override
annotation is removed.