Suppress "duplicated class found" error not possible

已回答

Android projects have different build types like "release" and "debug". It's valid to put a class with the same name into the debug and release folder. When both source folders are indexed and imported by the IDE at the same time, then the IDE complains about a duplicated class, what is a false positive. Usually, the IDE doesn't index both build type folders, but this is especially helpful for refactoring. 

At the moment there is no way to suppress this error. To be clear, I'm referring to this check: https://github.com/JetBrains/intellij-community/blob/2d38669630890eff5f1a03a29ce4800bb8287858/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java#L426 

I as a developer should have the option to suppress or disable this error. If I did something wrong, then the compiler would complain anyways. 

0

I can't reproduce the problem. The "debug" and "release" source sets can't be active at the same time.

0
Avatar
Permanently deleted user

Yes, this is correct. But we changed our config for IntelliJ to import both source sets at the same time. We also use Buck (OkBuck) instead of Gradle.

But that's unrelated. What I'm asking for is to have the option to disable the duplicate class error check. Simply put the same class in the same package twice and you should see the error. I want to be able to suppress this error.

0

Why do you need both source sets to be imported at the same time? IMHO it's not a good idea to have project model hacked this way, code insight may work incorrectly.

0
Avatar
Permanently deleted user

We find it to be very helpful for refactoring and finding usages. Very often when you add code to one source directory, you need a counterpart in the other directory. Changing the build type is a very slow process.

0

I'd suggest importing the source sets as separate modules.

 

0

请先登录再写评论。