aboutsummaryrefslogtreecommitdiffstats
path: root/ajbrowser/src
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:06:37 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-08 03:06:37 +0200
commit72194b7982ddfa8e9864d0a9934905bb76b90f33 (patch)
treeebed806c358c1a3960c5d6be4c13b26ca41809df /ajbrowser/src
parentc3289ab86bfb2c97cf34147239b3dde46de92a7c (diff)
downloadaspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.tar.gz
aspectj-72194b7982ddfa8e9864d0a9934905bb76b90f33.zip
'for' loop replaceable with enhanced 'for' loop
Reports for loops which iterate over collections or arrays, and can be replaced with an enhanced for loop (i.e. the foreach iteration syntax). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'ajbrowser/src')
-rw-r--r--ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java6
-rw-r--r--ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java4
-rw-r--r--ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java3
-rw-r--r--ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java4
4 files changed, 8 insertions, 9 deletions
diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java
index 84bb63683..e59c16103 100644
--- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java
+++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java
@@ -183,9 +183,9 @@ public class BrowserManager {
private List<String> getConfigFilesList(String[] configFiles) {
List<String> configs = new ArrayList<String>();
- for (int i = 0; i < configFiles.length; i++) {
- if (configFiles[i].endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) {
- configs.add(configFiles[i]);
+ for (String configFile : configFiles) {
+ if (configFile.endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) {
+ configs.add(configFile);
}
}
return configs;
diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java
index 76c1b50e2..6d56a6f2a 100644
--- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java
+++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java
@@ -42,8 +42,8 @@ public class Main {
return false;
}
int numConfigFiles = 0;
- for (int i = 0; i < args.length; i++) {
- if ((null != args[i]) && args[i].endsWith(".lst")) {
+ for (String arg : args) {
+ if ((null != arg) && arg.endsWith(".lst")) {
numConfigFiles++;
}
}
diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java
index 35f676e1b..0295a9a24 100644
--- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java
+++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java
@@ -43,8 +43,7 @@ public class BrowserCompilerConfiguration implements ICompilerConfiguration {
classpath.append(userPath);
}
List<File> outputDirs = getOutputLocationManager().getAllOutputLocations();
- for (Iterator<File> iterator = outputDirs.iterator(); iterator.hasNext();) {
- File dir = (File) iterator.next();
+ for (File dir : outputDirs) {
classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator);
}
classpath.append(System.getProperty("java.class.path", "."));
diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java
index fa24f709f..d3abd95eb 100644
--- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java
+++ b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java
@@ -73,8 +73,8 @@ public class MessageHandlerPanel extends JPanel {
private void createList(List<IMessage> messages) {
list = new JList();
listModel = new DefaultListModel();
- for (Iterator<IMessage> iterator = messages.iterator(); iterator.hasNext();) {
- listModel.addElement(iterator.next());
+ for (IMessage message : messages) {
+ listModel.addElement(message);
}
}