From 0f3662fa2e1993e2c43f14dde31f0e8a5f4c5b57 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 16 Dec 2024 17:11:18 -0800 Subject: [PATCH] Remove redundant casts --- src/main/java/hudson/plugins/ec2/EC2Cloud.java | 2 +- .../hudson/plugins/ec2/util/MinimumInstanceChecker.java | 2 +- .../java/hudson/plugins/ec2/EC2RetentionStrategyTest.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/hudson/plugins/ec2/EC2Cloud.java b/src/main/java/hudson/plugins/ec2/EC2Cloud.java index 3e6cb3b02..44cd7057d 100644 --- a/src/main/java/hudson/plugins/ec2/EC2Cloud.java +++ b/src/main/java/hudson/plugins/ec2/EC2Cloud.java @@ -1105,7 +1105,7 @@ private static AmazonWebServicesCredentials getCredentials(@CheckForNull String if (StringUtils.isBlank(credentialsId)) { return null; } - return (AmazonWebServicesCredentials) CredentialsMatchers.firstOrNull( + return CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials( AmazonWebServicesCredentials.class, Jenkins.get(), ACL.SYSTEM, Collections.emptyList()), CredentialsMatchers.withId(credentialsId)); diff --git a/src/main/java/hudson/plugins/ec2/util/MinimumInstanceChecker.java b/src/main/java/hudson/plugins/ec2/util/MinimumInstanceChecker.java index 5841d3e5c..8443a531b 100644 --- a/src/main/java/hudson/plugins/ec2/util/MinimumInstanceChecker.java +++ b/src/main/java/hudson/plugins/ec2/util/MinimumInstanceChecker.java @@ -25,7 +25,7 @@ public class MinimumInstanceChecker { public static Clock clock = Clock.systemDefaultZone(); private static Stream agentsForTemplate(@NonNull SlaveTemplate agentTemplate) { - return (Stream) Arrays.stream(Jenkins.get().getComputers()) + return Arrays.stream(Jenkins.get().getComputers()) .filter(EC2Computer.class::isInstance) .filter(computer -> { SlaveTemplate computerTemplate = ((EC2Computer) computer).getSlaveTemplate(); diff --git a/src/test/java/hudson/plugins/ec2/EC2RetentionStrategyTest.java b/src/test/java/hudson/plugins/ec2/EC2RetentionStrategyTest.java index 2812ff288..ce5e8766a 100644 --- a/src/test/java/hudson/plugins/ec2/EC2RetentionStrategyTest.java +++ b/src/test/java/hudson/plugins/ec2/EC2RetentionStrategyTest.java @@ -84,7 +84,7 @@ public void testOnBillingHourRetention() throws Exception { checkRetentionStrategy(rs, computer); assertEquals( "Expected " + t[0] + "m" + t[1] + "s to be " + expected.get(i), - (boolean) expected.get(i), + expected.get(i), idleTimeoutCalled.get()); // reset the assumption idleTimeoutCalled.set(false); @@ -474,13 +474,13 @@ public void testOnUsageCountRetention() throws Exception { } // As we want to terminate agent both for usageCount 1 & 0 - setting this to true if (usageCount == 1 || usageCount == 0) { - assertEquals("Expected " + usageCount + " to be " + true, (boolean) true, terminateCalled.get()); + assertEquals("Expected " + usageCount + " to be " + true, true, terminateCalled.get()); // Reset the assumption terminateCalled.set(false); } else { assertEquals( "Expected " + usageCount + " to be " + expected.get(i), - (boolean) expected.get(i), + expected.get(i), terminateCalled.get()); } }