8254161: Prevent instantiation of EnumSet subclasses through deserialization

Reviewed-by: dfuchs, alanb, rriggs, smarks
This commit is contained in:
Chris Hegarty 2020-10-16 08:09:57 +00:00
parent 3d23bd8e5b
commit 34583ebdfc

View File

@ -480,6 +480,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
}
/**
* Throws {@code InvalidObjectException}.
* @param s the stream
* @throws java.io.InvalidObjectException always
*/
@ -488,4 +489,14 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
throws java.io.InvalidObjectException {
throw new java.io.InvalidObjectException("Proxy required");
}
/**
* Throws {@code InvalidObjectException}.
* @throws java.io.InvalidObjectException always
*/
@java.io.Serial
private void readObjectNoData()
throws java.io.InvalidObjectException {
throw new java.io.InvalidObjectException("Proxy required");
}
}