DATACMNS-1278 - Make sure that SimpleTypeHolder always treats enums as simple.
We now explicitly check for an enum type in SimpleTypeHolder.isSimpleType(…) and resort to true immediately. Before that an enum implementing an interface could have seen a false for the actual enum type in case the interface type had been checked first and (correctly) produced a false. In the check for the actual enum type, depending on the iteration order through the cached values we could've hit the cached false for the interface or the cached true value for Enum.
This commit is contained in:
@@ -131,6 +131,15 @@ public class SimpleTypeHolderUnitTests {
|
||||
assertThat(holder.isSimpleType(ExtendedPerson.class)).isFalse();
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1278
|
||||
public void alwaysConsidersEnumsSimple() {
|
||||
|
||||
SimpleTypeHolder holder = SimpleTypeHolder.DEFAULT;
|
||||
|
||||
assertThat(holder.isSimpleType(SomeInterface.class)).isFalse();
|
||||
assertThat(holder.isSimpleType(InterfacedEnum.class)).isTrue();
|
||||
}
|
||||
|
||||
enum SimpleEnum {
|
||||
|
||||
FOO;
|
||||
@@ -155,4 +164,8 @@ public class SimpleTypeHolderUnitTests {
|
||||
static class ExtendedPerson extends Person {
|
||||
|
||||
}
|
||||
|
||||
interface SomeInterface {}
|
||||
|
||||
enum InterfacedEnum implements SomeInterface {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user