Apply "instanceof pattern matching" in spring-context-indexer module
See gh-30067
This commit is contained in:
parent
24de8c6f4c
commit
7766b518d3
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -133,8 +133,8 @@ public class CandidateComponentsIndexer implements Processor {
|
||||||
List<TypeElement> list = new ArrayList<>();
|
List<TypeElement> list = new ArrayList<>();
|
||||||
for (Element element : elements) {
|
for (Element element : elements) {
|
||||||
if ((element.getKind().isClass() || element.getKind() == ElementKind.INTERFACE) &&
|
if ((element.getKind().isClass() || element.getKind() == ElementKind.INTERFACE) &&
|
||||||
element.getModifiers().contains(Modifier.STATIC) && element instanceof TypeElement) {
|
element.getModifiers().contains(Modifier.STATIC) && element instanceof TypeElement te) {
|
||||||
list.add((TypeElement) element);
|
list.add(te);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -73,8 +73,8 @@ class TypeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getQualifiedName(Element element) {
|
private String getQualifiedName(Element element) {
|
||||||
if (element instanceof QualifiedNameable) {
|
if (element instanceof QualifiedNameable qualifiedNameable) {
|
||||||
return ((QualifiedNameable) element).getQualifiedName().toString();
|
return qualifiedNameable.getQualifiedName().toString();
|
||||||
}
|
}
|
||||||
return element.toString();
|
return element.toString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue