DATACMNS-1779 - Consider kotlin.Unit a simple type.
kotlin.Unit is now considered a simple type to avoid PersistentEntity creation. ReflectionUtils.isVoid(…) now encapsulates the check so that calling code doesn't need to check if Kotlin is on the class path.
This commit is contained in:
@@ -17,11 +17,14 @@ package org.springframework.data.util;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import kotlin.Unit;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.data.mapping.model.TypeCreatingSyntheticClassKt;
|
||||
@@ -163,6 +166,15 @@ public class ReflectionUtilsUnitTests {
|
||||
assertThat(ReflectionUtils.isSupportedKotlinClass(TypeCreatingSyntheticClassKt.class)).isFalse();
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1779
|
||||
public void shouldReportIsVoid() {
|
||||
|
||||
assertThat(ReflectionUtils.isVoid(Void.class)).isTrue();
|
||||
assertThat(ReflectionUtils.isVoid(Void.TYPE)).isTrue();
|
||||
assertThat(ReflectionUtils.isVoid(Unit.class)).isTrue();
|
||||
assertThat(ReflectionUtils.isVoid(String.class)).isFalse();
|
||||
}
|
||||
|
||||
static class Sample {
|
||||
|
||||
public String field;
|
||||
|
||||
Reference in New Issue
Block a user