From 2091b6d1ded90bfeb29f8d74bd17f05ec8fc983d Mon Sep 17 00:00:00 2001 From: Andrey Turbanov Date: Wed, 13 Apr 2022 13:51:39 +0300 Subject: Reduce 'Object' class usage --- build/src/main/java/$installer$/org/aspectj/Main.java | 2 +- build/src/main/java/org/aspectj/internal/tools/build/Builder.java | 7 +++---- .../main/java/org/aspectj/internal/tools/build/SampleGatherer.java | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'build/src/main') diff --git a/build/src/main/java/$installer$/org/aspectj/Main.java b/build/src/main/java/$installer$/org/aspectj/Main.java index fa98b8ed0..cf408425b 100644 --- a/build/src/main/java/$installer$/org/aspectj/Main.java +++ b/build/src/main/java/$installer$/org/aspectj/Main.java @@ -839,7 +839,7 @@ abstract class WizardPane { buf.append(text.substring(lastIndex, startIndex)); String key = text.substring(startIndex + 2, endIndex); lastIndex = endIndex + 1; - Object replaceText = (map == null ? null : map.get(key)); + String replaceText = (map == null ? null : map.get(key)); //System.out.println("key: " + key + " -> " + replaceText); if (replaceText == null) { replaceText = "NOT_FOUND"; diff --git a/build/src/main/java/org/aspectj/internal/tools/build/Builder.java b/build/src/main/java/org/aspectj/internal/tools/build/Builder.java index 71cb3bac2..d13c4de95 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/Builder.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/Builder.java @@ -180,7 +180,7 @@ public abstract class Builder { private final File tempDir; - private final List tempFiles; + private final List tempFiles; private final boolean useEclipseCompiles; @@ -190,7 +190,7 @@ public abstract class Builder { Util.iaxIfNull(handler, "handler"); this.useEclipseCompiles = useEclipseCompiles; this.handler = handler; - this.tempFiles = new ArrayList(); + this.tempFiles = new ArrayList<>(); if ((null == tempDir) || !tempDir.canWrite() || !tempDir.isDirectory()) { this.tempDir = Util.makeTempDir("Builder"); } else { @@ -293,8 +293,7 @@ public abstract class Builder { */ public boolean cleanup() { boolean noErr = true; - for (Object tempFile : tempFiles) { - File file = (File) tempFile; + for (File file : tempFiles) { if (!Util.deleteContents(file) || !file.delete()) { if (noErr) { noErr = false; diff --git a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java index 29468af65..08b363f0a 100644 --- a/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java +++ b/build/src/main/java/org/aspectj/internal/tools/build/SampleGatherer.java @@ -804,10 +804,9 @@ class SampleUtil { public static final String SAMPLE_BASE_DIR_NAME = "sandbox"; public static void simpleRender(Samples result, StringBuffer sink) { - List sortedSamples = result.getSortedSamples(); + List sortedSamples = result.getSortedSamples(); int i = 0; - for (Object sortedSample : sortedSamples) { - Sample sample = (Sample) sortedSample; + for (Sample sample : sortedSamples) { sink.append(i++ + ": " + sample); } } -- cgit v1.2.3