java-topology/test/langtools/tools/javac/warnings/Serial/Extern.java
russell@unturf.com 0a580b313d undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
2026-03-26 17:11:57 -04:00

52 lines
1.3 KiB
Java

/*
* @test /nodynamiccopyright/
* @bug 8202056
* @compile/ref=Extern.out -XDrawDiagnostics -Xlint:serial Extern.java
* @compile/ref=empty.out -XDrawDiagnostics Extern.java
*/
import java.io.*;
class Extern implements Externalizable {
private static final long serialVersionUID = 42;
// No-arg constructor on an Externalizable class must be public
protected Extern() {}
// ineffectual
private static final ObjectStreamField[] serialPersistentFields = {};
public void writeExternal(ObjectOutput out) throws IOException {
return;
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
return;
}
// ineffectual
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
}
// ineffectual
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
}
// ineffectual
private void readObjectNoData() throws ObjectStreamException {
return;
}
// (possibly) effective
private Object writeReplace() throws ObjectStreamException {
return null;
}
// (possibly) effective
private Object readResolve() throws ObjectStreamException {
return null;
}
}