Skip to content

Commit 92ecaf1

Browse files
committed
Revise null-safety contracts in IndexAccessor SPI
When indexing into an object, the target object can never be null. See spring-projectsgh-26409 See spring-projectsgh-26478
1 parent 725bf4a commit 92ecaf1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spring-expression/src/main/java/org/springframework/expression/IndexAccessor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public interface IndexAccessor extends TargetedAccessor {
6868
* @throws AccessException if there is any problem determining whether the
6969
* index can be read
7070
*/
71-
boolean canRead(EvaluationContext context, @Nullable Object target, Object index) throws AccessException;
71+
boolean canRead(EvaluationContext context, Object target, Object index) throws AccessException;
7272

7373
/**
7474
* Called to read an index from a specified target object.
@@ -81,7 +81,7 @@ public interface IndexAccessor extends TargetedAccessor {
8181
* @throws AccessException if there is any problem reading the index value
8282
*/
8383
// TODO Change return type to TypedValue to avoid package cycle.
84-
ValueRef read(EvaluationContext context, @Nullable Object target, Object index) throws AccessException;
84+
ValueRef read(EvaluationContext context, Object target, Object index) throws AccessException;
8585

8686
/**
8787
* Called to determine if this index accessor is able to write to a specified
@@ -93,7 +93,7 @@ public interface IndexAccessor extends TargetedAccessor {
9393
* @throws AccessException if there is any problem determining whether the
9494
* index can be written to
9595
*/
96-
boolean canWrite(EvaluationContext context, @Nullable Object target, Object index) throws AccessException;
96+
boolean canWrite(EvaluationContext context, Object target, Object index) throws AccessException;
9797

9898
/**
9999
* Called to write to an index on a specified target object.
@@ -104,7 +104,7 @@ public interface IndexAccessor extends TargetedAccessor {
104104
* @param newValue the new value for the index
105105
* @throws AccessException if there is any problem writing to the index value
106106
*/
107-
void write(EvaluationContext context, @Nullable Object target, Object index, @Nullable Object newValue)
107+
void write(EvaluationContext context, Object target, Object index, @Nullable Object newValue)
108108
throws AccessException;
109109

110110
}

0 commit comments

Comments
 (0)