-
-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive with OptionalAbstractKeyword #879
Comments
I tried to reproduce your error without success. I used your code from the github link (nice project btw). Are you using the latest version of detekt? |
We had some false positives with that rule, I think they should be fixed in RC6.4 or master. |
I overlooked it. He is using RC6-3 actually ;) |
Yes, there is a small blocker preventing me to upgrade at the moment. I searched for old issues but couldn't find anything. I will double check. |
Hi, I am having an issue with this rule with sealed classes. Unless I am mistaken this is okay to do in sealed classes. sealed class Error {
abstract val code: Int
data class Cancelled(override val code: Int = -1) : Error()
data class Network(override val code: Int = -1) : Error()
data class Internal(override val code: Int = 500) : Error()
} I am using the latest RC6-4. An one important remarkt this class is inside an interface. |
Ok, the issue is because the sealed class is inside an interface. If I move it out, it does not complain. |
How does your interface look like? I can't reproduce it with: it("test") {
val code = """
interface Stuff {
sealed class Error {
abstract val code: Int
data class Cancelled(override val code: Int = -1) : Error()
data class Network(override val code: Int = -1) : Error()
data class Internal(override val code: Int = 500) : Error()
}
}
"""
assertThat(subject.lint(code)).hasSize(0)
} |
Do we have any update on this issue? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics. |
Expected Behavior
I have a valid code (pasted below) that shouldn't have this warning. There is no other way of doing this one actually.
Current Behavior
OptionalAbstractKeyword
is warning given below. Theabstract
keyword is not even in aninterface
but in anotherabstract class
that is inside aninterface
.Steps to Reproduce (for bugs)
The code looks like below. It is a
Dagger
component.AndroidInjector.Builder
is abstract.@Component.Builder
is required to be put on anabstract
class.fun build(): AppComponent
is abstract. It is defined inAndroidInjector.Builder
actually. It overrides and modifies the return type.Context
I don't believe I have an error to fix. But other than that the message shown above does not have much information and does not give any additional information about how to fix the issue.
Your Environment
The text was updated successfully, but these errors were encountered: