Skip to content

Commit 06265ee

Browse files
tobias-lippertphilwebb
authored andcommitted
Use pattern variables
See gh-39259
1 parent fe38cb3 commit 06265ee

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ReleaseTrainDependencyVersion.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ public int compareTo(DependencyVersion other) {
6464

6565
@Override
6666
public boolean isUpgrade(DependencyVersion candidate, boolean movingToSnapshots) {
67-
if (!(candidate instanceof ReleaseTrainDependencyVersion)) {
67+
if (!(candidate instanceof ReleaseTrainDependencyVersion candidateReleaseTrain)) {
6868
return true;
6969
}
70-
ReleaseTrainDependencyVersion candidateReleaseTrain = (ReleaseTrainDependencyVersion) candidate;
7170
int comparison = this.releaseTrain.compareTo(candidateReleaseTrain.releaseTrain);
7271
if (comparison != 0) {
7372
return comparison < 0;
@@ -88,10 +87,9 @@ private boolean isSnapshot() {
8887

8988
@Override
9089
public boolean isSnapshotFor(DependencyVersion candidate) {
91-
if (!isSnapshot() || !(candidate instanceof ReleaseTrainDependencyVersion)) {
90+
if (!isSnapshot() || !(candidate instanceof ReleaseTrainDependencyVersion candidateReleaseTrain)) {
9291
return false;
9392
}
94-
ReleaseTrainDependencyVersion candidateReleaseTrain = (ReleaseTrainDependencyVersion) candidate;
9593
return this.releaseTrain.equals(candidateReleaseTrain.releaseTrain);
9694
}
9795

spring-boot-project/spring-boot-tools/spring-boot-properties-migrator/src/main/java/org/springframework/boot/context/properties/migrator/PropertiesMigrationReporter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ private Map<String, List<PropertyMigration>> getMatchingProperties(
127127
new PropertyMigration(match, metadata, determineReplacementMetadata(metadata), false));
128128
}
129129
// Prefix match for maps
130-
if (isMapType(metadata) && propertySource instanceof IterableConfigurationPropertySource) {
131-
IterableConfigurationPropertySource iterableSource = (IterableConfigurationPropertySource) propertySource;
130+
if (isMapType(metadata) && propertySource instanceof IterableConfigurationPropertySource iterableSource) {
132131
iterableSource.stream()
133132
.filter(metadataName::isAncestorOf)
134133
.map(propertySource::getConfigurationProperty)

0 commit comments

Comments
 (0)