java-topology/test/langtools/tools/javac/warnings/Serial/SerialMethodMods.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

33 lines
962 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8202056
* @compile/ref=SerialMethodMods.out -XDrawDiagnostics -Xlint:serial SerialMethodMods.java
*/
import java.io.*;
abstract class SerialMethodMods implements Serializable {
private static final long serialVersionUID = 42;
// Should be private
void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
}
// Should be private
public void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
}
// Should be concrete instance method
private static void readObjectNoData() throws ObjectStreamException {}
// Should be concrete instance method
public abstract Object writeReplace() throws ObjectStreamException;
// Should be concrete instance method
public static Object readResolve() throws ObjectStreamException {
return null;
}
}