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

40 lines
1.3 KiB
Java

/*
* @test /nodynamiccopyright/
* @bug 8202056
* @compile/ref=SerialMethodArity.out -XDrawDiagnostics -Xlint:serial SerialMethodArity.java
*/
import java.io.*;
class SerialMethodMods implements Serializable {
private static final long serialVersionUID = 42;
private static class CustomObjectOutputStream extends ObjectOutputStream {
public CustomObjectOutputStream() throws IOException,
SecurityException {}
}
// Should have a single parameter of exact type ObjectOutputStream
private void writeObject(CustomObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
}
// Should have a single parameter of exact type ObjectInputStream
private void readObject(ObjectInputStream stream, int retries)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
}
// Should have no arguments
private void readObjectNoData(int retries) throws ObjectStreamException {}
// Should have no arguments
public Object writeReplace(int arg0, int arg1) throws ObjectStreamException {
return null;
}
// Should have no arguments
public Object readResolve(double foo, float bar) throws ObjectStreamException {
return null;
}
}