Skip to content

Commit 5f55ad2

Browse files
committed
Suppress NullAway warning
Signed-off-by: Steve Riesenberg <[email protected]>
1 parent af60d4f commit 5f55ad2

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

core/src/main/java/org/springframework/security/access/expression/SecurityExpressionRoot.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public abstract class SecurityExpressionRoot<T> implements SecurityExpressionOpe
8181
*/
8282
@Deprecated(since = "7.0")
8383
public SecurityExpressionRoot(Authentication authentication) {
84-
this(() -> authentication);
84+
this(() -> authentication, null);
8585
}
8686

8787
/**
@@ -94,12 +94,7 @@ public SecurityExpressionRoot(Authentication authentication) {
9494
*/
9595
@Deprecated(since = "7.0")
9696
public SecurityExpressionRoot(Supplier<Authentication> authentication) {
97-
this.authentication = SingletonSupplier.of(() -> {
98-
Authentication value = authentication.get();
99-
Assert.notNull(value, "Authentication object cannot be null");
100-
return value;
101-
});
102-
this.object = null;
97+
this(authentication, null);
10398
}
10499

105100
/**
@@ -110,7 +105,7 @@ public SecurityExpressionRoot(Supplier<Authentication> authentication) {
110105
* @param object the object being authorized
111106
* @since 7.0
112107
*/
113-
public SecurityExpressionRoot(Supplier<Authentication> authentication, T object) {
108+
public SecurityExpressionRoot(Supplier<Authentication> authentication, @Nullable T object) {
114109
this.authentication = SingletonSupplier.of(() -> {
115110
Authentication value = authentication.get();
116111
Assert.notNull(value, "Authentication object cannot be null");
@@ -174,7 +169,7 @@ public final boolean isFullyAuthenticated() {
174169
return isGranted(this.authorizationManagerFactory.fullyAuthenticated());
175170
}
176171

177-
@SuppressWarnings("DataFlowIssue")
172+
@SuppressWarnings({ "DataFlowIssue", "NullAway" })
178173
private boolean isGranted(AuthorizationManager<T> authorizationManager) {
179174
AuthorizationResult authorizationResult = authorizationManager.authorize(this.authentication, this.object);
180175
return (authorizationResult != null && authorizationResult.isGranted());

0 commit comments

Comments
 (0)