Skip to content

Commit cff5653

Browse files
jzheauxmheath
authored andcommitted
Address Checkstyle
Issue gh-17447 Signed-off-by: Josh Cummings <[email protected]>
1 parent 0b963d3 commit cff5653

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

core/src/main/java/org/springframework/security/core/annotation/ExpressionTemplateSecurityAnnotationScanner.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
* {@code @HasRole} annotation found on a given {@link AnnotatedElement}.
6060
*
6161
* <p>
62-
* Meta-annotations that use enum values can use {@link ExpressionTemplateValueProvider} to
63-
* provide custom placeholder values.
62+
* Meta-annotations that use enum values can use {@link ExpressionTemplateValueProvider}
63+
* to provide custom placeholder values.
6464
*
6565
* <p>
6666
* Since the process of synthesis is expensive, it is recommended to cache the synthesized
@@ -176,8 +176,8 @@ public Set<ConvertiblePair> getConvertibleTypes() {
176176
}
177177

178178
@Override
179-
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
180-
return (source != null) ? ((ExpressionTemplateValueProvider)source).getExpressionTemplateValue() : null;
179+
public @Nullable Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
180+
return (source != null) ? ((ExpressionTemplateValueProvider) source).getExpressionTemplateValue() : null;
181181
}
182182

183183
}

core/src/main/java/org/springframework/security/core/annotation/ExpressionTemplateValueProvider.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2004-present the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.springframework.security.core.annotation;
218

319
/**
@@ -20,14 +36,13 @@
2036
* }
2137
* </pre>
2238
*
23-
* @since 6.5
2439
* @author Mike Heath
40+
* @since 7.0
2541
*/
2642
public interface ExpressionTemplateValueProvider {
2743

2844
/**
2945
* Returns the value to be used in an expression template.
30-
*
3146
* @return the value to be used in an expression template
3247
*/
3348
String getExpressionTemplateValue();

core/src/test/java/org/springframework/security/core/annotation/ExpressionTemplateSecurityAnnotationScannerTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ void parseMetaSourceAnnotationWithEnumImplementingExpressionTemplateValueProvide
6262
}
6363

6464
enum Permission implements ExpressionTemplateValueProvider {
65-
READ,
66-
WRITE;
65+
66+
READ, WRITE;
6767

6868
@Override
6969
public String getExpressionTemplateValue() {
@@ -72,6 +72,7 @@ public String getExpressionTemplateValue() {
7272
case WRITE -> "'user.WRITE'";
7373
};
7474
}
75+
7576
}
7677

7778
@Documented
@@ -89,6 +90,7 @@ public String getExpressionTemplateValue() {
8990
@Target({ ElementType.TYPE, ElementType.METHOD })
9091
@HasAnyCustomPermissions(permissions = { Permission.READ, Permission.WRITE })
9192
@interface HasAllCustomPermissions {
93+
9294
}
9395

9496
@Documented

0 commit comments

Comments
 (0)