refactor: remove unused code (#1303)

* refactor: remove unused imports and dead references

* chore: remove unused suppress warnings and cleanup formatting
This commit is contained in:
shrimptails-f authored and GitHub committed 2026-06-12 17:53:46 -05:00
1 parent e6748862b1
commit ee341003bf
37 files changed
+78 -142

No files matched your search

@@ -367,7 +367,7 @@ public class ApiGatewayExecuteController {
if (result.getFunctionError() != null) {
return new AuthorizerResult(Response.status(403).build(), null, null);
}
JsonNode policy = objectMapper.readTree(result.getPayload());
String effect = policy.path("policyDocument").path("Statement").get(0).path("Effect").asText("Deny");
if ("Deny".equalsIgnoreCase(effect)) {
@@ -699,7 +699,6 @@ public class ApiGatewayV2JsonHandler {
* field lookups work regardless of whether the request arrived via the
* REST path (lowerCamelCase body) or JSON 1.1 path (PascalCase body).
*/
@SuppressWarnings("unchecked")
private Map<String, Object> toLowerCamelCase(Map<String, Object> map) {
Map<String, Object> result = new LinkedHashMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
@@ -165,7 +165,6 @@ public class AppSyncService {
if (request.containsKey("openIDConnectConfig")) existing.setOpenIDConnectConfig((Map<String, Object>) request.get("openIDConnectConfig"));
if (request.containsKey("userPoolConfig")) existing.setUserPoolConfig((Map<String, Object>) request.get("userPoolConfig"));
if (request.containsKey("dns")) {
@SuppressWarnings("unchecked")
Map<String, String> dns = (Map<String, String>) request.get("dns");
existing.setDns(dns);
}
@@ -431,7 +430,6 @@ public class AppSyncService {
return paginate(functionStore.scan(k -> k.startsWith(apiId + "::")), nextToken, maxResults);
}
@SuppressWarnings("unchecked")
public FunctionConfiguration updateFunction(String apiId, String functionId, Map<String, Object> request) {
FunctionConfiguration existing = getFunction(apiId, functionId);
if (request.containsKey("description")) existing.setDescription((String) request.get("description"));
@@ -1,7 +1,6 @@
package io.github.hectorvent.floci.services.appsync.graphql;
import java.util.Set;
import java.util.stream.Collectors;
public enum AppSyncDirective {
AWS_API_KEY("aws_api_key", "directive @aws_api_key on OBJECT | FIELD_DEFINITION"),
@@ -10,7 +10,6 @@ import io.github.hectorvent.floci.services.appsync.graphql.scalars.AppSyncScalar
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -15,8 +15,6 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -815,7 +815,6 @@ public class CloudFormationResourceProvisioner {
}
}
@SuppressWarnings("unchecked")
private static Map<String, String> environmentVariables(Object value) {
if (!(value instanceof Map<?, ?> envBlock)) {
return Map.of();
@@ -81,7 +81,6 @@ public class CloudFormationService {
"cloudformation", "cloudformation-exports.json", new TypeReference<Map<String, String>>() {}));
}
@SuppressWarnings("unchecked")
private static <V> AccountAwareStorageBackend<V> asAccountAware(StorageBackend<String, V> backend) {
return (AccountAwareStorageBackend<V>) backend;
}
@@ -267,7 +267,6 @@ public class CodeBuildJsonHandler {
return Response.ok(Map.of("build", build)).build();
}
@SuppressWarnings("unchecked")
private <T> List<T> parseList(JsonNode req, String field, Class<T> type) throws Exception {
if (!req.has(field) || req.get(field).isNull()) {
return null;
@@ -325,7 +325,6 @@ public class CodeDeployJsonHandler {
return Response.ok(Map.of()).build();
}
@SuppressWarnings("unchecked")
private Map<String, Object> extractGroupFields(JsonNode req) throws Exception {
Map<String, Object> fields = new HashMap<>();
for (String field : new String[]{"ec2TagFilters", "onPremisesInstanceTagFilters", "autoScalingGroups",
@@ -26,7 +26,6 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -586,7 +585,6 @@ public class CodeDeployService {
// ---- Deployment state machine ----
@SuppressWarnings("unchecked")
// ---- On-Premises Instances ----
public OnPremisesInstance registerOnPremisesInstance(String region, String instanceName,
@@ -657,7 +655,6 @@ public class CodeDeployService {
// ---- Server Platform Deployment ----
@SuppressWarnings("unchecked")
private String createServerDeployment(String region, String appName, String groupName,
DeploymentGroup group, String configName,
Map<String, Object> revision, String description) {
@@ -811,7 +808,6 @@ public class CodeDeployService {
return true;
}
@SuppressWarnings("unchecked")
private boolean executeHookStepsOnInstance(String region, String instanceId,
List<Map<String, Object>> hookSteps,
Map<String, Object> event) throws InterruptedException {
@@ -911,7 +907,6 @@ public class CodeDeployService {
return info;
}
@SuppressWarnings("unchecked")
private List<String> resolveServerTargets(String region, DeploymentGroup group) {
List<String> instanceIds = new ArrayList<>();
@@ -765,7 +765,6 @@ final class CognitoAuthFlowHandler {
Boolean.TRUE.equals(resp.get("autoVerifyPhone")));
}
@SuppressWarnings("unchecked")
private CognitoService.ClaimsOverride firePreTokenGeneration(UserPool pool, UserPoolClient client, CognitoUser user,
Map<String, String> clientMetadata, String triggerSource) {
Map<String, Object> req = new HashMap<>();
@@ -791,7 +790,6 @@ final class CognitoAuthFlowHandler {
return null;
}
@SuppressWarnings("unchecked")
private static CognitoService.ClaimsOverride parseV1Override(Map<?, ?> details) {
Map<String, Object> claimsToAddOrOverride = asStringObjectMap(details.get("claimsToAddOrOverride"));
List<String> claimsToSuppress = asStringList(details.get("claimsToSuppress"));
@@ -817,7 +815,6 @@ final class CognitoAuthFlowHandler {
groupsToOverride, iamRolesToOverride, preferredRole);
}
@SuppressWarnings("unchecked")
private static CognitoService.ClaimsOverride parseV2Override(Map<?, ?> details) {
Map<String, Object> idAdd = null;
List<String> idSuppress = null;
@@ -879,7 +876,6 @@ final class CognitoAuthFlowHandler {
return cfg;
}
@SuppressWarnings("unchecked")
private CognitoUser tryUserMigration(UserPool pool, UserPoolClient client, String username, String password,
Map<String, String> validationData, Map<String, String> clientMetadata,
String triggerSource) {
@@ -13,7 +13,6 @@ import org.jboss.logging.Logger;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -14,7 +14,6 @@ import org.jboss.logging.Logger;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
@@ -7,8 +7,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsException;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.Map;
/**
* DynamoDB number validation and normalization.
@@ -1,9 +1,7 @@
package io.github.hectorvent.floci.services.dynamodb.model;
import io.github.hectorvent.floci.core.common.AwsException;
import com.fasterxml.jackson.databind.JsonNode;
import java.util.Map;
public class ConditionalCheckFailedException extends io.github.hectorvent.floci.core.common.AwsException {
@@ -343,16 +343,16 @@ public class Ec2Service {
return reservation;
}
public Subnet requireSubnet(String region, String subnetId) {
ensureDefaultResources(region);
Subnet subnet = subnets.get(key(region, subnetId));
if (subnet == null)
if (subnet == null)
throw new AwsException("InvalidSubnetID.NotFound", "The subnet ID '" + subnetId + "' does not exist", 400);
return subnet;
}
private String assignPrivateIp(String region, String subnetId) {
if (subnetId == null) {
return "172.31.0." + (10 + new Random().nextInt(200));
@@ -406,7 +406,7 @@ public class Ec2Service {
List<Map<String, String>> result = new ArrayList<>();
for (String id : instanceIds) {
Instance inst = getRequiredInstance(region, id);
if (config.services().ec2().mock() && "pending".equals(inst.getState().getName())) {
inst.setState(InstanceState.running());
}
@@ -437,7 +437,7 @@ public class Ec2Service {
List<Map<String, String>> result = new ArrayList<>();
for (String id : instanceIds) {
Instance inst = getRequiredInstance(region, id);
if (config.services().ec2().mock() && "pending".equals(inst.getState().getName())) {
inst.setState(InstanceState.running());
}
@@ -543,9 +543,9 @@ public class Ec2Service {
private Instance getRequiredInstance(String region, String instanceId) {
Instance inst = instances.get(key(region, instanceId));
if (inst == null)
if (inst == null)
throw new AwsException("InvalidInstanceID.NotFound", "The instance ID '" + instanceId + "' does not exist", 400);
return inst;
}
@@ -886,7 +886,7 @@ public class Ec2Service {
SecurityGroup sg = securityGroups.get(key(region, groupId));
if (sg == null)
throw new AwsException("InvalidGroup.NotFound", "The security group '" + groupId + "' does not exist", 400);
return sg;
}
@@ -1432,17 +1432,17 @@ public class Ec2Service {
private InternetGateway getRequiredInternetGateway(String region, String igwId) {
InternetGateway igw = internetGateways.get(key(region, igwId));
if (igw == null)
if (igw == null)
throw new AwsException("InvalidInternetGatewayID.NotFound", "The internet gateway '" + igwId + "' does not exist", 400);
return igw;
return igw;
}
// ─── Route Tables ──────────────────────────────────────────────────────────
public RouteTable createRouteTable(String region, String vpcId) {
ensureDefaultResources(region);
Vpc vpc = getRequiredVpc(region, vpcId);
Vpc vpc = getRequiredVpc(region, vpcId);
String rtId = "rtb-" + randomHex(8);
RouteTable rt = new RouteTable();
@@ -1461,7 +1461,7 @@ public class Ec2Service {
throw new AwsException("InvalidVpcID.NotFound", "The vpc ID '" + vpcId + "' does not exist", 400);
return vpc;
}
}
public List<RouteTable> describeRouteTables(String region, List<String> routeTableIds, Map<String, List<String>> filters) {
ensureDefaultResources(region);
@@ -1519,9 +1519,9 @@ public class Ec2Service {
private RouteTable getRequiredRouteTable(String region, String routeTableId) {
RouteTable rt = routeTables.get(key(region, routeTableId));
if (rt == null)
if (rt == null)
throw new AwsException("InvalidRouteTableID.NotFound", "The route table '" + routeTableId + "' does not exist", 400);
return rt;
}
@@ -1610,9 +1610,9 @@ public class Ec2Service {
private Address getRequiredAddress(String region, String allocationId) {
Address addr = addresses.get(key(region, allocationId));
if (addr == null)
if (addr == null)
throw new AwsException("InvalidAllocationID.NotFound", "The allocation ID '" + allocationId + "' does not exist", 400);
return addr;
}
@@ -1947,7 +1947,6 @@ public class Ec2Service {
return true;
}
@SuppressWarnings("unchecked")
private List<Tag> getResourceTags(Object resource) {
if (resource instanceof Instance inst) return inst.getTags();
if (resource instanceof Vpc vpc) return vpc.getTags();
@@ -502,13 +502,11 @@ public class LambdaService {
@SuppressWarnings("unchecked")
Map<String, Object> imageConfig = (Map<String, Object>) ic;
if (imageConfig.containsKey("Command")) {
@SuppressWarnings("unchecked")
List<String> cmd = imageConfig.get("Command") instanceof List<?>
? ((List<?>) imageConfig.get("Command")).stream().map(Object::toString).toList() : null;
fn.setImageConfigCommand(cmd);
}
if (imageConfig.containsKey("EntryPoint")) {
@SuppressWarnings("unchecked")
List<String> ep = imageConfig.get("EntryPoint") instanceof List<?>
? ((List<?>) imageConfig.get("EntryPoint")).stream().map(Object::toString).toList() : null;
fn.setImageConfigEntryPoint(ep);
@@ -832,7 +830,7 @@ public class LambdaService {
snapshot.setEnvironment(fn.getEnvironment());
snapshot.setLastModified(System.currentTimeMillis());
snapshot.setRevisionId(UUID.randomUUID().toString());
functionStore.save(region, snapshot);
LOG.infov("Published version {0} for function {1}", version, functionName);
return snapshot;
@@ -984,7 +982,7 @@ public class LambdaService {
functionName = ref.name();
qualifier = ref.qualifier();
LambdaUrlConfig urlConfig = getFunctionUrlConfig(region, functionName, qualifier);
if (request.containsKey("AuthType")) {
urlConfig.setAuthType((String) request.get("AuthType"));
}
@@ -17,10 +17,8 @@ import jakarta.inject.Inject;
import org.jboss.logging.Logger;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -76,7 +74,7 @@ public class MskService {
MskCluster cluster = new MskCluster(clusterArn, clusterName, resolvedKafkaVersion);
cluster.setAccountId(accountId);
cluster.setVolumeId(String.format("%06x", new SecureRandom().nextInt(0xFFFFFF)));
if (config.services().msk().mock()) {
cluster.setState(ClusterState.ACTIVE);
cluster.setBootstrapBrokers("localhost:9092");
@@ -224,7 +224,6 @@ public class PipesPoller {
}
}
try {
@SuppressWarnings("unchecked")
Map<String, Object> result = (pipeAccountId != null)
? kinesisService.getRecordsForAccount(pipeAccountId, iterator, batchSize, region)
: kinesisService.getRecords(iterator, batchSize, region);
@@ -232,7 +231,6 @@ public class PipesPoller {
if (nextIterator != null) {
kinesisIterators.put(pipeKey, nextIterator);
}
@SuppressWarnings("unchecked")
List<?> records = (List<?>) result.get("Records");
if (records == null || records.isEmpty()) {
return;
@@ -30,7 +30,6 @@ import java.net.URI;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -18,7 +18,6 @@ import java.security.SecureRandom;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -547,7 +547,6 @@ public class SsmCommandService {
};
}
@SuppressWarnings("unchecked")
private Map<String, List<String>> parseParameters(JsonNode parametersNode) {
if (parametersNode == null || parametersNode.isNull() || !parametersNode.isObject()) {
return Map.of();
@@ -9,7 +9,6 @@ import jakarta.enterprise.context.ApplicationScoped;
import java.time.Instant;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**