This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new b471b4d2f [type: refactor] Use Collections.emptyList() replace
Collections.EMPTY_LIST. (#3881) (#3882)
b471b4d2f is described below
commit b471b4d2f318a7b916d618dd6ee37c9a9939494e
Author: ousinka <[email protected]>
AuthorDate: Sat Aug 27 18:31:08 2022 +0800
[type: refactor] Use Collections.emptyList() replace
Collections.EMPTY_LIST. (#3881) (#3882)
---
.../admin/service/converter/AbstractSelectorHandleConverter.java | 2 +-
.../admin/service/manager/impl/LoadServiceDocEntryImpl.java | 8 +++-----
.../shenyu/admin/service/manager/impl/SwaggerDocParser.java | 2 +-
.../org/apache/shenyu/admin/controller/RoleControllerTest.java | 2 +-
.../test/java/org/apache/shenyu/common/dto/ConfigDataTest.java | 6 +++---
5 files changed, 9 insertions(+), 11 deletions(-)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/AbstractSelectorHandleConverter.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/AbstractSelectorHandleConverter.java
index 22f6c1b06..cd0b79c74 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/AbstractSelectorHandleConverter.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/converter/AbstractSelectorHandleConverter.java
@@ -69,7 +69,7 @@ public abstract class AbstractSelectorHandleConverter
implements SelectorHandleC
@Override
public <T extends CommonUpstream> List<T> updateStatusAndFilter(final
List<T> existList, final List<? extends CommonUpstream> aliveList) {
if (aliveList == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
long currentTimeMillis = System.currentTimeMillis();
List<T> validExistList = existList.stream()
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/LoadServiceDocEntryImpl.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/LoadServiceDocEntryImpl.java
index 7e5bcee7a..237fd9749 100755
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/LoadServiceDocEntryImpl.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/LoadServiceDocEntryImpl.java
@@ -126,11 +126,10 @@ public class LoadServiceDocEntryImpl implements
LoadServiceDocEntry {
return false;
}
- @SuppressWarnings("unchecked")
private List<UpstreamInstance> getLastUpdateInstanceList(final
List<SelectorData> changedList) {
if (CollectionUtils.isEmpty(changedList)) {
LOG.info("getLastUpdateInstanceList, changedList is empty.");
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
return changedList.parallelStream()
.map(this::getClusterLastUpdateInstance)
@@ -143,13 +142,12 @@ public class LoadServiceDocEntryImpl implements
LoadServiceDocEntry {
*
* @return List
*/
- @SuppressWarnings("unchecked")
private List<UpstreamInstance> getAllClusterLastUpdateInstanceList() {
List<String> pluginNames = new ArrayList<>();
RpcTypeEnum.acquireSupportSwaggers().forEach(rpcTypeEnum ->
pluginNames.add(PluginNameAdapter.rpcTypeAdapter(rpcTypeEnum.getName())));
final List<PluginDO> pluginDOList =
pluginMapper.selectByNames(pluginNames);
if (CollectionUtils.isEmpty(pluginDOList)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
supportSwaggerPluginMap =
pluginDOList.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(PluginDO::getId, PluginDO::getName,
(value1, value2) -> value1));
@@ -158,7 +156,7 @@ public class LoadServiceDocEntryImpl implements
LoadServiceDocEntry {
List<SelectorVO> clusterList = commonPager.getDataList();
if (CollectionUtils.isEmpty(clusterList)) {
LOG.info("getAllClusterLastUpdateInstanceList, Not loaded into
available backend services.");
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
return clusterList.parallelStream()
.map(this::getClusterLastUpdateInstance)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocParser.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocParser.java
index 052ecd1d4..76a3ed43e 100755
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocParser.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocParser.java
@@ -290,7 +290,7 @@ public class SwaggerDocParser implements DocParser {
private List<String> jsonArrayToStringList(final JsonArray jsonArray) {
if (Objects.isNull(jsonArray)) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<String> list = new ArrayList<>(jsonArray.size());
for (JsonElement jsonElement : jsonArray) {
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RoleControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RoleControllerTest.java
index 2e6602f91..56256cdfe 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RoleControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RoleControllerTest.java
@@ -83,7 +83,7 @@ public class RoleControllerTest {
@Test
public void testSelectAll() throws Exception {
- given(roleService.selectAll()).willReturn(Collections.EMPTY_LIST);
+ given(roleService.selectAll()).willReturn(Collections.emptyList());
this.mockMvc.perform(MockMvcRequestBuilders.get("/role/getAllRoles"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.message",
is(ShenyuResultMessage.QUERY_SUCCESS)))
diff --git
a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/ConfigDataTest.java
b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/ConfigDataTest.java
index b2fc9466a..25da59001 100644
---
a/shenyu-common/src/test/java/org/apache/shenyu/common/dto/ConfigDataTest.java
+++
b/shenyu-common/src/test/java/org/apache/shenyu/common/dto/ConfigDataTest.java
@@ -39,7 +39,7 @@ public class ConfigDataTest {
ConfigData<Object> configData = new ConfigData<>();
configData.setLastModifyTime(LAST_MODIFY_TIME);
configData.setMd5(MD5);
- configData.setData(Collections.EMPTY_LIST);
+ configData.setData(Collections.emptyList());
assertNotNull(configData.toString());
}
@@ -48,8 +48,8 @@ public class ConfigDataTest {
*/
@Test
public void testGetterSetter() {
- ConfigData<Object> configData = new ConfigData<>(MD5,
LAST_MODIFY_TIME, Collections.EMPTY_LIST);
- assertEquals(configData.getData(), Collections.EMPTY_LIST);
+ ConfigData<Object> configData = new ConfigData<>(MD5,
LAST_MODIFY_TIME, Collections.emptyList());
+ assertEquals(configData.getData(), Collections.emptyList());
assertEquals(configData.getMd5(), MD5);
assertEquals(configData.getLastModifyTime(), LAST_MODIFY_TIME);
}