I’m facing an issue with MapDB, a library built with Kotlin, and the fundamental issue seems to be within Kotlin itself.
When analyzing code that uses this bytecode, SonarQube complains that the bytecode is invalid (worse, it actually crashes the analyzer).
Analyzer says “bridge method not marked as synthetic in class XXX”.
From what I can tell, the relevant logic in the Kotlin compiler is in this single line from
int flags = ACC_PUBLIC | ACC_BRIDGE | (!isSpecialOrDelegationToSuper ? ACC_SYNTHETIC : 0) | (isSpecialBridge ? ACC_FINAL : 0); // TODO.
(Notice the trailing “TODO” marker )
So, should all bridge methods be marked as synthetic?
Maybe not, but is it possible that some bridge methods are currently not but should be marked as synthetic?
Is SonarQube wrong?
I found 2 similar issues with other systems that emit JVM bytecode (namely AspectJ and Groovy) and in both cases they were wrong and were fixed.
Thanks for your help,