58 lines
1.3 KiB
Plaintext
58 lines
1.3 KiB
Plaintext
:operationName: method
|
|
:visibility: private
|
|
|
|
include::../why.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
public class Foo implements Serializable
|
|
{
|
|
public static void doSomething() {
|
|
Foo foo = new Foo();
|
|
...
|
|
}
|
|
|
|
private void unusedPrivateMethod() {...}
|
|
private void writeObject(ObjectOutputStream s) {...} //Compliant, relates to the java serialization mechanism
|
|
private void readObject(ObjectInputStream in) {...} //Compliant, relates to the java serialization mechanism
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java,diff-id=1,diff-type=compliant]
|
|
----
|
|
public class Foo implements Serializable
|
|
{
|
|
public static void doSomething(){
|
|
Foo foo = new Foo();
|
|
...
|
|
}
|
|
|
|
private void writeObject(ObjectOutputStream s) {...} //Compliant, relates to the java serialization mechanism
|
|
private void readObject(ObjectInputStream in) {...} //Compliant, relates to the java serialization mechanism
|
|
}
|
|
----
|
|
|
|
include::../exceptions-jvm.adoc[]
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|