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.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8202056
|
||||
* @compile/ref=InterfaceNonPrivateMethods.out -XDrawDiagnostics -Xlint:serial InterfaceNonPrivateMethods.java
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
|
||||
// Holder class
|
||||
class InterfaceNonPrivateMethods {
|
||||
|
||||
interface NonPrivateMethods extends Serializable {
|
||||
public void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException;
|
||||
public void readObjectNoData() throws ObjectStreamException;
|
||||
public void writeObject(ObjectOutputStream stream) throws IOException;
|
||||
|
||||
// Ineffective default methods; serialization only looks up
|
||||
// superclass chain
|
||||
public default Object writeReplace() throws ObjectStreamException {
|
||||
return null;
|
||||
}
|
||||
public default Object readResolve() throws ObjectStreamException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
interface NonPrivateMethodsDefaults extends Serializable {
|
||||
default public void readObject(ObjectInputStream stream)
|
||||
throws IOException, ClassNotFoundException {
|
||||
return;
|
||||
}
|
||||
default public void readObjectNoData()
|
||||
throws ObjectStreamException {
|
||||
return;
|
||||
}
|
||||
default public void writeObject(ObjectOutputStream stream)
|
||||
throws IOException {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue