Skip to content

Commit

Permalink
8254161: Prevent instantiation of EnumSet subclasses through deserial…
Browse files Browse the repository at this point in the history
…ization

Reviewed-by: dfuchs, alanb, rriggs, smarks
  • Loading branch information
ChrisHegarty committed Oct 16, 2020
1 parent 3d23bd8 commit 34583eb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/java.base/share/classes/java/util/EnumSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ Object writeReplace() {
}

/**
* Throws {@code InvalidObjectException}.
* @param s the stream
* @throws java.io.InvalidObjectException always
*/
Expand All @@ -488,4 +489,14 @@ private void readObject(java.io.ObjectInputStream s)
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");
}
}

1 comment on commit 34583eb

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 34583eb Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.