DATACMNS-1294 - Consider java.time types simple ones.
To prevent repeated failing calls to ClassUtils.forName(…) we now also cache the failed attempt and simply eagerly return null as subsequent similar attempts to resolve a class are going to fail anyway. Original pull request: #286.
This commit is contained in:
@@ -123,7 +123,9 @@ public class SimpleTypeHolder {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type.getName().startsWith("java.lang")) {
|
||||
String typeName = type.getName();
|
||||
|
||||
if (typeName.startsWith("java.lang") || typeName.startsWith("java.time")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.Instant;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
@@ -114,6 +115,14 @@ public class SimpleTypeHolderUnitTests {
|
||||
assertThat(holder.isSimpleType(Type.class), is(true));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1294
|
||||
public void considersJavaTimeTypesSimple() {
|
||||
|
||||
SimpleTypeHolder holder = new SimpleTypeHolder();
|
||||
|
||||
assertThat(holder.isSimpleType(Instant.class), is(true));
|
||||
}
|
||||
|
||||
enum SimpleEnum {
|
||||
|
||||
FOO;
|
||||
|
||||
Reference in New Issue
Block a user