Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Duration.java
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Instant.java
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/LocalDate.java
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/LocalDateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/LocalTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/MonthDay.java
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/OffsetDateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/OffsetTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Period.java
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ private Object writeReplace() {
* @throws java.io.InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/Year.java
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/YearMonth.java
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
1 change: 1 addition & 0 deletions src/java.base/share/classes/java/time/ZonedDateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,7 @@ private Object writeReplace() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ public int hashCode() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps as future work, it would be technically possible for the serial lint checks to look inside the body of a method like this, notice the method always throws an exception, and elide the warning in that case. (It is a little unfortunate to "penalize" the java.time method for being robust in their serial handing by requiring new suppress warnings.)

Various known enhancements to the serial checking envision that deep inspection of lint checking, as in JDK-7019074.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks @jddarcy, I have created: https://bugs.openjdk.org/browse/JDK-8381637 to address this issue. Are you OK with the PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, would it be easy for Javac to determine a method alwys finishes exceptionally?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep good question, I think so

private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ public int hashCode() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ public int hashCode() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ public int hashCode() {
* @throws InvalidObjectException always
*/
@java.io.Serial
@SuppressWarnings("serial") // this method is not invoked for value classes
private void readObject(ObjectInputStream s) throws InvalidObjectException {
throw new InvalidObjectException("Deserialization via serialization delegate");
}
Expand Down
Loading