Reputation: 81949
In Kotlin, it's possible to name a method using back-ticks like this:
fun `i am a test method`(){
Assert.assertEquals("x", "x")
}
The compiler generates a method with underscores instead of blanks: "i_am_a_test_method", which seems reasonable as the JVM does not permit methods with blanks afaik. How can Junit and/or Gradle report these tests with the back-ticked name though?
Upvotes: 7
Views: 3446
Reputation: 97178
In a Java method descriptor, several characters have a special meaning, namely [
(
)
/
and ;
. The space doesn't have any special meaning, and therefore it can be used directly in a method name; that's exactly what the compiler does. The spaces are not converted to underscores.
Upvotes: 9