6a466fe7ae
8160675: Issue lint warning for non-serializable non-transient instance fields in serializable type Reviewed-by: erikj, sspitsyn, jlahoda, vromero, rriggs, smarks
34 lines
962 B
Java
34 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;
|
|
}
|
|
}
|