HDFS-16709. Remove redundant cast in FSEditLogOp.class (#4667). Contributed by ZanderXu.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
xuzq 2022-08-09 03:24:01 +08:00 committed by GitHub
parent 06f0f7db79
commit 895f7c51fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 56 deletions

View File

@ -823,7 +823,7 @@ public abstract class FSEditLogOp {
} }
static AddOp getInstance(OpInstanceCache cache) { static AddOp getInstance(OpInstanceCache cache) {
return (AddOp) cache.get(OP_ADD); return cache.get(OP_ADD);
} }
@Override @Override
@ -851,7 +851,7 @@ public abstract class FSEditLogOp {
} }
static CloseOp getInstance(OpInstanceCache cache) { static CloseOp getInstance(OpInstanceCache cache) {
return (CloseOp)cache.get(OP_CLOSE); return cache.get(OP_CLOSE);
} }
@Override @Override
@ -969,7 +969,7 @@ public abstract class FSEditLogOp {
} }
static AddBlockOp getInstance(OpInstanceCache cache) { static AddBlockOp getInstance(OpInstanceCache cache) {
return (AddBlockOp) cache.get(OP_ADD_BLOCK); return cache.get(OP_ADD_BLOCK);
} }
@Override @Override
@ -1081,7 +1081,7 @@ public abstract class FSEditLogOp {
} }
static UpdateBlocksOp getInstance(OpInstanceCache cache) { static UpdateBlocksOp getInstance(OpInstanceCache cache) {
return (UpdateBlocksOp)cache.get(OP_UPDATE_BLOCKS); return cache.get(OP_UPDATE_BLOCKS);
} }
@Override @Override
@ -1175,7 +1175,7 @@ public abstract class FSEditLogOp {
} }
static SetReplicationOp getInstance(OpInstanceCache cache) { static SetReplicationOp getInstance(OpInstanceCache cache) {
return (SetReplicationOp)cache.get(OP_SET_REPLICATION); return cache.get(OP_SET_REPLICATION);
} }
@Override @Override
@ -1254,7 +1254,7 @@ public abstract class FSEditLogOp {
} }
static ConcatDeleteOp getInstance(OpInstanceCache cache) { static ConcatDeleteOp getInstance(OpInstanceCache cache) {
return (ConcatDeleteOp)cache.get(OP_CONCAT_DELETE); return cache.get(OP_CONCAT_DELETE);
} }
@Override @Override
@ -1412,7 +1412,7 @@ public abstract class FSEditLogOp {
} }
static RenameOldOp getInstance(OpInstanceCache cache) { static RenameOldOp getInstance(OpInstanceCache cache) {
return (RenameOldOp)cache.get(OP_RENAME_OLD); return cache.get(OP_RENAME_OLD);
} }
@Override @Override
@ -1524,7 +1524,7 @@ public abstract class FSEditLogOp {
} }
static DeleteOp getInstance(OpInstanceCache cache) { static DeleteOp getInstance(OpInstanceCache cache) {
return (DeleteOp)cache.get(OP_DELETE); return cache.get(OP_DELETE);
} }
@Override @Override
@ -1625,7 +1625,7 @@ public abstract class FSEditLogOp {
} }
static MkdirOp getInstance(OpInstanceCache cache) { static MkdirOp getInstance(OpInstanceCache cache) {
return (MkdirOp)cache.get(OP_MKDIR); return cache.get(OP_MKDIR);
} }
@Override @Override
@ -1798,7 +1798,7 @@ public abstract class FSEditLogOp {
} }
static SetGenstampV1Op getInstance(OpInstanceCache cache) { static SetGenstampV1Op getInstance(OpInstanceCache cache) {
return (SetGenstampV1Op)cache.get(OP_SET_GENSTAMP_V1); return cache.get(OP_SET_GENSTAMP_V1);
} }
@Override @Override
@ -1864,7 +1864,7 @@ public abstract class FSEditLogOp {
} }
static SetGenstampV2Op getInstance(OpInstanceCache cache) { static SetGenstampV2Op getInstance(OpInstanceCache cache) {
return (SetGenstampV2Op)cache.get(OP_SET_GENSTAMP_V2); return cache.get(OP_SET_GENSTAMP_V2);
} }
@Override @Override
@ -1922,7 +1922,7 @@ public abstract class FSEditLogOp {
} }
static AllocateBlockIdOp getInstance(OpInstanceCache cache) { static AllocateBlockIdOp getInstance(OpInstanceCache cache) {
return (AllocateBlockIdOp)cache.get(OP_ALLOCATE_BLOCK_ID); return cache.get(OP_ALLOCATE_BLOCK_ID);
} }
@Override @Override
@ -1981,7 +1981,7 @@ public abstract class FSEditLogOp {
} }
static SetPermissionsOp getInstance(OpInstanceCache cache) { static SetPermissionsOp getInstance(OpInstanceCache cache) {
return (SetPermissionsOp)cache.get(OP_SET_PERMISSIONS); return cache.get(OP_SET_PERMISSIONS);
} }
@Override @Override
@ -2054,7 +2054,7 @@ public abstract class FSEditLogOp {
} }
static SetOwnerOp getInstance(OpInstanceCache cache) { static SetOwnerOp getInstance(OpInstanceCache cache) {
return (SetOwnerOp)cache.get(OP_SET_OWNER); return cache.get(OP_SET_OWNER);
} }
@Override @Override
@ -2141,7 +2141,7 @@ public abstract class FSEditLogOp {
} }
static SetNSQuotaOp getInstance(OpInstanceCache cache) { static SetNSQuotaOp getInstance(OpInstanceCache cache) {
return (SetNSQuotaOp)cache.get(OP_SET_NS_QUOTA); return cache.get(OP_SET_NS_QUOTA);
} }
@Override @Override
@ -2199,7 +2199,7 @@ public abstract class FSEditLogOp {
} }
static ClearNSQuotaOp getInstance(OpInstanceCache cache) { static ClearNSQuotaOp getInstance(OpInstanceCache cache) {
return (ClearNSQuotaOp)cache.get(OP_CLEAR_NS_QUOTA); return cache.get(OP_CLEAR_NS_QUOTA);
} }
@Override @Override
@ -2253,7 +2253,7 @@ public abstract class FSEditLogOp {
} }
static SetQuotaOp getInstance(OpInstanceCache cache) { static SetQuotaOp getInstance(OpInstanceCache cache) {
return (SetQuotaOp)cache.get(OP_SET_QUOTA); return cache.get(OP_SET_QUOTA);
} }
@Override @Override
@ -2338,7 +2338,7 @@ public abstract class FSEditLogOp {
} }
static SetQuotaByStorageTypeOp getInstance(OpInstanceCache cache) { static SetQuotaByStorageTypeOp getInstance(OpInstanceCache cache) {
return (SetQuotaByStorageTypeOp)cache.get(OP_SET_QUOTA_BY_STORAGETYPE); return cache.get(OP_SET_QUOTA_BY_STORAGETYPE);
} }
@Override @Override
@ -2421,7 +2421,7 @@ public abstract class FSEditLogOp {
} }
static TimesOp getInstance(OpInstanceCache cache) { static TimesOp getInstance(OpInstanceCache cache) {
return (TimesOp)cache.get(OP_TIMES); return cache.get(OP_TIMES);
} }
@Override @Override
@ -2530,7 +2530,7 @@ public abstract class FSEditLogOp {
} }
static SymlinkOp getInstance(OpInstanceCache cache) { static SymlinkOp getInstance(OpInstanceCache cache) {
return (SymlinkOp)cache.get(OP_SYMLINK); return cache.get(OP_SYMLINK);
} }
@Override @Override
@ -2689,7 +2689,7 @@ public abstract class FSEditLogOp {
} }
static RenameOp getInstance(OpInstanceCache cache) { static RenameOp getInstance(OpInstanceCache cache) {
return (RenameOp)cache.get(OP_RENAME); return cache.get(OP_RENAME);
} }
@Override @Override
@ -2854,7 +2854,7 @@ public abstract class FSEditLogOp {
} }
static TruncateOp getInstance(OpInstanceCache cache) { static TruncateOp getInstance(OpInstanceCache cache) {
return (TruncateOp)cache.get(OP_TRUNCATE); return cache.get(OP_TRUNCATE);
} }
@Override @Override
@ -2988,7 +2988,7 @@ public abstract class FSEditLogOp {
} }
static ReassignLeaseOp getInstance(OpInstanceCache cache) { static ReassignLeaseOp getInstance(OpInstanceCache cache) {
return (ReassignLeaseOp)cache.get(OP_REASSIGN_LEASE); return cache.get(OP_REASSIGN_LEASE);
} }
@Override @Override
@ -3070,7 +3070,7 @@ public abstract class FSEditLogOp {
} }
static GetDelegationTokenOp getInstance(OpInstanceCache cache) { static GetDelegationTokenOp getInstance(OpInstanceCache cache) {
return (GetDelegationTokenOp)cache.get(OP_GET_DELEGATION_TOKEN); return cache.get(OP_GET_DELEGATION_TOKEN);
} }
@Override @Override
@ -3149,7 +3149,7 @@ public abstract class FSEditLogOp {
} }
static RenewDelegationTokenOp getInstance(OpInstanceCache cache) { static RenewDelegationTokenOp getInstance(OpInstanceCache cache) {
return (RenewDelegationTokenOp)cache.get(OP_RENEW_DELEGATION_TOKEN); return cache.get(OP_RENEW_DELEGATION_TOKEN);
} }
@Override @Override
@ -3227,7 +3227,7 @@ public abstract class FSEditLogOp {
} }
static CancelDelegationTokenOp getInstance(OpInstanceCache cache) { static CancelDelegationTokenOp getInstance(OpInstanceCache cache) {
return (CancelDelegationTokenOp)cache.get(OP_CANCEL_DELEGATION_TOKEN); return cache.get(OP_CANCEL_DELEGATION_TOKEN);
} }
@Override @Override
@ -3286,7 +3286,7 @@ public abstract class FSEditLogOp {
} }
static UpdateMasterKeyOp getInstance(OpInstanceCache cache) { static UpdateMasterKeyOp getInstance(OpInstanceCache cache) {
return (UpdateMasterKeyOp)cache.get(OP_UPDATE_MASTER_KEY); return cache.get(OP_UPDATE_MASTER_KEY);
} }
@Override @Override
@ -3345,7 +3345,7 @@ public abstract class FSEditLogOp {
static LogSegmentOp getInstance(OpInstanceCache cache, static LogSegmentOp getInstance(OpInstanceCache cache,
FSEditLogOpCodes code) { FSEditLogOpCodes code) {
return (LogSegmentOp)cache.get(code); return cache.get(code);
} }
@Override @Override
@ -3404,7 +3404,7 @@ public abstract class FSEditLogOp {
} }
static InvalidOp getInstance(OpInstanceCache cache) { static InvalidOp getInstance(OpInstanceCache cache) {
return (InvalidOp)cache.get(OP_INVALID); return cache.get(OP_INVALID);
} }
@Override @Override
@ -3457,7 +3457,7 @@ public abstract class FSEditLogOp {
} }
static CreateSnapshotOp getInstance(OpInstanceCache cache) { static CreateSnapshotOp getInstance(OpInstanceCache cache) {
return (CreateSnapshotOp)cache.get(OP_CREATE_SNAPSHOT); return cache.get(OP_CREATE_SNAPSHOT);
} }
@Override @Override
@ -3562,7 +3562,7 @@ public abstract class FSEditLogOp {
} }
static DeleteSnapshotOp getInstance(OpInstanceCache cache) { static DeleteSnapshotOp getInstance(OpInstanceCache cache) {
return (DeleteSnapshotOp)cache.get(OP_DELETE_SNAPSHOT); return cache.get(OP_DELETE_SNAPSHOT);
} }
@Override @Override
@ -3669,7 +3669,7 @@ public abstract class FSEditLogOp {
} }
static RenameSnapshotOp getInstance(OpInstanceCache cache) { static RenameSnapshotOp getInstance(OpInstanceCache cache) {
return (RenameSnapshotOp) cache.get(OP_RENAME_SNAPSHOT); return cache.get(OP_RENAME_SNAPSHOT);
} }
@Override @Override
@ -3788,7 +3788,7 @@ public abstract class FSEditLogOp {
} }
static AllowSnapshotOp getInstance(OpInstanceCache cache) { static AllowSnapshotOp getInstance(OpInstanceCache cache) {
return (AllowSnapshotOp) cache.get(OP_ALLOW_SNAPSHOT); return cache.get(OP_ALLOW_SNAPSHOT);
} }
@Override @Override
@ -3847,7 +3847,7 @@ public abstract class FSEditLogOp {
} }
static DisallowSnapshotOp getInstance(OpInstanceCache cache) { static DisallowSnapshotOp getInstance(OpInstanceCache cache) {
return (DisallowSnapshotOp) cache.get(OP_DISALLOW_SNAPSHOT); return cache.get(OP_DISALLOW_SNAPSHOT);
} }
void resetSubFields() { void resetSubFields() {
@ -3901,7 +3901,7 @@ public abstract class FSEditLogOp {
} }
static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) { static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (AddCacheDirectiveInfoOp) cache.get(OP_ADD_CACHE_DIRECTIVE); return cache.get(OP_ADD_CACHE_DIRECTIVE);
} }
@Override @Override
@ -3971,7 +3971,7 @@ public abstract class FSEditLogOp {
} }
static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) { static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (ModifyCacheDirectiveInfoOp) cache.get(OP_MODIFY_CACHE_DIRECTIVE); return cache.get(OP_MODIFY_CACHE_DIRECTIVE);
} }
@Override @Override
@ -4047,7 +4047,7 @@ public abstract class FSEditLogOp {
} }
static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) { static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (RemoveCacheDirectiveInfoOp) cache.get(OP_REMOVE_CACHE_DIRECTIVE); return cache.get(OP_REMOVE_CACHE_DIRECTIVE);
} }
@Override @Override
@ -4104,7 +4104,7 @@ public abstract class FSEditLogOp {
} }
static AddCachePoolOp getInstance(OpInstanceCache cache) { static AddCachePoolOp getInstance(OpInstanceCache cache) {
return (AddCachePoolOp) cache.get(OP_ADD_CACHE_POOL); return cache.get(OP_ADD_CACHE_POOL);
} }
@Override @Override
@ -4170,7 +4170,7 @@ public abstract class FSEditLogOp {
} }
static ModifyCachePoolOp getInstance(OpInstanceCache cache) { static ModifyCachePoolOp getInstance(OpInstanceCache cache) {
return (ModifyCachePoolOp) cache.get(OP_MODIFY_CACHE_POOL); return cache.get(OP_MODIFY_CACHE_POOL);
} }
@Override @Override
@ -4243,7 +4243,7 @@ public abstract class FSEditLogOp {
} }
static RemoveCachePoolOp getInstance(OpInstanceCache cache) { static RemoveCachePoolOp getInstance(OpInstanceCache cache) {
return (RemoveCachePoolOp) cache.get(OP_REMOVE_CACHE_POOL); return cache.get(OP_REMOVE_CACHE_POOL);
} }
@Override @Override
@ -4300,7 +4300,7 @@ public abstract class FSEditLogOp {
} }
static RemoveXAttrOp getInstance(OpInstanceCache cache) { static RemoveXAttrOp getInstance(OpInstanceCache cache) {
return (RemoveXAttrOp) cache.get(OP_REMOVE_XATTR); return cache.get(OP_REMOVE_XATTR);
} }
@Override @Override
@ -4353,7 +4353,7 @@ public abstract class FSEditLogOp {
} }
static SetXAttrOp getInstance(OpInstanceCache cache) { static SetXAttrOp getInstance(OpInstanceCache cache) {
return (SetXAttrOp) cache.get(OP_SET_XATTR); return cache.get(OP_SET_XATTR);
} }
@Override @Override
@ -4406,7 +4406,7 @@ public abstract class FSEditLogOp {
} }
static SetAclOp getInstance(OpInstanceCache cache) { static SetAclOp getInstance(OpInstanceCache cache) {
return (SetAclOp) cache.get(OP_SET_ACL); return cache.get(OP_SET_ACL);
} }
@Override @Override
@ -4507,8 +4507,7 @@ public abstract class FSEditLogOp {
} }
static AddErasureCodingPolicyOp getInstance(OpInstanceCache cache) { static AddErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (AddErasureCodingPolicyOp) cache return cache.get(OP_ADD_ERASURE_CODING_POLICY);
.get(OP_ADD_ERASURE_CODING_POLICY);
} }
@Override @Override
@ -4620,8 +4619,7 @@ public abstract class FSEditLogOp {
} }
static EnableErasureCodingPolicyOp getInstance(OpInstanceCache cache) { static EnableErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (EnableErasureCodingPolicyOp) cache return cache.get(OP_ENABLE_ERASURE_CODING_POLICY);
.get(OP_ENABLE_ERASURE_CODING_POLICY);
} }
@Override @Override
@ -4689,8 +4687,7 @@ public abstract class FSEditLogOp {
} }
static DisableErasureCodingPolicyOp getInstance(OpInstanceCache cache) { static DisableErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (DisableErasureCodingPolicyOp) cache return cache.get(OP_DISABLE_ERASURE_CODING_POLICY);
.get(OP_DISABLE_ERASURE_CODING_POLICY);
} }
@Override @Override
@ -4756,8 +4753,7 @@ public abstract class FSEditLogOp {
} }
static RemoveErasureCodingPolicyOp getInstance(OpInstanceCache cache) { static RemoveErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (RemoveErasureCodingPolicyOp) cache return cache.get(OP_REMOVE_ERASURE_CODING_POLICY);
.get(OP_REMOVE_ERASURE_CODING_POLICY);
} }
@Override @Override
@ -4879,7 +4875,7 @@ public abstract class FSEditLogOp {
} }
static SetStoragePolicyOp getInstance(OpInstanceCache cache) { static SetStoragePolicyOp getInstance(OpInstanceCache cache) {
return (SetStoragePolicyOp) cache.get(OP_SET_STORAGE_POLICY); return cache.get(OP_SET_STORAGE_POLICY);
} }
@Override @Override
@ -4946,7 +4942,7 @@ public abstract class FSEditLogOp {
} }
static RollingUpgradeStartOp getInstance(OpInstanceCache cache) { static RollingUpgradeStartOp getInstance(OpInstanceCache cache) {
return (RollingUpgradeStartOp) cache.get(OP_ROLLING_UPGRADE_START); return cache.get(OP_ROLLING_UPGRADE_START);
} }
} }
@ -4956,7 +4952,7 @@ public abstract class FSEditLogOp {
} }
static RollingUpgradeFinalizeOp getInstance(OpInstanceCache cache) { static RollingUpgradeFinalizeOp getInstance(OpInstanceCache cache) {
return (RollingUpgradeFinalizeOp) cache.get(OP_ROLLING_UPGRADE_FINALIZE); return cache.get(OP_ROLLING_UPGRADE_FINALIZE);
} }
} }

View File

@ -581,8 +581,8 @@ public class TestEditLogRace {
} }
static SetOwnerOp getSetOwnerOp(OpInstanceCache cache, String group) { static SetOwnerOp getSetOwnerOp(OpInstanceCache cache, String group) {
return ((SetOwnerOp)cache.get(OP_SET_OWNER)) SetOwnerOp setOwnerOp = cache.get(OP_SET_OWNER);
.setSource("/").setUser("u").setGroup(group); return setOwnerOp.setSource("/").setUser("u").setGroup(group);
} }
static class BlockingOpMatcher implements ArgumentMatcher<FSEditLogOp> { static class BlockingOpMatcher implements ArgumentMatcher<FSEditLogOp> {