Summary
Remove "not null" from the specification of the annotation interfaces declared in the jdk.jfr package.
Problem
The annotations DataAmount, Description, Label, Period, Threshold, Throttle, Timespan, and Timestamp in the jdk.jfr package use "not null" in the specification of the value methods. Other annotations in the package, e.g., Name and Category, don't. An annotation can't be null if it's read from a class file, and users shouldn't implement it themselves.
Solution
Remove "not null" from the annotations in the jdk.jfr package to make them consistent with other annotations in the JDK. To make the documentation consistent in the package, also describe the default value where applicable.
Specification
/src/jdk.jfr/share/classes/jdk/jfr/DataAmount.java
/**
* Returns the unit for the data amount, by default bytes.
*
- * @return the data amount unit, default {@code BYTES}, not {@code null}
+ * @return the data amount unit, default {@code BYTES}
*/
String value() default BYTES;
}
src/jdk.jfr/share/classes/jdk/jfr/Description.java
/**
* Returns a sentence or two that describes the annotated element.
*
- * @return a description, not {@code null}
+ * @return a description
*/
String value();
}
/src/jdk.jfr/share/classes/jdk/jfr/Label.java b/src/jdk.jfr/share/classes/jdk/jfr/Label.java
/**
* Returns a human-readable name for the annotated element.
*
- * @return a human-readable name, not {@code null}
+ * @return a human-readable name
*/
String value();
}
src/jdk.jfr/share/classes/jdk/jfr/Period.java
* least once for every recording file. The number of events that are emitted
* depends on how many times the file rotations occur when data is recorded.
*
- * @return the default setting value, not {@code null}
+ * @return the default setting value, default {@code "everyChunk"}
*/
String value() default "everyChunk";
}
src/jdk.jfr/share/classes/jdk/jfr/Threshold.java b/src/jdk.jfr/share/classes/jdk/jfr/Threshold.java
* <p>
* Example values are {@code "0 ns"}, {@code "10 ms"}, and {@code "1 s"}.
*
- * @return the threshold, default {@code "0 ns"}, not {@code null}
+ * @return the threshold, default {@code "0 ns"}
*/
String value() default "0 ns";
}
src/jdk.jfr/share/classes/jdk/jfr/Throttle.java b/src/jdk.jfr/share/classes/jdk/jfr/Throttle.java
* <p>
* Specifying {@code "off"} (case-sensitive) results in all events being emitted.
*
- * @return the throttle value, default {@code "off"} not {@code null}
+ * @return the throttle value, default {@code "off"}
*/
String value() default "off";
}
src/jdk.jfr/share/classes/jdk/jfr/Timespan.java b/src/jdk.jfr/share/classes/jdk/jfr/Timespan.java
* <p>
* By default, the unit is nanoseconds.
*
- * @return the time span unit, default {@link #NANOSECONDS}, not {@code null}
+ * @return the time span unit, default {@code NANOSECONDS}
*/
String value() default NANOSECONDS;
}
src/jdk.jfr/share/classes/jdk/jfr/Timestamp.java b/src/jdk.jfr/share/classes/jdk/jfr/Timestamp.java
/**
* Unit for the time stamp.
*
- * @return time stamp unit, not {@code null}
+ * @return time stamp unit, default {@code MILLISECONDS_SINCE_EPOCH}
*/
String value() default Timestamp.MILLISECONDS_SINCE_EPOCH;
}
- csr of
-
JDK-8358602 JFR: Annotations in jdk.jfr package should not use "not null" in specification
-
- Resolved
-
- relates to
-
JDK-8359389 Allow default value of an annotation member to be reference in javadoc
-
- New
-