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 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+ - Fix various occasions where invalid PsiElements could be shown in line marker popups by filtering on validity
10+
511## [ 0.6.1]
612
713### Fixed
Original file line number Diff line number Diff line change 1919
2020pluginGroup =io.axoniq.ide.intellij
2121pluginName =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.
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class AxonNavigationGutterIconRenderer(
6262
6363 override fun navigateToItems (event : MouseEvent ? ) {
6464 if (event != null ) {
65- val elements = PsiUtilCore .toPsiElementArray(targetElements)
65+ val elements = PsiUtilCore .toPsiElementArray(targetElements.filter { it.isValid } )
6666 val popup = NavigationUtil .getPsiElementPopup(elements, myCellRenderer.compute(), myPopupTitle)
6767 popup.show(RelativePoint (event))
6868 }
@@ -76,7 +76,11 @@ class AxonNavigationGutterIconRenderer(
7676 { tooltipText },
7777 this ,
7878 alignment,
79- { elements.value.map { WrappedGoToRelatedItem (it) } }
79+ {
80+ elements.value
81+ .filter { it.element.isValid }
82+ .map { WrappedGoToRelatedItem (it) }
83+ }
8084 )
8185 }
8286}
Original file line number Diff line number Diff 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 */
5251fun 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
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