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

Minimise usage of Kotlin reflection #1883

Merged
merged 5 commits into from
Sep 3, 2019
Merged

Conversation

3flex
Copy link
Member

@3flex 3flex commented Sep 1, 2019

Remaining usage is in detekt-api (KClass is used in a public API, and there are some property delegates which require it).

@3flex 3flex closed this Sep 1, 2019
Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this improvement.
Why did you close this @3flex ?

@3flex 3flex reopened this Sep 3, 2019
@schalkms schalkms merged commit 29caec9 into detekt:master Sep 3, 2019
@3flex 3flex deleted the less-reflection branch September 3, 2019 21:36
sowmyav24 pushed a commit to sowmyav24/detekt that referenced this pull request Sep 4, 2019
* Remove kotlin-reflect usage in detekt-rules

* detekt-gradle-plugin doesn't use Kotlin reflection

* detekt-rules needs kotlin-reflect for tests

* Remove more class references

* Function should remain internal

/**
* Tests if this element is part of given PsiElement.
*/
fun PsiElement.isPartOf(clazz: KClass<out PsiElement>): Boolean = getNonStrictParentOfType(clazz.java) != null
inline fun <reified T : PsiElement> PsiElement.isPartOf() = getNonStrictParentOfType<T>() != null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I remember that I had to rewrite some psi helpers because the kotlin compiler throw errors because he could not resolve all types or something ...

@arturbosch
Copy link
Member

Just out of curiosity, what was the reasoning for this changes? I see the code is now much more readable :).

@arturbosch arturbosch added this to the 1.0.2 milestone Sep 6, 2019
@3flex
Copy link
Member Author

3flex commented Sep 6, 2019

the code is now much more readable

That was the only reason :) I hope it doesn't reintroduce any bugs.

sowmyav24 pushed a commit to sowmyav24/detekt that referenced this pull request Sep 17, 2019
* Remove kotlin-reflect usage in detekt-rules

* detekt-gradle-plugin doesn't use Kotlin reflection

* detekt-rules needs kotlin-reflect for tests

* Remove more class references

* Function should remain internal
@arturbosch arturbosch modified the milestones: 1.0.2, 1.1.0 Sep 17, 2019
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
* Remove kotlin-reflect usage in detekt-rules

* detekt-gradle-plugin doesn't use Kotlin reflection

* detekt-rules needs kotlin-reflect for tests

* Remove more class references

* Function should remain internal
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
* Remove kotlin-reflect usage in detekt-rules

* detekt-gradle-plugin doesn't use Kotlin reflection

* detekt-rules needs kotlin-reflect for tests

* Remove more class references

* Function should remain internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants