Skip to content

Commit 74f76ea

Browse files
committed
Add CFComment for TemporalQuery and TemporalAccessor.
1 parent d0c98b0 commit 74f76ea

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/java.base/share/classes/java/time/temporal/TemporalAccessor.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363

6464
import org.checkerframework.checker.nullness.qual.Nullable;
6565
import org.checkerframework.framework.qual.AnnotatedFor;
66+
import org.checkerframework.framework.qual.CFComment;
6667

6768
import java.time.DateTimeException;
6869
import java.util.Objects;
@@ -309,6 +310,8 @@ default int get(TemporalField field) {
309310
* @throws DateTimeException if unable to query
310311
* @throws ArithmeticException if numeric overflow occurs
311312
*/
313+
@CFComment({"nullness: TemporalQuery promises that this is equivalent to query.queryFrom, so "
314+
+ "it returns plain R, just like that method."})
312315
default <R> R query(TemporalQuery<R> query) {
313316
if (query == TemporalQueries.zoneId()
314317
|| query == TemporalQueries.chronology()

src/java.base/share/classes/java/time/temporal/TemporalQuery.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
package java.time.temporal;
6363

6464
import org.checkerframework.framework.qual.AnnotatedFor;
65+
import org.checkerframework.framework.qual.CFComment;
6566

6667
import java.time.DateTimeException;
6768

@@ -143,6 +144,8 @@ public interface TemporalQuery<R> {
143144
* @throws DateTimeException if unable to query
144145
* @throws ArithmeticException if numeric overflow occurs
145146
*/
147+
@CFComment({"nullness: This is a function object, so we return plain R to distinguish between "
148+
+ "instances that can return null and those that cannot."})
146149
R queryFrom(TemporalAccessor temporal);
147150

148151
}

0 commit comments

Comments
 (0)