8251160: Fix "no comment" warnings in java.logging

Add missing documentation to the Serialized Form of Level and LogRecord.

Reviewed-by: lancea, mchung
This commit is contained in:
Daniel Fuchs 2020-08-18 11:37:17 +01:00
parent 74ae13716b
commit daffaa8376
2 changed files with 25 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
package java.util.logging;
import java.io.Serial;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
@ -432,11 +433,20 @@ public class Level implements java.io.Serializable {
return value;
}
@Serial
private static final long serialVersionUID = -8176160795706313070L;
// Serialization magic to prevent "doppelgangers".
// This is a performance optimization.
/**
* Returns a {@code Level} instance with the same {@code name},
* {@code value}, and {@code resourceBundleName} as the deserialized
* object.
* @return a {@code Level} instance corresponding to the deserialized
* object.
*/
@Serial
private Object readResolve() {
// Serialization magic to prevent "doppelgangers".
// This is a performance optimization.
Optional<Level> level = KnownLevel.matches(this);
if (level.isPresent()) {
return level.get();

View File

@ -599,6 +599,10 @@ public class LogRecord implements java.io.Serializable {
* by String values for each parameter. If a parameter is null, then
* a null String is written. Otherwise the output of Object.toString()
* is written.
*
* @param out the {@code ObjectOutputStream} to write to
*
* @throws IOException if I/O errors occur
*/
@Serial
private void writeObject(ObjectOutputStream out) throws IOException {
@ -647,6 +651,14 @@ public class LogRecord implements java.io.Serializable {
* {@code threadID} which may be anything between {@code Integer.MIN_VALUE}
* and {Integer.MAX_VALUE}.
* </ul>
*
* See {@code writeObject} for a description of the serial form.
*
* @param in the {@code ObjectInputStream} to read from
*
* @throws ClassNotFoundException if the class of a serialized object
* could not be found.
* @throws IOException if an I/O error occurs.
*/
@Serial
private void readObject(ObjectInputStream in)