[java-inspection] RedundantStringOperation: String.strip.isEmpty() can be replaced with String.isBlank()

GitOrigin-RevId: 04b4a572ac5b1674aaf87d7145cc82a5c98772dc
This commit is contained in:
Andrey.Cherkasov
2021-09-13 17:02:52 +03:00
committed by intellij-monorepo-bot
parent ef5aae11cc
commit 8964b50053
5 changed files with 87 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
// "Use 'isBlank()' and remove redundant 'strip()' call" "true"
class X {
boolean testStrip(String s) {
return s.isBlank();
}
boolean testStripLeading(String s) {
return s.stripLeading().isEmpty();
}
boolean testStripTrailing(String s) {
return s.stripTrailing().isEmpty();
}
boolean testStripWithComments(String s) {
return s./*1*/strip/*2*/(/*3*/)/*4*/./*5*/isEmpty/*6*/(/*7*/)/*8*/;
}
}

View File

@@ -0,0 +1,18 @@
// "Use 'isBlank()' and remove redundant 'strip()' call" "true"
class X {
boolean testStrip(String s) {
return s.st<caret>rip().isEmpty();
}
boolean testStripLeading(String s) {
return s.stripLeading().isEmpty();
}
boolean testStripTrailing(String s) {
return s.stripTrailing().isEmpty();
}
boolean testStripWithComments(String s) {
return s./*1*/strip/*2*/(/*3*/)/*4*/./*5*/isEmpty/*6*/(/*7*/)/*8*/;
}
}