Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

value isBlank is not a member of String

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?

like image 526
Luca Avatar asked Nov 24 '18 18:11

Luca


People also ask

What is the difference between isBlank and isEmpty?

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.

What is isBlank in Java?

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 .

How do you check whether a string is empty or not in Scala?

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.

Which of the following statement is related to the isBlank () method in Java 11?

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.


1 Answers

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.

like image 119
Luca Avatar answered Oct 23 '22 07:10

Luca