diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/BranchingExprsTestCases.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/BranchingExprsTests.kt similarity index 96% rename from pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/BranchingExprsTestCases.kt rename to pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/BranchingExprsTests.kt index 95374c4359..9a0fcf643c 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/BranchingExprsTestCases.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/types/internal/infer/BranchingExprsTests.kt @@ -13,7 +13,7 @@ import net.sourceforge.pmd.lang.test.ast.shouldBe import net.sourceforge.pmd.lang.test.ast.shouldMatchN -class BranchingExprsTestCases : ProcessorTestSpec({ +class BranchingExprsTests : ProcessorTestSpec({ fun TypeSystem.stringSupplier() : JTypeMirror = with (TypeDslOf(this)) { java.util.function.Supplier::class[gen.t_String] @@ -276,7 +276,8 @@ class Scratch { Collection fun(boolean messageSelector) { Collection textFromMessage = - // compile error: a cast doesn't contribute a target type, + // compile error: Inconvertible types; cannot cast 'java.util.Collection' to 'java.util.Collection' + // a cast doesn't contribute a target type, // the ternary is inferred to Collection (Collection) (messageSelector ? emptyList() : emptySet()); @@ -293,8 +294,8 @@ class Scratch { val (ternary1, ternary2) = acu.descendants(ASTConditionalExpression::class.java).toList() spy.shouldBeOk { - ternary1 shouldHaveType java.util.Collection::class[ts.OBJECT] - ternary2 shouldHaveType java.util.Collection::class[ts.STRING] + ternary1 shouldHaveType gen.t_Collection[captureMatcher(`?`)] // java.util.Collection + ternary2 shouldHaveType gen.`t_Collection{String}` // java.util.Collection } }