File tree Expand file tree Collapse file tree 5 files changed +64
-10
lines changed
main/kotlin/org/axonframework/intellij/ide/plugin
test/kotlin/org/axonframework/intellij/ide/plugin/specifics Expand file tree Collapse file tree 5 files changed +64
-10
lines changed Original file line number Diff line number Diff line change 2
2
3
3
# Axon Framework plugin Changelog
4
4
5
+ ## [ 0.6.2]
6
+
7
+ ### Fixed
8
+ - [ #59 ] Fixed ClassCastException during querying provider ClassLineMarkerProvider (thanks @kaleev for reporting the error)
9
+ - Fix various occasions where invalid PsiElements could be shown in line marker popups by filtering on validity
10
+
5
11
## [ 0.6.1]
6
12
7
13
### Fixed
Original file line number Diff line number Diff line change 19
19
20
20
pluginGroup =io.axoniq.ide.intellij
21
21
pluginName =Axon Framework
22
- pluginVersion =0.6.1
22
+ pluginVersion =0.6.2
23
23
24
24
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
25
25
# for insight into build numbers and IntelliJ Platform versions.
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class AxonNavigationGutterIconRenderer(
62
62
63
63
override fun navigateToItems (event : MouseEvent ? ) {
64
64
if (event != null ) {
65
- val elements = PsiUtilCore .toPsiElementArray(targetElements)
65
+ val elements = PsiUtilCore .toPsiElementArray(targetElements.filter { it.isValid } )
66
66
val popup = NavigationUtil .getPsiElementPopup(elements, myCellRenderer.compute(), myPopupTitle)
67
67
popup.show(RelativePoint (event))
68
68
}
@@ -76,7 +76,11 @@ class AxonNavigationGutterIconRenderer(
76
76
{ tooltipText },
77
77
this ,
78
78
alignment,
79
- { elements.value.map { WrappedGoToRelatedItem (it) } }
79
+ {
80
+ elements.value
81
+ .filter { it.element.isValid }
82
+ .map { WrappedGoToRelatedItem (it) }
83
+ }
80
84
)
81
85
}
82
86
}
Original file line number Diff line number Diff line change @@ -47,15 +47,18 @@ import org.jetbrains.uast.toUElement
47
47
48
48
/* *
49
49
* Convenience method to fully qualified name of type.
50
- * Throws if we get a type we do not expect so we can support it.
51
50
*/
52
51
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)
59
62
}
60
63
}
61
64
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2022. Axon Framework
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org.axonframework.intellij.ide.plugin.specifics
18
+
19
+ import org.axonframework.intellij.ide.plugin.AbstractAxonFixtureTestCase
20
+ import org.axonframework.intellij.ide.plugin.util.aggregateResolver
21
+
22
+ class ExceptionCasesTests : AbstractAxonFixtureTestCase () {
23
+ /* *
24
+ * Tests whether the containing code does not cause a ClassCastException in the AggregateResolver
25
+ */
26
+ fun `test handles wildcard type in immediate class type` () {
27
+ addFile(
28
+ " MyAggregate.java" , """
29
+ import java.util.List;
30
+
31
+ @AggregateRoot
32
+ class MyAggregate {
33
+ @AggregateMember
34
+ private List<?> entities;
35
+ }
36
+ """ .trimIndent()
37
+ )
38
+
39
+ project.aggregateResolver().getModels()
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments