Skip to content
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

Unsafe cast is wrong #1216

Closed
robstoll opened this issue Oct 9, 2018 · 2 comments
Closed

Unsafe cast is wrong #1216

robstoll opened this issue Oct 9, 2018 · 2 comments
Labels
Milestone

Comments

@robstoll
Copy link
Contributor

robstoll commented Oct 9, 2018

Steps to Reproduce (for bugs)

val l : List<String> = mutableListOf()
val l2  = l as MutableList<String>

Expected Behavior

No issue detected

Current Behavior

Detects unsafe cast

Your Environment

There are more issues like the above, following a link to the sonarcloud.io project:
https://sonarcloud.io/project/issues?id=depgraph&resolved=false&rules=external_detekt%3AUnsafeCast

@robstoll
Copy link
Contributor Author

robstoll commented Oct 9, 2018

Ah... I see, I was expecting a different behaviour for the UnsafeCastRule but the reporting is actually as intended. I would consider to rename the rule, unsafe cast sounds like casting a type parameter to something we are not sure of.

@robstoll robstoll closed this as completed Oct 9, 2018
@arturbosch arturbosch added this to the RC10 milestone Nov 2, 2018
@lock
Copy link

lock bot commented Jun 20, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2019
@schalkms schalkms added the rules label Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants