Skip to content

Commit b23a7a9

Browse files
[#59] Fix ClassCastException when type argument of immediate class type is a wildcard
1 parent acda60a commit b23a7a9

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
# Axon Framework plugin Changelog
44

5+
## [0.6.2]
6+
7+
### Fixed
8+
- [#59] Fixed ClassCastException during querying provider ClassLineMarkerProvider (thanks @kaleev for reporting the error)
9+
510
## [0.6.1]
611

712
### Fixed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
pluginGroup=io.axoniq.ide.intellij
2121
pluginName=Axon Framework
22-
pluginVersion=0.6.1
22+
pluginVersion=0.6.2
2323

2424
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
2525
# for insight into build numbers and IntelliJ Platform versions.

src/main/kotlin/org/axonframework/intellij/ide/plugin/util/PSiProcessingUtils.kt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ import org.jetbrains.uast.toUElement
4747

4848
/**
4949
* Convenience method to fully qualified name of type.
50-
* Throws if we get a type we do not expect so we can support it.
5150
*/
5251
fun PsiType?.toQualifiedName(): String? = this?.let {
53-
return when (this) {
54-
is PsiClassReferenceType -> this.resolve()?.qualifiedName
55-
// Class<SomeClass> object. Extract the <SomeClass> and call this method recursively to resolve it
56-
is PsiImmediateClassType -> (this.parameters.firstOrNull() as PsiClassType?)?.toQualifiedName()
57-
is PsiWildcardType -> "java.lang.Object"
58-
else -> null
52+
return try {
53+
when (this) {
54+
is PsiClassReferenceType -> this.resolve()?.qualifiedName
55+
// Class<SomeClass> object. Extract the <SomeClass> and call this method recursively to resolve it
56+
is PsiImmediateClassType -> this.parameters.firstOrNull()?.toQualifiedName()
57+
is PsiWildcardType -> "java.lang.Object"
58+
else -> null
59+
}
60+
} catch (e: Exception) {
61+
throw IllegalArgumentException("Was unable to resolve qualifiedName type ${it.canonicalText} due to exception: ${e.message}", e)
5962
}
6063
}
6164

0 commit comments

Comments
 (0)