新增 BaseRuntimeException 作为基础运行时异常,原 BaseException 作为基础检查型异常。

This commit is contained in:
2023-10-18 10:54:12 +08:00
parent eba31a93f3
commit 94d34faffd
3 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
package xyz.zhouxy.plusone.commons;
import java.io.ObjectStreamClass;
import org.junit.jupiter.api.Test;
import lombok.extern.slf4j.Slf4j;
import xyz.zhouxy.plusone.commons.exception.BaseRuntimeException;
@Slf4j
class SerialTests {
@Test
void testSerialVersionUID() {
long uid = getSerialVersionUID(BaseRuntimeException.class);
log.info("\n private static final long serialVersionUID = {}L;", uid);
}
private long getSerialVersionUID(Class<?> cl) {
ObjectStreamClass c = ObjectStreamClass.lookup(cl);
return c.getSerialVersionUID();
}
}