I am using sbt 1.2.6 to compile my project. In my local machine compilation runs fine, but when using travis-ci for testing, the compiler complains that value isBlank is not a member of String
.
You can find the source code here https://github.com/LukeDS-it/webfleet-driver/blob/679dff9877ea1edd403dc6cd3d55a22d5fd5328f/server/src/main/scala/it/ldsoftware/webfleet/driver/services/v1/AggregateService.scala#L138
And the build report here https://travis-ci.com/LukeDS-it/webfleet-driver/builds/92441228
I have no more information to provide. My IDE says that everything is fine, and if I run compile or test in local everything works fine.
What am I missing?
isBlank() vs isEmpty() Both methods are used to check for blank or empty strings in java. The difference between both methods is that isEmpty() method returns true if, and only if, string length is 0. isBlank() method only checks for non-whitespace characters. It does not check the string length.
isBlank() is an instance method that returns true if the string is empty or contains only white space codepoints. This method was introduced in Java 11. If the string contains only white spaces, then applying this method will return true .
Scala Set isEmpty() method with example The isEmpty() method is utilized to test if the set is empty or not. Return Type: It returns true if the set is empty else it returns false.
In Java 11, a new method called isBlank() was added in the String class. The isBlank() method will return true in the below cases: If the string is empty. If the string only contains whitespaces.
After a bit of digging, I had the idea of looking at the JavaDoc for isEmpty
and found out that it says
since: 11
On my machine I was compiling against Java11, whereas on Travis the java version was lower.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With