delete deprecated api (#535)

pull/540/head
weihubeats 2 years ago committed by GitHub
parent 03e805fd47
commit 547b1c403e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,7 @@
package cn.hippo4j.common.spi;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@ -84,9 +85,10 @@ public class DynamicThreadPoolServiceLoader {
*/
private static Object newServiceInstance(final Class<?> clazz) {
try {
return clazz.newInstance();
} catch (final InstantiationException | IllegalAccessException ex) {
throw new ServiceLoaderInstantiationException(clazz, ex);
return clazz.getDeclaredConstructor().newInstance();
}
catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new ServiceLoaderInstantiationException(clazz, e);
}
}
}

@ -17,15 +17,15 @@
package cn.hippo4j.common.toolkit;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import cn.hippo4j.common.monitor.AbstractMessage;
import cn.hippo4j.common.monitor.Message;
import cn.hippo4j.common.monitor.MessageWrapper;
import lombok.SneakyThrows;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Message convert.
*/
@ -60,7 +60,7 @@ public class MessageConvert {
*/
@SneakyThrows
public static Message convert(MessageWrapper messageWrapper) {
AbstractMessage message = (AbstractMessage) messageWrapper.getResponseClass().newInstance();
AbstractMessage message = (AbstractMessage) messageWrapper.getResponseClass().getDeclaredConstructor().newInstance();
List<Map<String, Object>> contentParams = messageWrapper.getContentParams();
List<Message> messages = new ArrayList();
contentParams.forEach(each -> {

Loading…
Cancel
Save