Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2022-02-22 10:48:33 +0000
committerEd Merks2022-02-22 10:48:33 +0000
commitc7ad4caefc14b2eff9f4114f4fed263c3a81ff30 (patch)
treedbe1a38c54be7f6e345f58fc58440a40a548a583 /plugins/org.eclipse.oomph.util/src/org
parent81a13aedcfba552d244a9a94a263c667fc6918e6 (diff)
downloadorg.eclipse.oomph-c7ad4caefc14b2eff9f4114f4fed263c3a81ff30.tar.gz
org.eclipse.oomph-c7ad4caefc14b2eff9f4114f4fed263c3a81ff30.tar.xz
org.eclipse.oomph-c7ad4caefc14b2eff9f4114f4fed263c3a81ff30.zip
[578891] Accommodate the latest changes in p2, particularly around the
support for PGP keys https://bugs.eclipse.org/bugs/show_bug.cgi?id=578891
Diffstat (limited to 'plugins/org.eclipse.oomph.util/src/org')
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/HTTPServer.java14
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/UtilPlugin.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/AbstractRange.java30
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Cell.java7
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/ComposedRange.java10
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Coordinate.java8
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Formula.java5
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Generator.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/AbstractIterator.java12
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/CollectionUtil.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ComposedIterator.java5
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Confirmer.java3
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java8
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java10
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OomphPlugin.java10
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Pair.java6
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Predicates.java13
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ProbingSubMonitor.java16
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertiesUtil.java10
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertyFile.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Request.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ServiceUtil.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/StringUtil.java2
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/SubMonitor.java10
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ThreadPool.java1
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/WorkerPool.java13
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/XMLUtil.java1
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ZIPUtil.java4
28 files changed, 137 insertions, 73 deletions
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/HTTPServer.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/HTTPServer.java
index bfa1ff58a..c14b3c4bc 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/HTTPServer.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/HTTPServer.java
@@ -64,7 +64,7 @@ public final class HTTPServer
private static final boolean DEBUG_RESPONSE = false;
- private static final Map<String, String> CONTENT_TYPES = new HashMap<String, String>();
+ private static final Map<String, String> CONTENT_TYPES = new HashMap<>();
private static final ImageContext IMAGE_CONTEXT = new ImageContext();
@@ -86,7 +86,7 @@ public final class HTTPServer
private static final String STATUS_NOT_IMPLEMENTED = "501 Not Implemented";
- private final List<Context> contexts = new ArrayList<Context>();
+ private final List<Context> contexts = new ArrayList<>();
private final ExecutorService threadPool = Executors.newCachedThreadPool();
@@ -304,6 +304,7 @@ public final class HTTPServer
this.socket = socket;
}
+ @Override
public void run()
{
InputStream inputStream = null;
@@ -486,6 +487,7 @@ public final class HTTPServer
return allowDirectory;
}
+ @Override
public final int compareTo(Context o)
{
return o.path.length() - path.length();
@@ -546,6 +548,7 @@ public final class HTTPServer
final String finalPath = path;
Arrays.sort(children, new Comparator<String>()
{
+ @Override
public int compare(String n1, String n2)
{
int t1 = getType(n1);
@@ -705,12 +708,7 @@ public final class HTTPServer
}
catch (IOException ex)
{
- if (ignoreExceptions)
- {
- return;
- }
-
- if (ex instanceof SocketException && ex.getMessage().equals("Software caused connection abort: socket write error"))
+ if (ignoreExceptions || (ex instanceof SocketException && ex.getMessage().equals("Software caused connection abort: socket write error")))
{
return;
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/UtilPlugin.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/UtilPlugin.java
index 494867aa2..98af23ee0 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/UtilPlugin.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/UtilPlugin.java
@@ -36,11 +36,13 @@ public final class UtilPlugin extends OomphPlugin
return "/instance/org.eclipse.ui.workbench//org.eclipse.ui.commands/state/" + id + "/org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Override
public void setEnabled(String id, boolean enabled)
{
preferences.putBoolean(getPreferenceKey(id), enabled);
}
+ @Override
public boolean isEnabled(String id)
{
return preferences.getBoolean(getPreferenceKey(id), false);
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/AbstractRange.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/AbstractRange.java
index 39be994e6..49c9b4a14 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/AbstractRange.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/AbstractRange.java
@@ -25,24 +25,29 @@ import java.util.Set;
*/
public abstract class AbstractRange implements Range
{
+ @Override
public abstract Table table();
+ @Override
public abstract Iterator<Cell> iterator();
+ @Override
public Set<Cell> set()
{
- Set<Cell> set = new HashSet<Cell>();
+ Set<Cell> set = new HashSet<>();
fillCells(set);
return set;
}
+ @Override
public List<Cell> list()
{
- List<Cell> list = new ArrayList<Cell>();
+ List<Cell> list = new ArrayList<>();
fillCells(list);
return list;
}
+ @Override
public int accept(Visitor visitor) throws Exception
{
int n = 0;
@@ -57,6 +62,7 @@ public abstract class AbstractRange implements Range
return n;
}
+ @Override
public boolean contains(int col, int row)
{
for (Cell cell : this)
@@ -70,16 +76,19 @@ public abstract class AbstractRange implements Range
return false;
}
+ @Override
public boolean contains(Coordinate coordinate)
{
return contains(coordinate.col, coordinate.row);
}
+ @Override
public boolean contains(Cell cell)
{
return contains(cell.col, cell.row);
}
+ @Override
public boolean contains(Range range)
{
for (Cell cell : range)
@@ -93,43 +102,51 @@ public abstract class AbstractRange implements Range
return true;
}
+ @Override
public Range offset(int cols, int rows)
{
return new OffsetRange(this, cols, rows);
}
+ @Override
public Range addRange(Coordinate coordinate1, Coordinate coordinate2)
{
return addRanges(table().range(coordinate1, coordinate2));
}
+ @Override
public Range addRange(int col1, int row1, int col2, int row2)
{
return addRange(new Coordinate(col1, row1), new Coordinate(col2, row2));
}
+ @Override
public Range addRanges(Range... ranges)
{
Range result = new ComposedRange(table(), this);
return result.addRanges(ranges);
}
+ @Override
public Range subtractRange(Coordinate coordinate1, Coordinate coordinate2)
{
return subtractRanges(table().range(coordinate1, coordinate2));
}
+ @Override
public Range subtractRange(int col1, int row1, int col2, int row2)
{
return subtractRange(new Coordinate(col1, row1), new Coordinate(col2, row2));
}
+ @Override
public Range subtractRanges(Range... ranges)
{
Range result = new ComposedRange(table(), this);
return result.subtractRanges(ranges);
}
+ @Override
public Range value(Object value)
{
for (Cell cell : this)
@@ -140,6 +157,7 @@ public abstract class AbstractRange implements Range
return this;
}
+ @Override
public Range format(Format format)
{
for (Cell cell : this)
@@ -150,6 +168,7 @@ public abstract class AbstractRange implements Range
return this;
}
+ @Override
public Range alignment(Alignment alignment)
{
for (Cell cell : this)
@@ -174,12 +193,7 @@ public abstract class AbstractRange implements Range
return true;
}
- if (obj == null)
- {
- return false;
- }
-
- if (getClass() != obj.getClass())
+ if ((obj == null) || (getClass() != obj.getClass()))
{
return false;
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Cell.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Cell.java
index 1a63234bd..b305ecdde 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Cell.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Cell.java
@@ -185,12 +185,7 @@ public final class Cell extends AbstractRange
return true;
}
- if (obj == null)
- {
- return false;
- }
-
- if (Cell.class != obj.getClass())
+ if ((obj == null) || (Cell.class != obj.getClass()))
{
return false;
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/ComposedRange.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/ComposedRange.java
index 444f119a0..1d7cf1bfc 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/ComposedRange.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/ComposedRange.java
@@ -28,9 +28,9 @@ final class ComposedRange extends AbstractRange
{
final Table table;
- final List<Range> inclusions = new ArrayList<Range>();
+ final List<Range> inclusions = new ArrayList<>();
- final List<Range> exclusions = new ArrayList<Range>();
+ final List<Range> exclusions = new ArrayList<>();
public ComposedRange(ComposedRange source)
{
@@ -76,7 +76,7 @@ final class ComposedRange extends AbstractRange
Iterator<Cell> iterator = ComposedIterator.fromIterables(inclusions);
if (!exclusions.isEmpty())
{
- Set<Cell> excludedCells = new HashSet<Cell>();
+ Set<Cell> excludedCells = new HashSet<>();
for (Range range : exclusions)
{
for (Cell cell : range)
@@ -85,10 +85,10 @@ final class ComposedRange extends AbstractRange
}
}
- iterator = new PredicateIterator<Cell>(Predicates.excluded(excludedCells), iterator);
+ iterator = new PredicateIterator<>(Predicates.excluded(excludedCells), iterator);
}
- return new PredicateIterator<Cell>(Predicates.unique(), iterator);
+ return new PredicateIterator<>(Predicates.unique(), iterator);
}
private static void addRanges(List<Range> list, Range... ranges)
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Coordinate.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Coordinate.java
index abcd1d97b..84afef5a5 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Coordinate.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Coordinate.java
@@ -60,12 +60,7 @@ public final class Coordinate implements Comparable<Coordinate>
return true;
}
- if (obj == null)
- {
- return false;
- }
-
- if (Coordinate.class != obj.getClass())
+ if ((obj == null) || (Coordinate.class != obj.getClass()))
{
return false;
}
@@ -74,6 +69,7 @@ public final class Coordinate implements Comparable<Coordinate>
return col == other.col && row == other.row;
}
+ @Override
public int compareTo(Coordinate o)
{
int result = row - o.row;
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Formula.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Formula.java
index 3e29b5794..8db63a91f 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Formula.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Formula.java
@@ -29,6 +29,7 @@ public interface Formula
this.range = range;
}
+ @Override
public Double evaluate()
{
double sum = 0.0;
@@ -57,6 +58,7 @@ public interface Formula
this.range = range;
}
+ @Override
public Double evaluate()
{
double min = Double.MAX_VALUE;
@@ -88,6 +90,7 @@ public interface Formula
this.range = range;
}
+ @Override
public Double evaluate()
{
double max = Double.MIN_VALUE;
@@ -119,6 +122,7 @@ public interface Formula
this.range = range;
}
+ @Override
public Double evaluate()
{
double sum = 0.0;
@@ -154,6 +158,7 @@ public interface Formula
this.range = range;
}
+ @Override
public Integer evaluate()
{
int count = 0;
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Generator.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Generator.java
index 49f543671..c4228eed5 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Generator.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/internal/util/table/Generator.java
@@ -62,6 +62,7 @@ public interface Generator
return value;
}
+ @Override
public Object nextValue()
{
try
@@ -108,6 +109,7 @@ public interface Generator
return repeat;
}
+ @Override
public T nextValue()
{
if (iterator.hasNext())
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/AbstractIterator.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/AbstractIterator.java
index 8c8085c35..1f33f7e5d 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/AbstractIterator.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/AbstractIterator.java
@@ -34,6 +34,7 @@ public abstract class AbstractIterator<T> implements Iterator<T>
{
}
+ @Override
public final boolean hasNext()
{
if (nextComputed)
@@ -55,6 +56,7 @@ public abstract class AbstractIterator<T> implements Iterator<T>
return true;
}
+ @Override
public final T next()
{
if (!hasNext())
@@ -66,6 +68,7 @@ public abstract class AbstractIterator<T> implements Iterator<T>
return next;
}
+ @Override
public void remove()
{
throw new UnsupportedOperationException();
@@ -89,46 +92,55 @@ public abstract class AbstractIterator<T> implements Iterator<T>
{
private static final ListIterator<Object> INSTANCE = new EmptyIterator();
+ @Override
public boolean hasNext()
{
return false;
}
+ @Override
public Object next()
{
throw new NoSuchElementException();
}
+ @Override
public boolean hasPrevious()
{
return false;
}
+ @Override
public Object previous()
{
throw new NoSuchElementException();
}
+ @Override
public int nextIndex()
{
throw new NoSuchElementException();
}
+ @Override
public int previousIndex()
{
throw new NoSuchElementException();
}
+ @Override
public void remove()
{
throw new UnsupportedOperationException();
}
+ @Override
public void set(Object e)
{
throw new UnsupportedOperationException();
}
+ @Override
public void add(Object e)
{
throw new UnsupportedOperationException();
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/CollectionUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/CollectionUtil.java
index 82f955585..05e2b457f 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/CollectionUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/CollectionUtil.java
@@ -29,7 +29,7 @@ public final class CollectionUtil
Set<V> set = map.get(key);
if (set == null)
{
- set = new LinkedHashSet<V>();
+ set = new LinkedHashSet<>();
map.put(key, set);
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ComposedIterator.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ComposedIterator.java
index baf38a155..1872b45cf 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ComposedIterator.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ComposedIterator.java
@@ -27,6 +27,7 @@ public class ComposedIterator<T> extends AbstractIterator<T>
private Iterator<T> currentDelegate;
+ @SafeVarargs
public ComposedIterator(Iterator<T>... delegates)
{
this(Arrays.asList(delegates));
@@ -66,12 +67,12 @@ public class ComposedIterator<T> extends AbstractIterator<T>
public static <T> Iterator<T> fromIterables(Collection<? extends Iterable<T>> iterables)
{
- List<Iterator<T>> iterators = new ArrayList<Iterator<T>>();
+ List<Iterator<T>> iterators = new ArrayList<>();
for (Iterable<T> iterable : iterables)
{
iterators.add(iterable.iterator());
}
- return new ComposedIterator<T>(iterators.iterator());
+ return new ComposedIterator<>(iterators.iterator());
}
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Confirmer.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Confirmer.java
index 204fc5e22..1cf8d9ffc 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Confirmer.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Confirmer.java
@@ -17,6 +17,7 @@ public interface Confirmer
{
public static final Confirmer ACCEPT = new Confirmer()
{
+ @Override
public Confirmation confirm(boolean defaultConfirmed, Object info)
{
return new Confirmation(true, false);
@@ -25,6 +26,7 @@ public interface Confirmer
public static final Confirmer DECLINE = new Confirmer()
{
+ @Override
public Confirmation confirm(boolean defaultConfirmed, Object info)
{
return new Confirmation(false, false);
@@ -33,6 +35,7 @@ public interface Confirmer
public static final Confirmer DEFAULT = new Confirmer()
{
+ @Override
public Confirmation confirm(boolean defaultConfirmed, Object info)
{
return new Confirmation(defaultConfirmed, false);
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java
index 7b577e632..7ff080d4b 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/IOUtil.java
@@ -724,7 +724,7 @@ public final class IOUtil
public static List<String> readLines(File file, String charsetName)
{
- List<String> lines = new ArrayList<String>();
+ List<String> lines = new ArrayList<>();
if (file.exists())
{
@@ -750,7 +750,7 @@ public final class IOUtil
public static List<String> readLines(InputStream in, String charsetName)
{
- List<String> lines = new ArrayList<String>();
+ List<String> lines = new ArrayList<>();
Reader reader = null;
BufferedReader bufferedReader = null;
@@ -1042,7 +1042,7 @@ public final class IOUtil
*/
private static class FileCollector implements IOVisitor
{
- private List<File> files = new ArrayList<File>();
+ private List<File> files = new ArrayList<>();
public FileCollector()
{
@@ -1053,6 +1053,7 @@ public final class IOUtil
return files;
}
+ @Override
public boolean visit(File file) throws IOException
{
files.add(file);
@@ -1082,6 +1083,7 @@ public final class IOUtil
this.classLoader = classLoader;
}
+ @Override
public Class<?> resolveClass(ObjectStreamClass v) throws ClassNotFoundException
{
String className = v.getName();
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java
index d195005d5..9d9aed198 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java
@@ -325,7 +325,7 @@ public abstract class OS
private static List<OS> createAll()
{
- List<OS> result = new ArrayList<OS>();
+ List<OS> result = new ArrayList<>();
result.add(Win64.INSTANCE);
result.add(Win32.INSTANCE);
@@ -410,7 +410,7 @@ public abstract class OS
{
if (terminal)
{
- List<String> terminalCommand = new ArrayList<String>();
+ List<String> terminalCommand = new ArrayList<>();
terminalCommand.add("cmd"); //$NON-NLS-1$
terminalCommand.add("/C"); //$NON-NLS-1$
terminalCommand.add("start"); //$NON-NLS-1$
@@ -533,7 +533,7 @@ public abstract class OS
String commandLine = getCommandLine(command);
IOUtil.writeUTF8(commandFile, commandLine);
- List<String> chmodCommand = new ArrayList<String>();
+ List<String> chmodCommand = new ArrayList<>();
chmodCommand.add("chmod"); //$NON-NLS-1$
chmodCommand.add("a+x"); //$NON-NLS-1$
chmodCommand.add(commandPath);
@@ -542,7 +542,7 @@ public abstract class OS
Process chmodProcess = chmodProcessBuilder.start();
chmodProcess.waitFor();
- List<String> terminalCommand = new ArrayList<String>();
+ List<String> terminalCommand = new ArrayList<>();
terminalCommand.add("open"); //$NON-NLS-1$
terminalCommand.add("-b"); //$NON-NLS-1$
terminalCommand.add("com.apple.terminal"); //$NON-NLS-1$
@@ -631,7 +631,7 @@ public abstract class OS
{
try
{
- List<String> terminalCommand = new ArrayList<String>();
+ List<String> terminalCommand = new ArrayList<>();
terminalCommand.add(xterm);
terminalCommand.add("-e"); //$NON-NLS-1$
terminalCommand.add(commandLine);
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OomphPlugin.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OomphPlugin.java
index 3d991c10d..9a6e9d668 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OomphPlugin.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OomphPlugin.java
@@ -198,20 +198,24 @@ public abstract class OomphPlugin extends EMFPlugin
{
return new ILog()
{
+ @Override
public void removeLogListener(ILogListener listener)
{
}
+ @Override
public void log(IStatus status)
{
System.out.println(status);
}
+ @Override
public Bundle getBundle()
{
return null;
}
+ @Override
public void addLogListener(ILogListener listener)
{
}
@@ -580,7 +584,7 @@ public abstract class OomphPlugin extends EMFPlugin
public static List<File> getClassPath(Bundle bundle) throws Exception
{
- final List<File> cp = new ArrayList<File>();
+ final List<File> cp = new ArrayList<>();
final File file = FileLocator.getBundleFile(bundle);
if (file.isFile())
@@ -599,6 +603,7 @@ public abstract class OomphPlugin extends EMFPlugin
Element rootElement = XMLUtil.loadRootElement(documentBuilder, classpathFile);
XMLUtil.handleElementsByTagName(rootElement, "classpathentry", new XMLUtil.ElementHandler() //$NON-NLS-1$
{
+ @Override
public void handleElement(Element element) throws Exception
{
if ("output".equals(element.getAttribute("kind"))) //$NON-NLS-1$ //$NON-NLS-2$
@@ -708,7 +713,7 @@ public abstract class OomphPlugin extends EMFPlugin
{
if (children == null)
{
- children = new ArrayList<BundleFile>();
+ children = new ArrayList<>();
Bundle bundle = getBundle();
String path = "/" + getPath(); //$NON-NLS-1$
@@ -882,6 +887,7 @@ public abstract class OomphPlugin extends EMFPlugin
}
}
+ @Override
public int compareTo(BundleFile o)
{
return name.compareTo(o.getName());
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Pair.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Pair.java
index 462339997..8465d649d 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Pair.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Pair.java
@@ -86,16 +86,16 @@ public class Pair<T1, T2>
public Pair<T1, T2> copy()
{
- return new Pair<T1, T2>(this);
+ return new Pair<>(this);
}
public static <T1, T2> Pair<T1, T2> create()
{
- return new Pair<T1, T2>();
+ return new Pair<>();
}
public static <T1, T2> Pair<T1, T2> create(T1 element1, T2 element2)
{
- return new Pair<T1, T2>(element1, element2);
+ return new Pair<>(element1, element2);
}
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Predicates.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Predicates.java
index 5a735d691..c723c4fce 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Predicates.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Predicates.java
@@ -24,17 +24,17 @@ public final class Predicates
public static <T> Predicate<T> included(Set<T> inclusions)
{
- return new IncludedPredicate<T>(inclusions);
+ return new IncludedPredicate<>(inclusions);
}
public static <T> Predicate<T> excluded(Set<T> exclusions)
{
- return new ExcludedPredicate<T>(exclusions);
+ return new ExcludedPredicate<>(exclusions);
}
public static <T> Predicate<T> unique()
{
- return new UniquePredicate<T>();
+ return new UniquePredicate<>();
}
@SuppressWarnings("unchecked")
@@ -61,6 +61,7 @@ public final class Predicates
this.inclusions = inclusions;
}
+ @Override
public boolean apply(T element)
{
return inclusions.contains(element);
@@ -79,6 +80,7 @@ public final class Predicates
this.exclusions = exclusions;
}
+ @Override
public boolean apply(T element)
{
return !exclusions.contains(element);
@@ -90,8 +92,9 @@ public final class Predicates
*/
public static final class UniquePredicate<T> implements Predicate<T>
{
- private final Set<T> applied = new HashSet<T>();
+ private final Set<T> applied = new HashSet<>();
+ @Override
public boolean apply(T element)
{
return applied.add(element);
@@ -105,6 +108,7 @@ public final class Predicates
{
private static final Predicate<Object> INSTANCE = new FalsePredicate();
+ @Override
public boolean apply(Object element)
{
return false;
@@ -118,6 +122,7 @@ public final class Predicates
{
private static final Predicate<Object> INSTANCE = new TruePredicate();
+ @Override
public boolean apply(Object element)
{
return true;
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ProbingSubMonitor.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ProbingSubMonitor.java
index 344fc8f9d..93695a34f 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ProbingSubMonitor.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ProbingSubMonitor.java
@@ -95,11 +95,11 @@ public final class ProbingSubMonitor extends org.eclipse.oomph.util.SubMonitor
{
private static final boolean TRACE = Boolean.getBoolean("submonitor.probing.trace"); //$NON-NLS-1$
- private static final Map<StackTraceElement, Statistics> STATISTICS = new HashMap<StackTraceElement, Statistics>();
+ private static final Map<StackTraceElement, Statistics> STATISTICS = new HashMap<>();
- private static final Map<Integer, KeyedWeakReference> MAP = new ConcurrentHashMap<Integer, KeyedWeakReference>();
+ private static final Map<Integer, KeyedWeakReference> MAP = new ConcurrentHashMap<>();
- private static final ReferenceQueue<ProbingSubMonitor> QUEUE = new ReferenceQueue<ProbingSubMonitor>();
+ private static final ReferenceQueue<ProbingSubMonitor> QUEUE = new ReferenceQueue<>();
private static final AtomicInteger COUNTER = new AtomicInteger();
@@ -119,7 +119,7 @@ public final class ProbingSubMonitor extends org.eclipse.oomph.util.SubMonitor
private final int key;
- private final Map<StackTraceElement, Probe> probes = new HashMap<StackTraceElement, Probe>();
+ private final Map<StackTraceElement, Probe> probes = new HashMap<>();
private StackTraceElement location = determineLocation();
@@ -522,11 +522,11 @@ public final class ProbingSubMonitor extends org.eclipse.oomph.util.SubMonitor
List<Row> newRows;
if (rows == null)
{
- newRows = new ArrayList<Row>(10);
+ newRows = new ArrayList<>(10);
}
else
{
- newRows = new ArrayList<Row>(10 + rows.length);
+ newRows = new ArrayList<>(10 + rows.length);
for (int i = 0; i < rows.length; i++)
{
Row row = rows[i];
@@ -653,7 +653,7 @@ public final class ProbingSubMonitor extends org.eclipse.oomph.util.SubMonitor
{
if (forkTargets.length != 1 || probe.forkTargets.length != 1 || !forkTargets[0].equals(probe.forkTargets[0]))
{
- Set<StackTraceElement> set = new HashSet<StackTraceElement>();
+ Set<StackTraceElement> set = new HashSet<>();
set.addAll(Arrays.asList(forkTargets));
set.addAll(Arrays.asList(probe.forkTargets));
@@ -678,6 +678,7 @@ public final class ProbingSubMonitor extends org.eclipse.oomph.util.SubMonitor
public abstract void footer(Table table, int rows);
+ @Override
public int compareTo(Row o)
{
int result = location.getFileName().compareTo(o.location.getFileName());
@@ -769,6 +770,7 @@ public final class ProbingSubMonitor extends org.eclipse.oomph.util.SubMonitor
table.cell(++col, row).format(MILLIS).value(max);
table.cell(++col, row).format(MILLIS).value(new Formula()
{
+ @Override
public Object evaluate()
{
return max - min;
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertiesUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertiesUtil.java
index e39c4a99a..4b2fc275a 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertiesUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertiesUtil.java
@@ -215,12 +215,12 @@ public final class PropertiesUtil
Collection<String> keys = properties.keySet();
if (sort)
{
- List<String> keyList = new ArrayList<String>(keys);
+ List<String> keyList = new ArrayList<>(keys);
Collections.sort(keyList);
keys = keyList;
}
- LinkedHashMap<Object, Object> objectMap = new LinkedHashMap<Object, Object>();
+ LinkedHashMap<Object, Object> objectMap = new LinkedHashMap<>();
for (String key : keys)
{
objectMap.put(key, properties.get(key));
@@ -235,12 +235,12 @@ public final class PropertiesUtil
Collection<String> keys = properties.keySet();
if (sort)
{
- List<String> keyList = new ArrayList<String>(keys);
+ List<String> keyList = new ArrayList<>(keys);
Collections.sort(keyList);
keys = keyList;
}
- Vector<Object> keyVector = new Vector<Object>();
+ Vector<Object> keyVector = new Vector<>();
for (String key : keys)
{
keyVector.add(key);
@@ -340,6 +340,6 @@ public final class PropertiesUtil
return loadProperties(file);
}
- return new LinkedHashMap<String, String>();
+ return new LinkedHashMap<>();
}
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertyFile.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertyFile.java
index f377ec4c3..44a172a51 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertyFile.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/PropertyFile.java
@@ -92,7 +92,7 @@ public class PropertyFile
// Ignore.
}
- return new LinkedHashMap<String, String>();
+ return new LinkedHashMap<>();
}
public void saveProperties(Map<String, String> properties)
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Request.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Request.java
index a3b3858f3..a64f2691e 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Request.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/Request.java
@@ -142,6 +142,7 @@ public final class Request extends HashMap<String, String>
{
public static final Handler SYSTEM_BROWSER = new Handler()
{
+ @Override
public boolean handleRequest(Request request)
{
return OS.INSTANCE.openSystemBrowser(request.getURI().toString());
@@ -162,6 +163,7 @@ public final class Request extends HashMap<String, String>
this.delegate = delegate;
}
+ @Override
public boolean handleRequest(Request request)
{
request = request.copy();
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ServiceUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ServiceUtil.java
index a22b432b4..56f19de6d 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ServiceUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ServiceUtil.java
@@ -23,7 +23,7 @@ import java.util.Map;
*/
public final class ServiceUtil
{
- private static Map<Object, ServiceReference<?>> services = new IdentityHashMap<Object, ServiceReference<?>>();
+ private static Map<Object, ServiceReference<?>> services = new IdentityHashMap<>();
private ServiceUtil()
{
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/StringUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/StringUtil.java
index 15e79dc86..1579764d3 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/StringUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/StringUtil.java
@@ -352,7 +352,7 @@ public final class StringUtil
public static List<String> explode(String string, String separators, char escapeCharacter)
{
- List<String> tokens = new ArrayList<String>();
+ List<String> tokens = new ArrayList<>();
StringBuilder builder = new StringBuilder();
boolean separator = false;
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/SubMonitor.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/SubMonitor.java
index 15ecfb639..321ee8114 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/SubMonitor.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/SubMonitor.java
@@ -547,6 +547,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitor#isCanceled()
*/
+ @Override
public final boolean isCanceled()
{
return root.isCanceled();
@@ -556,6 +557,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitor#setTaskName(java.lang.String)
*/
+ @Override
public final void setTaskName(String name)
{
checkCancelation();
@@ -580,6 +582,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
*
* @see org.eclipse.core.runtime.IProgressMonitor#beginTask(java.lang.String, int)
*/
+ @Override
public final void beginTask(String name, int totalWork)
{
if ((flags & SUPPRESS_BEGINTASK) == 0 && name != null)
@@ -594,6 +597,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* @see org.eclipse.core.runtime.IProgressMonitor#done()
*/
// Can't be final because ProbingSubMonitor overrides it.
+ @Override
public void done()
{
cleanupActiveChild();
@@ -613,6 +617,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double)
*/
+ @Override
public final void internalWorked(double work)
{
checkCancelation();
@@ -629,6 +634,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitor#subTask(java.lang.String)
*/
+ @Override
public final void subTask(String name)
{
checkCancelation();
@@ -652,6 +658,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* @see org.eclipse.core.runtime.IProgressMonitor#worked(int)
*/
// Can't be final because ProbingSubMonitor overrides it.
+ @Override
public void worked(int work)
{
internalWorked(work);
@@ -678,6 +685,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitor#setCanceled(boolean)
*/
+ @Override
public final void setCanceled(boolean b)
{
root.setCanceled(b);
@@ -875,6 +883,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#clearBlocked()
*/
+ @Override
public final void clearBlocked()
{
checkCancelation();
@@ -885,6 +894,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking
* (non-Javadoc)
* @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#setBlocked(org.eclipse.core.runtime.IStatus)
*/
+ @Override
public final void setBlocked(IStatus reason)
{
checkCancelation();
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ThreadPool.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ThreadPool.java
index 0369cfbad..76cf1cefa 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ThreadPool.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ThreadPool.java
@@ -24,6 +24,7 @@ public class ThreadPool extends ThreadPoolExecutor
private static final ThreadFactory THREAD_FACTORY = new ThreadFactory()
{
+ @Override
public Thread newThread(Runnable r)
{
Thread thread = new Thread(r);
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/WorkerPool.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/WorkerPool.java
index f7097d36b..874a06161 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/WorkerPool.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/WorkerPool.java
@@ -42,8 +42,9 @@ public abstract class WorkerPool<P extends WorkerPool<P, K, W>, K, W extends Wor
* Otherwise workers are processed in the {@link Worker#id identifier order},
* i.e., first come first serve.
*/
- private static final Comparator<Worker<?, ?>> COMPARATOR = new Comparator<Worker<?, ?>>()
+ private static final Comparator<Worker<?, ?>> COMPARATOR = new Comparator<>()
{
+ @Override
public int compare(Worker<?, ?> o1, Worker<?, ?> o2)
{
int result = (o2.secondary ? 0 : 1) - (o1.secondary ? 0 : 1);
@@ -64,12 +65,12 @@ public abstract class WorkerPool<P extends WorkerPool<P, K, W>, K, W extends Wor
/**
* The map of the worker key to the worker associated with that key.
*/
- private final Map<K, W> workers = new HashMap<K, W>();
+ private final Map<K, W> workers = new HashMap<>();
/**
* The workers waiting to perform their work.
*/
- private final List<W> pendingWorkers = new ArrayList<W>();
+ private final List<W> pendingWorkers = new ArrayList<>();
/**
* Whether the workers have been canceled.
@@ -191,6 +192,7 @@ public abstract class WorkerPool<P extends WorkerPool<P, K, W>, K, W extends Wor
* Performs the work for the given keys,
* blocking until the work has been performed.
*/
+ @SafeVarargs
public final void perform(K... keys)
{
perform(Arrays.asList(keys));
@@ -250,6 +252,7 @@ public abstract class WorkerPool<P extends WorkerPool<P, K, W>, K, W extends Wor
* The work will be performed at some later point in time on a different thread.
* Returns whether any work is actually scheduled (needed) for any of the given keys.
*/
+ @SafeVarargs
public final boolean schedule(K... keys)
{
return schedule(Arrays.asList(keys));
@@ -323,7 +326,7 @@ public abstract class WorkerPool<P extends WorkerPool<P, K, W>, K, W extends Wor
* If there are no remaining {@link #workers},
* the {@link #latch latch} is unlatched.
*/
- private synchronized void deschedule(K key)
+ synchronized void deschedule(K key)
{
workers.remove(key);
@@ -385,7 +388,7 @@ public abstract class WorkerPool<P extends WorkerPool<P, K, W>, K, W extends Wor
/**
* The priority {@link WorkerPool#createWorker(Object, int, boolean) allocated} by the pool to this worker.
*/
- private boolean secondary;
+ boolean secondary;
/**
* Creates an instance with the given Job name,
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/XMLUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/XMLUtil.java
index 2c9da9b86..52ea2d1f3 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/XMLUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/XMLUtil.java
@@ -137,6 +137,7 @@ public final class XMLUtil
this.tagName = tagName;
handleElementsByTagName(rootElement, tagName, new ElementHandler()
{
+ @Override
public void handleElement(Element element) throws Exception
{
if (element.getParentNode() == rootElement)
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ZIPUtil.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ZIPUtil.java
index c39a7723f..f1f7eb8c9 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ZIPUtil.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/ZIPUtil.java
@@ -246,6 +246,7 @@ public final class ZIPUtil
List<File> list = IOUtil.listBreadthFirst(sourceFolder);
Collections.sort(list, new Comparator<File>()
{
+ @Override
public int compare(File f1, File f2)
{
String path1 = getPath(f1, baseLength);
@@ -338,6 +339,7 @@ public final class ZIPUtil
}
}
+ @Override
public void handleEntry(EntryContext context) throws IOException
{
if (files.hasNext())
@@ -387,6 +389,7 @@ public final class ZIPUtil
return targetFolder;
}
+ @Override
public void unzipDirectory(String name)
{
File directory = new File(targetFolder, name);
@@ -396,6 +399,7 @@ public final class ZIPUtil
}
}
+ @Override
public void unzipFile(String name, InputStream zipStream)
{
File targetFile = new File(targetFolder, name);

Back to the top