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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.