Self review

This commit is contained in:
Clément Fournier
2024-04-05 16:32:21 +02:00
parent 4a25afc864
commit 87691a0321
2 changed files with 7 additions and 9 deletions

View File

@ -70,8 +70,7 @@ final class Lub {
*
* @return null if G is not a generic type, otherwise Relevant(G)
*/
@SuppressWarnings("PMD.ReturnEmptyCollectionRatherThanNull")
// null is explicit mentioned as a possible return value
@SuppressWarnings("PMD.ReturnEmptyCollectionRatherThanNull") // null is explicit mentioned as a possible return value
static @Nullable List<JClassType> relevant(JClassType g, Set<JTypeMirror> stunion) {
if (!g.isRaw()) {
return null;
@ -261,9 +260,7 @@ final class Lub {
}
}
/**
* Simple record type for a pair of types.
*/
/** Simple record type for a pair of types. */
private static final class TypePair {
public final JTypeMirror left;

View File

@ -96,6 +96,7 @@ class GlbTest : FunSpec({
// but C1[] & I1[] = (C1 & I1)[] exists because I1 is an interface.
glb(LubTestData.C1::class.decl.toArray(), LubTestData.I1::class.decl.toArray())
.shouldBe((LubTestData.C1::class.decl * LubTestData.I1::class.decl).toArray())
}
@ -138,20 +139,20 @@ class GlbTest : FunSpec({
}
glb(`t_ArrayList{Integer}`, ts.NULL_TYPE) shouldBe ts.NULL_TYPE
glb(`t_ArrayList{Integer}`, t_Iterable[`?` extends t_Number], t_Iterable[t_String]).shouldBeA<JIntersectionType> {
it.components.shouldContainExactly(`t_ArrayList{Integer}`, t_Iterable[t_String])
it.components.shouldContainExactlyInAnyOrder(`t_ArrayList{Integer}`, t_Iterable[t_String])
}
glb(`t_List{? extends Number}`, `t_Collection{Integer}`).shouldBeA<JIntersectionType> {
it.components.shouldContainExactly(`t_List{? extends Number}`, `t_Collection{Integer}`)
it.components.shouldContainExactlyInAnyOrder(`t_List{? extends Number}`, `t_Collection{Integer}`)
}
glb(t_List.toArray(), t_Iterable).shouldBeA<JIntersectionType> {
it.components.shouldContainExactly(t_List.toArray(), t_Iterable)
it.components.shouldContainExactlyInAnyOrder(t_List.toArray(), t_Iterable)
it.inducedClassType.shouldBeNull()
}
glb(`t_List{? extends Number}`, `t_Collection{Integer}`, `t_ArrayList{Integer}`) shouldBe `t_ArrayList{Integer}`
glb(`t_List{? extends Number}`, `t_List{String}`, `t_Enum{JPrimitiveType}`).shouldBeA<JIntersectionType> {
it.components.shouldContainExactly(`t_Enum{JPrimitiveType}`, `t_List{? extends Number}`, `t_List{String}`)
it.components.shouldContainExactlyInAnyOrder(`t_Enum{JPrimitiveType}`, `t_List{String}`, `t_List{? extends Number}`)
}
glb(