Skip to content

Commit 9851202

Browse files
authored
Merge pull request #32 from csense-oss/2.1.3
2.1.3
2 parents 4351341 + bc5bc7c commit 9851202

File tree

7 files changed

+26
-102
lines changed

7 files changed

+26
-102
lines changed

build.gradle.kts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
val javaVersion = "11"
1111

1212
group = "csense-idea"
13-
version = "2.1.2"
13+
version = "2.1.3"
1414

1515
intellij {
1616
updateSinceUntilBuild.set(false)
@@ -35,7 +35,7 @@ dependencies {
3535
//https://github.com/csense-oss/csense-kotlin-annotations
3636
implementation("csense.kotlin:csense-kotlin-annotations-jvm:0.0.63")
3737
//https://github.com/csense-oss/idea-kotlin-shared-base
38-
implementation("csense.idea.base:csense-idea-base:0.1.63")
38+
implementation("csense.idea.base:csense-idea-base:0.1.65")
3939
//https://github.com/Kotlin/kotlinx.serialization
4040
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
4141
//https://github.com/Kotlin/kotlinx.coroutines
@@ -49,11 +49,8 @@ dependencies {
4949
tasks.getByName<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
5050
changeNotes.set(
5151
"""
52-
Fixes
5352
<ul>
54-
<li> Fixes a lot of issues with respect to throw expressions (also causes a thrown exception to be interpreted as Exception https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/26 )</li>
55-
<li> QuickFixes (CSense detects Throws annotation only if lambda provides callsInPlace contract https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/27) </li>
56-
<li> Method references are now resolved (method references are not marked https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/28) </li>
53+
<li>Fix for bad wrap in try catch (https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/31) </li>
5754
</ul>
5855
"""
5956
)

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 2.1.3
2+
- Fixed a bug in wrap in try catch (copping off code) https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/31
3+
-
14
# 2.1.2
25
- Fixes a lot of issues with respect to throw expressions (also causes a thrown exception to be interpreted as Exception https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/26 )
36
- QuickFixes (CSense detects Throws annotation only if lambda provides callsInPlace contract https://github.com/csense-oss/idea-kotlin-checked-exceptions/issues/27)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-rc-1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/kotlin/csense/idea/kotlin/checked/exceptions/bll/files/CachedFileInMemory.kt

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/main/kotlin/csense/idea/kotlin/checked/exceptions/bll/files/CachedFqNameFunctionParameterStorage.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package csense.idea.kotlin.checked.exceptions.bll.files
22

33
import com.intellij.openapi.project.*
4+
import csense.idea.base.files.*
45
import csense.kotlin.extensions.*
56
import csense.kotlin.extensions.collections.*
67
import java.nio.file.*

src/main/kotlin/csense/idea/kotlin/checked/exceptions/quickfixes/wrap/WrapInTryCatchQuickFix.kt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,19 @@ class WrapInTryCatchQuickFix(
2121
)
2222
}
2323

24+
@Throws(com.intellij.util.IncorrectOperationException::class)
2425
override fun tryUpdate(project: Project, file: PsiFile, element: KtCallExpression): PsiElement {
25-
val newElement: KtExpression = createTryCatchWithElement(element, forFile = file)
26-
return element.replace(newElement)
26+
val top: KtElement = element.resolveToTop()
27+
val newElement: KtExpression = createTryCatchWithElement(top, forFile = file)
28+
return top.replace(newElement)
29+
}
30+
31+
private fun KtCallExpression.resolveToTop(): KtElement {
32+
val parent: PsiElement? = parent
33+
if (parent is KtDotQualifiedExpression) {
34+
return parent
35+
}
36+
return this
2737
}
2838

2939

@@ -68,5 +78,4 @@ fun KtPsiClass.catchParameterCode(forFile: PsiFile): String {
6878
}
6979
""".trimIndent()
7080
return result
71-
}
72-
81+
}

todo.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# missing todos
22

3+
4+
- @Throws on overriden methods that does not declare throws in base interface / class
5+
6+
7+
38
- tell if certain exceptions are NOT thrown but declared.
49
- detect when there are overlaps in catch clauses (e.g. throwable followed by more specific type...)
510
- handle "*arrayOf(exception::class, exception2::class)" ....

0 commit comments

Comments
 (0)