Commit 9ad19349 authored by Phillip Webb's avatar Phillip Webb

Merge pull request #16671 from izeye

* pr/16671:
  Polish defaultElementEquals
  Polish dashIgnoringElementEquals()

Closes gh-16671
parents ec72d287 763d18ca
...@@ -360,12 +360,18 @@ public final class ConfigurationPropertyName ...@@ -360,12 +360,18 @@ public final class ConfigurationPropertyName
i2++; i2++;
} }
} }
while (i2 < l2) { if (i2 < l2) {
if (indexed2) {
return false;
}
do {
char ch2 = Character.toLowerCase(e2.charAt(i, i2++)); char ch2 = Character.toLowerCase(e2.charAt(i, i2++));
if (indexed2 || ElementsParser.isAlphaNumeric(ch2)) { if (ElementsParser.isAlphaNumeric(ch2)) {
return false; return false;
} }
} }
while (i2 < l2);
}
return true; return true;
} }
...@@ -394,13 +400,18 @@ public final class ConfigurationPropertyName ...@@ -394,13 +400,18 @@ public final class ConfigurationPropertyName
i2++; i2++;
} }
} }
boolean indexed2 = e2.getType(i).isIndexed(); if (i2 < l2) {
while (i2 < l2) { if (e2.getType(i).isIndexed()) {
return false;
}
do {
char ch2 = e2.charAt(i, i2++); char ch2 = e2.charAt(i, i2++);
if (indexed2 || ch2 != '-') { if (ch2 != '-') {
return false; return false;
} }
} }
while (i2 < l2);
}
return true; return true;
} }
......
...@@ -632,6 +632,7 @@ public class ConfigurationPropertyNameTests { ...@@ -632,6 +632,7 @@ public class ConfigurationPropertyNameTests {
ConfigurationPropertyName n2 = ConfigurationPropertyName ConfigurationPropertyName n2 = ConfigurationPropertyName
.of("management.metrics.web.server.auto-time-requests"); .of("management.metrics.web.server.auto-time-requests");
assertThat(n1).isNotEqualTo(n2); assertThat(n1).isNotEqualTo(n2);
assertThat(n2).isNotEqualTo(n1);
} }
@Test @Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment