diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java index c1c371b6a44..62cc3818eb1 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java @@ -199,9 +199,8 @@ public abstract class KeyProvider { return cipher; } - @SuppressWarnings("unchecked") public Map getAttributes() { - return (attributes == null) ? Collections.EMPTY_MAP : attributes; + return (attributes == null) ? Collections.emptyMap() : attributes; } /** @@ -370,9 +369,8 @@ public abstract class KeyProvider { return description; } - @SuppressWarnings("unchecked") public Map getAttributes() { - return (attributes == null) ? Collections.EMPTY_MAP : attributes; + return (attributes == null) ? Collections.emptyMap() : attributes; } @Override diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java index 3cc419083e7..683a1baae0c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/protocol/TestHdfsFileStatusMethods.java @@ -54,7 +54,7 @@ public class TestHdfsFileStatusMethods { assertEquals(fsM.stream() .map(MethodSignature::toString) .collect(joining("\n")), - Collections.EMPTY_SET, fsM); + Collections.emptySet(), fsM); } /** Map non-static, declared methods for this class to signatures. */ diff --git a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java index 167690902aa..9ef786db2d3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java +++ b/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/lib/service/security/DummyGroupMapping.java @@ -28,7 +28,6 @@ import org.apache.hadoop.test.HadoopUsersConfTestHelper; public class DummyGroupMapping implements GroupMappingServiceProvider { @Override - @SuppressWarnings("unchecked") public List getGroups(String user) throws IOException { if (user.equals("root")) { return Arrays.asList("admin"); @@ -37,7 +36,7 @@ public class DummyGroupMapping implements GroupMappingServiceProvider { return Arrays.asList("nobody"); } else { String[] groups = HadoopUsersConfTestHelper.getHadoopUserGroups(user); - return (groups != null) ? Arrays.asList(groups) : Collections.EMPTY_LIST; + return (groups != null) ? Arrays.asList(groups) : Collections.emptyList(); } } diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java index 11b2e472d64..b016eadcfbb 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java @@ -723,7 +723,7 @@ public class Listing { if (tombstones != null) { this.tombstones = tombstones; } else { - this.tombstones = Collections.EMPTY_SET; + this.tombstones = Collections.emptySet(); } } diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java index 53875badf93..99901ba3b0d 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java @@ -2099,7 +2099,7 @@ public class S3AFileSystem extends FileSystem implements StreamCapabilities { // Check MetadataStore, if any. PathMetadata pm = metadataStore.get(path, needEmptyDirectoryFlag); - Set tombstones = Collections.EMPTY_SET; + Set tombstones = Collections.emptySet(); if (pm != null) { if (pm.isDeleted()) { throw new FileNotFoundException("Path " + f + " is recorded as " + diff --git a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java index 6ee37ccd6a5..bf151cd1733 100644 --- a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java +++ b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java @@ -415,7 +415,7 @@ public class TestCopyCommitter { @Override public List getSplits(JobContext context) throws IOException, InterruptedException { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } @Override diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java index 92f9b0fbeb4..78645e98d68 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/scheduler/RMNodeWrapper.java @@ -144,9 +144,8 @@ public class RMNodeWrapper implements RMNode { } @Override - @SuppressWarnings("unchecked") public List pullContainerUpdates() { - List list = Collections.EMPTY_LIST; + List list = Collections.emptyList(); if (! pulled) { list = updates; pulled = true; @@ -168,11 +167,10 @@ public class RMNodeWrapper implements RMNode { return RMNodeLabelsManager.EMPTY_STRING_SET; } - @SuppressWarnings("unchecked") @Override public List pullNewlyIncreasedContainers() { // TODO Auto-generated method stub - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public OpportunisticContainersStatus getOpportunisticContainersStatus() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java index 876957e8a83..eee50e3c1e5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java @@ -223,7 +223,7 @@ public abstract class AllocateRequest { @Public @Unstable public List getSchedulingRequests() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java index 52c30e2c4aa..3b9c30ff114 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java @@ -420,7 +420,7 @@ public abstract class AllocateResponse { @Public @Unstable public List getRejectedSchedulingRequests() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java index b9ca3f90969..2dc6e1ff38a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java @@ -263,7 +263,7 @@ public abstract class Container implements Comparable { @Private @Unstable public Set getAllocationTags() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } @Private diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java index 70935cbd886..c5a649d52a1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java @@ -368,7 +368,7 @@ public class ContainerTokenIdentifier extends TokenIdentifier { if (proto.getAllocationTagsList() != null) { return new HashSet<>(proto.getAllocationTagsList()); } - return Collections.EMPTY_SET; + return Collections.emptySet(); } // TODO: Needed? diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java index 77b3df6a1d8..065918d5eb9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/NMContainerStatus.java @@ -169,7 +169,7 @@ public abstract class NMContainerStatus { * Get and set the Allocation tags associated with the container. */ public Set getAllocationTags() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } public void setAllocationTags(Set allocationTags) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java index 12d679bb28f..f28aad206a6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/ResourcePluginManager.java @@ -46,7 +46,8 @@ public class ResourcePluginManager { private static final Set SUPPORTED_RESOURCE_PLUGINS = ImmutableSet.of( GPU_URI, FPGA_URI); - private Map configuredPlugins = Collections.EMPTY_MAP; + private Map configuredPlugins = + Collections.emptyMap(); public synchronized void initialize(Context context) throws YarnException { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java index 18ab473d3c6..71558a76be9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/DefaultAMSProcessor.java @@ -207,10 +207,10 @@ final class DefaultAMSProcessor implements ApplicationMasterServiceProcessor { request.getResourceBlacklistRequest(); List blacklistAdditions = (blacklistRequest != null) ? - blacklistRequest.getBlacklistAdditions() : Collections.EMPTY_LIST; + blacklistRequest.getBlacklistAdditions() : Collections.emptyList(); List blacklistRemovals = (blacklistRequest != null) ? - blacklistRequest.getBlacklistRemovals() : Collections.EMPTY_LIST; + blacklistRequest.getBlacklistRemovals() : Collections.emptyList(); RMApp app = getRmContext().getRMApps().get(appAttemptId.getApplicationId()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java index 304d204c949..3f9fd171689 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java @@ -136,23 +136,21 @@ public class ProportionalCapacityPreemptionPolicy private Map preemptableQueues; private Set killableContainers; - @SuppressWarnings("unchecked") public ProportionalCapacityPreemptionPolicy() { clock = SystemClock.getInstance(); - allPartitions = Collections.EMPTY_SET; - leafQueueNames = Collections.EMPTY_SET; - preemptableQueues = Collections.EMPTY_MAP; + allPartitions = Collections.emptySet(); + leafQueueNames = Collections.emptySet(); + preemptableQueues = Collections.emptyMap(); } - @SuppressWarnings("unchecked") @VisibleForTesting public ProportionalCapacityPreemptionPolicy(RMContext context, CapacityScheduler scheduler, Clock clock) { init(context.getYarnConfiguration(), context, scheduler); this.clock = clock; - allPartitions = Collections.EMPTY_SET; - leafQueueNames = Collections.EMPTY_SET; - preemptableQueues = Collections.EMPTY_MAP; + allPartitions = Collections.emptySet(); + leafQueueNames = Collections.emptySet(); + preemptableQueues = Collections.emptyMap(); } public void init(Configuration config, RMContext context, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index 8c2f4e40f93..c23b135a3da 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -2237,7 +2237,7 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { return attempt.getBlacklistedNodes(); } } - return Collections.EMPTY_SET; + return Collections.emptySet(); } protected void onInvalidTranstion(RMAppAttemptEventType rmAppAttemptEventType, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java index 4fc2d8a4a83..3cbde01abed 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeImpl.java @@ -1477,7 +1477,7 @@ public class RMNodeImpl implements RMNode, EventHandler { writeLock.lock(); if (nmReportedIncreasedContainers.isEmpty()) { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } else { List container = new ArrayList(nmReportedIncreasedContainers.values()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java index c79f2704a0b..5f5fe24d173 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmnode/RMNodeStatusEvent.java @@ -80,10 +80,9 @@ public class RMNodeStatusEvent extends RMNodeEvent { this.logAggregationReportsForApps = logAggregationReportsForApps; } - @SuppressWarnings("unchecked") public List getNMReportedIncreasedContainers() { return this.nodeStatus.getIncreasedContainers() == null ? - Collections.EMPTY_LIST : this.nodeStatus.getIncreasedContainers(); + Collections.emptyList() : this.nodeStatus.getIncreasedContainers(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java index 6badfee03cc..9f8bf3d3f28 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/BatchedRequests.java @@ -131,7 +131,7 @@ public class BatchedRequests * @return Set of blacklisted Nodes. */ public Set getBlacklist(String tag) { - return blacklist.getOrDefault(tag, Collections.EMPTY_SET); + return blacklist.getOrDefault(tag, Collections.emptySet()); } /** diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java index 849eb210b15..2259d1b23d6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/constraint/processor/PlacementDispatcher.java @@ -87,7 +87,7 @@ class PlacementDispatcher implements } return retList; } - return Collections.EMPTY_LIST; + return Collections.emptyList(); } public List pullRejectedRequests( @@ -104,7 +104,7 @@ class PlacementDispatcher implements } return retList; } - return Collections.EMPTY_LIST; + return Collections.emptyList(); } void clearApplicationState(ApplicationId applicationId) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java index a04816bca98..ed0734503fa 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/placement/SingleConstraintAppPlacementAllocator.java @@ -373,9 +373,8 @@ public class SingleConstraintAppPlacementAllocator } @Override - @SuppressWarnings("unchecked") public Map getResourceRequests() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java index 96e4451c954..de8f8f646b8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java @@ -723,13 +723,12 @@ public class TestResourceTrackerService extends NodeLabelTestBase { } } - @SuppressWarnings("unchecked") private NodeStatus getNodeStatusObject(NodeId nodeId) { NodeStatus status = Records.newRecord(NodeStatus.class); status.setNodeId(nodeId); status.setResponseId(0); - status.setContainersStatuses(Collections.EMPTY_LIST); - status.setKeepAliveApplications(Collections.EMPTY_LIST); + status.setContainersStatuses(Collections.emptyList()); + status.setKeepAliveApplications(Collections.emptyList()); return status; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java index ca43a955857..a8e269779dc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java @@ -781,7 +781,7 @@ public class ProportionalCapacityPreemptionPolicyMockFramework { } } - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /**