jdk-24/test/langtools/tools/javac/warnings/Serial/SerialMethodMods.java
Joe Darcy 6a466fe7ae 8202056: Expand serial warning to check for bad overloads of serial-related methods and ineffectual fields
8160675: Issue lint warning for non-serializable non-transient instance fields in serializable type

Reviewed-by: erikj, sspitsyn, jlahoda, vromero, rriggs, smarks
2021-10-21 21:11:01 +00:00

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;
}
}