Skip to content

Commit f7e1009

Browse files
committed
Use instanceof casting
1 parent a75d201 commit f7e1009

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/util/OrderedComparator.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ public int compare(final AnnotatedElement lhs, final AnnotatedElement rhs) {
5353
}
5454

5555
private static String getName(final AnnotatedElement element) {
56-
if (element instanceof Class<?>) {
57-
return Keys.getName((Class<?>) element);
56+
if (element instanceof Class<?> clazz) {
57+
return Keys.getName(clazz);
5858
}
59-
if (element instanceof Field) {
60-
return Keys.getName((Field) element);
59+
if (element instanceof Field field) {
60+
return Keys.getName(field);
6161
}
62-
if (element instanceof Parameter) {
63-
return Keys.getName((Parameter) element);
62+
if (element instanceof Parameter parameter) {
63+
return Keys.getName(parameter);
6464
}
65-
if (element instanceof Method) {
66-
return Keys.getName((Method) element);
65+
if (element instanceof Method method) {
66+
return Keys.getName(method);
6767
}
68-
if (element instanceof AnnotatedType) {
69-
return Keys.getName((AnnotatedType) element);
68+
if (element instanceof AnnotatedType annotatedType) {
69+
return Keys.getName(annotatedType);
7070
}
7171
return Strings.EMPTY;
7272
}

0 commit comments

Comments
 (0)