The current resource key for files and directories (and packages) is the relative path of the file/directory starting from source directories. This leads to the following files considered as duplicates with same key=Main.php:
(sonar.source=src,src2 && sonar.tests=test)
Even if this situation is unlikely to occurs with Java projects, this is already a reported problem with PHP, and will be even more an issue with multi-language support.
The proposed solution is to change key for files and directories to be the relative path starting from the root of the module.
At the same time we should take the opportunity to make key of Java resources consistent with other languages.