Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
We have GString but not String variants for take and drop.
@groovy.transform.CompileStatic def method() { assert 'Foo Bar'.drop(4).toLowerCase() == 'bar' assert 'Foo Bar'.take(3).toLowerCase() == 'foo' } method()
You are required to add some superfluous .toString() calls otherwise you get the following errors:
2 compilation errors: [Static type checking] - Cannot find matching method java.lang.CharSequence#toLowerCase(). Please check if the declared type is correct and if the method exists. at line: 3, column: 12 [Static type checking] - Cannot find matching method java.lang.CharSequence#toLowerCase(). Please check if the declared type is correct and if the method exists. at line: 4, column: 12