You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the spotbugs gradle task in a mixed Kotlin/Java project, the task may fail due to the presence of classes containing special characters in their binary name. This is due to Kotlin allowing identifiers (including method names) to be backtick-quoted.
An example of such a class might be (in binary / slashed name format):
com/bla/TestClass$this test calls run() successfully$obj$1"
This class would be an anonymous class existing in the TestClass class in the com.bla package, which is assigned in the `this test calls run()` method, assigned to the obj variable. The rough code that would produce this in Kotlin would be:
package com.bla
// ...
class TestClass{
// ...
fun `this test calls run() successfully`() {
// ...
var obj = object {}
// ...
}
// ...
}
where the var obj = object {} produces the anonymous inner class.
I've identified the root cause of this issue being the edu.umd.cs.findbugs.util.ClassName.isValidClassName(String) method not implementing proper name validation in accordance with section 4.2 of the Java Virtual Machine specification. It appears that this method is being used in a number of different ways and must support all of the following inputs:
dotted class names,
binary (slashed) class names, and
field descriptors.
I've made two commits in the PR that I will attach to this issue:
the first adds test coverage showing the current behaviour and expected behaviour (with some tests failing).
the second makes changes to the isValidClassName() method to make the tests pass.
The text was updated successfully, but these errors were encountered:
When running the spotbugs gradle task in a mixed Kotlin/Java project, the task may fail due to the presence of classes containing special characters in their binary name. This is due to Kotlin allowing identifiers (including method names) to be backtick-quoted.
An example of such a class might be (in binary / slashed name format):
This class would be an anonymous class existing in the
TestClass
class in thecom.bla
package, which is assigned in the`this test calls run()`
method, assigned to theobj
variable. The rough code that would produce this in Kotlin would be:where the
var obj = object {}
produces the anonymous inner class.This Kotlin Playground example shows the described class naming in action.
I've identified the root cause of this issue being the
edu.umd.cs.findbugs.util.ClassName.isValidClassName(String)
method not implementing proper name validation in accordance with section 4.2 of the Java Virtual Machine specification. It appears that this method is being used in a number of different ways and must support all of the following inputs:I've made two commits in the PR that I will attach to this issue:
isValidClassName()
method to make the tests pass.The text was updated successfully, but these errors were encountered: