
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
40 lines
917 B
Plaintext
40 lines
917 B
Plaintext
== Why is this an issue?
|
|
|
|
An ``++Externalizable++`` class is one which handles its own ``++Serialization++`` and deserialization. During deserialization, the first step in the process is a default instantiation using the class' no-argument constructor. Therefore an ``++Externalizable++`` class without a no-arg constructor cannot be deserialized.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
public class Tomato implements Externalizable { // Noncompliant; no no-arg constructor
|
|
|
|
public Tomato (String color, int weight) { ... }
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
public class Tomato implements Externalizable {
|
|
|
|
public Tomato() { ... }
|
|
public Tomato (String color, int weight) { ... }
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Add a no-arg constructor to this class.
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|