Revise null-safety contracts in IndexAccessor SPI

When indexing into an object, the target object can never be null.

See gh-26409
See gh-26478
This commit is contained in:
Sam Brannen 2024-03-27 10:24:56 +01:00
parent d91277095a
commit b7c3833732
1 changed files with 4 additions and 4 deletions

View File

@ -68,7 +68,7 @@ public interface IndexAccessor extends TargetedAccessor {
* @throws AccessException if there is any problem determining whether the
* index can be read
*/
boolean canRead(EvaluationContext context, @Nullable Object target, Object index) throws AccessException;
boolean canRead(EvaluationContext context, Object target, Object index) throws AccessException;
/**
* Called to read an index from a specified target object.
@ -81,7 +81,7 @@ public interface IndexAccessor extends TargetedAccessor {
* @throws AccessException if there is any problem reading the index value
*/
// TODO Change return type to TypedValue to avoid package cycle.
ValueRef read(EvaluationContext context, @Nullable Object target, Object index) throws AccessException;
ValueRef read(EvaluationContext context, Object target, Object index) throws AccessException;
/**
* Called to determine if this index accessor is able to write to a specified
@ -93,7 +93,7 @@ public interface IndexAccessor extends TargetedAccessor {
* @throws AccessException if there is any problem determining whether the
* index can be written to
*/
boolean canWrite(EvaluationContext context, @Nullable Object target, Object index) throws AccessException;
boolean canWrite(EvaluationContext context, Object target, Object index) throws AccessException;
/**
* Called to write to an index on a specified target object.
@ -104,7 +104,7 @@ public interface IndexAccessor extends TargetedAccessor {
* @param newValue the new value for the index
* @throws AccessException if there is any problem writing to the index value
*/
void write(EvaluationContext context, @Nullable Object target, Object index, @Nullable Object newValue)
void write(EvaluationContext context, Object target, Object index, @Nullable Object newValue)
throws AccessException;
}