diff options
Diffstat (limited to 'plugins/org.eclipse.net4j.util/src/org')
185 files changed, 1209 insertions, 150 deletions
diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java index e7f7654a53..943c694a8b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractBundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -83,11 +83,13 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, setDebugging(debug); } + @Override public OMPlatform getPlatform() { return platform; } + @Override public String getBundleID() { return bundleID; @@ -108,22 +110,26 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return bundleContext; } + @Override @Deprecated public void setBundleContext(Object bundleContext) { this.bundleContext = bundleContext; } + @Override public DebugSupport getDebugSupport() { return this; } + @Override public TranslationSupport getTranslationSupport() { return this; } + @Override public boolean isDebugging() { if (!platform.isDebugging()) @@ -134,28 +140,33 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return debugging; } + @Override public void setDebugging(boolean debugging) { this.debugging = debugging; } + @Override public String getDebugOption(String option, String defaultValue) { String value = getDebugOption(option); return value == null ? defaultValue : value; } + @Override public boolean getDebugOption(String option, boolean defaultValue) { String value = getDebugOption(option); return value == null ? defaultValue : Boolean.parseBoolean(value); } + @Override public void setDebugOption(String option, boolean value) { setDebugOption(option, Boolean.toString(value)); } + @Override public int getDebugOption(String option, int defaultValue) { try @@ -169,21 +180,25 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, } } + @Override public void setDebugOption(String option, int value) { setDebugOption(option, Integer.toString(value)); } + @Override public String getDebugOption(String option) { return platform.getDebugOption(bundleID, option); } + @Override public void setDebugOption(String option, String value) { platform.setDebugOption(bundleID, option, value); } + @Override public synchronized OMTracer tracer(String name) { OMTracer tracer = tracers.get(name); @@ -195,6 +210,7 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return tracer; } + @Override public synchronized OMLogger logger() { if (logger == null) @@ -205,6 +221,7 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return logger; } + @Override public IStatus getStatus(Object obj) { if (obj instanceof CoreException) @@ -228,6 +245,7 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return new Status(IStatus.INFO, getBundleID(), obj.toString(), null); } + @Override public void coreException(Throwable t) throws CoreException { if (t instanceof CoreException) @@ -256,16 +274,19 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, throw new CoreException(status); } + @Override public File getConfigFile() { return platform.getConfigFile(getConfigFileName()); } + @Override public Properties getConfigProperties() { return platform.getConfigProperties(getConfigFileName()); } + @Override public synchronized Preferences preferences() { if (preferences == null) @@ -276,6 +297,7 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return preferences; } + @Override public InputStream getInputStream(String path) throws IOException { String base = getBaseURL().toString(); @@ -293,16 +315,19 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return url.openStream(); } + @Override public boolean shouldTranslate() { return shouldTranslate; } + @Override public void setShouldTranslate(boolean shouldTranslate) { this.shouldTranslate = shouldTranslate; } + @Override public String getString(String key, boolean translate) { Map<String, String> stringMap = translate ? strings : untranslatedStrings; @@ -375,16 +400,19 @@ public abstract class AbstractBundle implements OMBundle, OMBundle.DebugSupport, return result; } + @Override public String getString(String key) { return getString(key, shouldTranslate()); } + @Override public String getString(String key, Object... args) { return getString(key, shouldTranslate(), args); } + @Override public String getString(String key, boolean translate, Object... args) { return MessageFormat.format(getString(key, translate), args); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java index f57b10ee59..2a2505e72c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/AbstractPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2012, 2015, 2016, 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2012, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -84,6 +84,7 @@ public abstract class AbstractPlatform implements OMPlatform debugging = isProperty("debug"); //$NON-NLS-1$ } + @Override public synchronized OMBundle bundle(String bundleID, Class<?> accessor) { AbstractBundle bundle = bundles.get(bundleID); @@ -103,36 +104,43 @@ public abstract class AbstractPlatform implements OMPlatform return bundle; } + @Override public void addLogFilter(OMLogFilter logFilter) { logFilters.add(logFilter); } + @Override public void removeLogFilter(OMLogFilter logFilter) { logFilters.remove(logFilter); } + @Override public void addLogHandler(OMLogHandler logHandler) { logHandlers.add(logHandler); } + @Override public void removeLogHandler(OMLogHandler logHandler) { logHandlers.remove(logHandler); } + @Override public void addTraceHandler(OMTraceHandler traceHandler) { traceHandlers.add(traceHandler); } + @Override public void removeTraceHandler(OMTraceHandler traceHandler) { traceHandlers.remove(traceHandler); } + @Override public boolean isExtensionRegistryAvailable() { try @@ -145,16 +153,19 @@ public abstract class AbstractPlatform implements OMPlatform } } + @Override public boolean isDebugging() { return debugging; } + @Override public void setDebugging(boolean debugging) { this.debugging = debugging; } + @Override public File getStateFolder() { String state = getProperty(SYSTEM_PROPERTY_NET4J_STATE); @@ -197,6 +208,7 @@ public abstract class AbstractPlatform implements OMPlatform return stateFolder; } + @Override public File getConfigFolder() { String config = getProperty(SYSTEM_PROPERTY_NET4J_CONFIG, "config"); //$NON-NLS-1$ @@ -219,6 +231,7 @@ public abstract class AbstractPlatform implements OMPlatform return configFolder; } + @Override public File getConfigFile(String name) { File configFolder = getConfigFolder(); @@ -230,6 +243,7 @@ public abstract class AbstractPlatform implements OMPlatform return new File(configFolder, name); } + @Override public Properties getConfigProperties(String name) { File configFile = getConfigFile(name); @@ -330,16 +344,19 @@ public abstract class AbstractPlatform implements OMPlatform return bundles; } + @Override public String getProperty(String key) { return System.getProperty(key); } + @Override public String getProperty(String key, String defaultValue) { return System.getProperty(key, defaultValue); } + @Override public int getProperty(String key, int defaultValue) { String property = getProperty(key); @@ -351,6 +368,7 @@ public abstract class AbstractPlatform implements OMPlatform return Integer.parseInt(property); } + @Override public long getProperty(String key, long defaultValue) { String property = getProperty(key); @@ -362,6 +380,7 @@ public abstract class AbstractPlatform implements OMPlatform return Long.parseLong(property); } + @Override public <T extends Enum<T>> T getProperty(String key, Class<T> enumType) { String property = getProperty(key); @@ -379,6 +398,7 @@ public abstract class AbstractPlatform implements OMPlatform return null; } + @Override public <T extends Enum<T>> T getProperty(String key, T defaultValue) { T result = getProperty(key, defaultValue.getDeclaringClass()); @@ -390,11 +410,13 @@ public abstract class AbstractPlatform implements OMPlatform return defaultValue; } + @Override public boolean isProperty(String key) { return isProperty(key, false); } + @Override public boolean isProperty(String key, boolean defaultValue) { String property = getProperty(key); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/OM.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/OM.java index 6de49dd234..77988bfb56 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/OM.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/bundle/OM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,6 +60,7 @@ public abstract class OM */ public static final class Activator implements BundleActivator { + @Override public void start(BundleContext context) throws Exception { AbstractPlatform.systemContext = context; @@ -87,6 +88,7 @@ public abstract class OM } } + @Override public void stop(BundleContext context) throws Exception { OSGiActivator.traceStop(context); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java index 954ea98425..44457184b6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/container/PluginElementProcessorList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,36 +39,43 @@ public class PluginElementProcessorList extends Lifecycle implements List<IEleme { } + @Override public boolean add(IElementProcessor o) { return processors.add(o); } + @Override public void add(int index, IElementProcessor element) { processors.add(index, element); } + @Override public boolean addAll(Collection<? extends IElementProcessor> c) { return processors.addAll(c); } + @Override public boolean addAll(int index, Collection<? extends IElementProcessor> c) { return processors.addAll(index, c); } + @Override public void clear() { processors.clear(); } + @Override public boolean contains(Object o) { return processors.contains(o); } + @Override public boolean containsAll(Collection<?> c) { return processors.containsAll(c); @@ -80,6 +87,7 @@ public class PluginElementProcessorList extends Lifecycle implements List<IEleme return processors.equals(o); } + @Override public IElementProcessor get(int index) { return processors.get(index); @@ -91,76 +99,91 @@ public class PluginElementProcessorList extends Lifecycle implements List<IEleme return processors.hashCode(); } + @Override public int indexOf(Object o) { return processors.indexOf(o); } + @Override public boolean isEmpty() { return processors.isEmpty(); } + @Override public Iterator<IElementProcessor> iterator() { return processors.iterator(); } + @Override public int lastIndexOf(Object o) { return processors.lastIndexOf(o); } + @Override public ListIterator<IElementProcessor> listIterator() { return processors.listIterator(); } + @Override public ListIterator<IElementProcessor> listIterator(int index) { return processors.listIterator(index); } + @Override public IElementProcessor remove(int index) { return processors.remove(index); } + @Override public boolean remove(Object o) { return processors.remove(o); } + @Override public boolean removeAll(Collection<?> c) { return processors.removeAll(c); } + @Override public boolean retainAll(Collection<?> c) { return processors.retainAll(c); } + @Override public IElementProcessor set(int index, IElementProcessor element) { return processors.set(index, element); } + @Override public int size() { return processors.size(); } + @Override public List<IElementProcessor> subList(int fromIndex, int toIndex) { return processors.subList(fromIndex, toIndex); } + @Override public Object[] toArray() { return processors.toArray(); } + @Override public <T> T[] toArray(T[] a) { return processors.toArray(a); @@ -219,6 +242,7 @@ public class PluginElementProcessorList extends Lifecycle implements List<IEleme org.eclipse.core.runtime.IRegistryChangeListener listener = new org.eclipse.core.runtime.IRegistryChangeListener() { + @Override public void registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent event) { org.eclipse.core.runtime.IExtensionDelta[] deltas = event.getExtensionDeltas(NAMESPACE, EXT_POINT); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/factory/PluginFactoryRegistry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/factory/PluginFactoryRegistry.java index 251176c4a7..4bc617a761 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/factory/PluginFactoryRegistry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/factory/PluginFactoryRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011-2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011-2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -110,6 +110,7 @@ public class PluginFactoryRegistry extends HashMapRegistry<IFactoryKey, IFactory org.eclipse.core.runtime.IRegistryChangeListener listener = new org.eclipse.core.runtime.IRegistryChangeListener() { + @Override public void registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent event) { org.eclipse.core.runtime.IExtensionDelta[] deltas = event.getExtensionDeltas(NAMESPACE, EXT_POINT); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java index d5634a84bf..9b176b55dd 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyBundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -66,16 +66,19 @@ public class LegacyBundle extends AbstractBundle } } + @Override public String getStateLocation() { return new File(getPlatform().getStateFolder(), ".plugins/" + getBundleID()).getAbsolutePath(); //$NON-NLS-1$ } + @Override public URL getBaseURL() { return baseURL; } + @Override public Iterator<Class<?>> getClasses() { List<Class<?>> result = new ArrayList<Class<?>>(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java index 4acdc5fc62..569f0a9735 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/LegacyPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,6 +28,7 @@ public class LegacyPlatform extends AbstractPlatform { } + @Override public boolean isOSGiRunning() { return false; @@ -51,6 +52,7 @@ public class LegacyPlatform extends AbstractPlatform debugOptions.put(bundleID + "/" + option, value); //$NON-NLS-1$ } + @Override public String[] getCommandLineArgs() { return LegacyUtil.getCommandLineArgs(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java index 4cef877f9c..3481b27d98 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiBundle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,6 +44,7 @@ public class OSGiBundle extends AbstractBundle return (BundleContext)super.getBundleContext(); } + @Override public URL getBaseURL() { try @@ -64,6 +65,7 @@ public class OSGiBundle extends AbstractBundle } } + @Override public Iterator<Class<?>> getClasses() { final Queue<String> folders = new LinkedList<String>(); @@ -108,6 +110,7 @@ public class OSGiBundle extends AbstractBundle }; } + @Override public String getStateLocation() { Bundle bundle = getBundleContext().getBundle(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java index 786c6aeee4..4642087b3b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/OSGiPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,6 +39,7 @@ public class OSGiPlatform extends AbstractPlatform } } + @Override public boolean isOSGiRunning() { return true; @@ -57,6 +58,7 @@ public class OSGiPlatform extends AbstractPlatform return property != null ? property : defaultValue; } + @Override public String[] getCommandLineArgs() { return Platform.getCommandLineArgs(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/ArrayPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/ArrayPreference.java index 89b8332ac6..7b41233b26 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/ArrayPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/ArrayPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -89,6 +89,7 @@ public final class ArrayPreference extends Preference<String[]> return array; } + @Override public Type getType() { return Type.ARRAY; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BooleanPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BooleanPreference.java index 03d0ae66e3..7c8465d6fa 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BooleanPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BooleanPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public final class BooleanPreference extends Preference<Boolean> return Boolean.parseBoolean(value); } + @Override public Type getType() { return Type.BOOLEAN; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BytesPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BytesPreference.java index d851255a4b..03c58c6094 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BytesPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/BytesPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ public final class BytesPreference extends Preference<byte[]> return HexUtil.hexToBytes(value); } + @Override public Type getType() { return Type.BYTES; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/DoublePreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/DoublePreference.java index 109e8dad0b..f447737feb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/DoublePreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/DoublePreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public final class DoublePreference extends Preference<Double> return Double.parseDouble(value); } + @Override public Type getType() { return Type.DOUBLE; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/FloatPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/FloatPreference.java index 875e007bdd..9c7af12635 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/FloatPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/FloatPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public final class FloatPreference extends Preference<Float> return Float.parseFloat(value); } + @Override public Type getType() { return Type.FLOAT; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/IntegerPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/IntegerPreference.java index 1990e10ffc..72ad113436 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/IntegerPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/IntegerPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public final class IntegerPreference extends Preference<Integer> return Integer.parseInt(value); } + @Override public Type getType() { return Type.INTEGER; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/LongPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/LongPreference.java index 1e95228286..183a2d5d94 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/LongPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/LongPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public final class LongPreference extends Preference<Long> return Long.parseLong(value); } + @Override public Type getType() { return Type.LONG; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preference.java index 2664265a64..7fc7690ba2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,27 +38,32 @@ public abstract class Preference<T> implements OMPreference<T> this.defaultValue = defaultValue; } + @Override public Preferences getPreferences() { return preferences; } + @Override public String getName() { return name; } + @Override public T getDefaultValue() { return defaultValue; } + @Override public T getValue() { load(); return value; } + @Override public T setValue(T value) { if (value == null) @@ -83,11 +88,13 @@ public abstract class Preference<T> implements OMPreference<T> return null; } + @Override public boolean isSet() { return !equals(defaultValue, value); } + @Override public T unSet() { return setValue(defaultValue); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java index e5c6e36983..866c13f8c7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/Preferences.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -45,6 +45,7 @@ public class Preferences extends Notifier implements OMPreferences this.bundle = bundle; } + @Override public AbstractBundle getBundle() { return bundle; @@ -62,6 +63,7 @@ public class Preferences extends Notifier implements OMPreferences { IOUtil.safeInput(file, new IORunnable<FileInputStream>() { + @Override public void run(FileInputStream io) throws IOException { properties.load(io); @@ -78,6 +80,7 @@ public class Preferences extends Notifier implements OMPreferences } } + @Override public synchronized void save() { if (dirty) @@ -108,6 +111,7 @@ public class Preferences extends Notifier implements OMPreferences { IOUtil.safeOutput(file, new IORunnable<FileOutputStream>() { + @Override public void run(FileOutputStream io) throws IOException { properties.store(io, "Preferences of " + bundle.getBundleID()); //$NON-NLS-1$ @@ -119,143 +123,170 @@ public class Preferences extends Notifier implements OMPreferences } } + @Override public boolean isDirty() { return dirty; } + @Override public OMPreference<Boolean> init(String name, boolean defaultValue) { return init(new BooleanPreference(this, name, defaultValue)); } + @Override public OMPreference<Integer> init(String name, int defaultValue) { return init(new IntegerPreference(this, name, defaultValue)); } + @Override public OMPreference<Long> init(String name, long defaultValue) { return init(new LongPreference(this, name, defaultValue)); } + @Override public OMPreference<Float> init(String name, float defaultValue) { return init(new FloatPreference(this, name, defaultValue)); } + @Override public OMPreference<Double> init(String name, double defaultValue) { return init(new DoublePreference(this, name, defaultValue)); } + @Override public OMPreference<String> init(String name, String defaultValue) { return init(new StringPreference(this, name, defaultValue)); } + @Override public OMPreference<String[]> init(String name, String[] defaultValue) { return init(new ArrayPreference(this, name, defaultValue)); } + @Override public OMPreference<byte[]> init(String name, byte[] defaultValue) { return init(new BytesPreference(this, name, defaultValue)); } + @Override public OMPreference<Boolean> initBoolean(String name) { return init(name, DEFAULT_BOOLEAN); } + @Override public OMPreference<Integer> initInteger(String name) { return init(name, DEFAULT_INTEGER); } + @Override public OMPreference<Long> initLong(String name) { return init(name, DEFAULT_LONG); } + @Override public OMPreference<Float> initFloat(String name) { return init(name, DEFAULT_FLOAT); } + @Override public OMPreference<Double> initDouble(String name) { return init(name, DEFAULT_DOUBLE); } + @Override public OMPreference<String> initString(String name) { return init(name, DEFAULT_STRING); } + @Override public OMPreference<String[]> initArray(String name) { return init(name, DEFAULT_ARRAY); } + @Override public OMPreference<byte[]> initBytes(String name) { return init(name, DEFAULT_BYTES); } + @Override public boolean contains(String name) { return prefs.containsKey(name); } + @Override public OMPreference<?> get(String name) { return prefs.get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<Boolean> getBoolean(String name) { return (OMPreference<Boolean>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<Integer> getInteger(String name) { return (OMPreference<Integer>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<Long> getLong(String name) { return (OMPreference<Long>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<Float> getFloat(String name) { return (OMPreference<Float>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<Double> getDouble(String name) { return (OMPreference<Double>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<String> getString(String name) { return (OMPreference<String>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<String[]> getArray(String name) { return (OMPreference<String[]>)get(name); } + @Override @SuppressWarnings("unchecked") public OMPreference<byte[]> getBytes(String name) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/PreferencesChangeEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/PreferencesChangeEvent.java index fc4363e88a..8579d03573 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/PreferencesChangeEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/PreferencesChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,16 +40,19 @@ public final class PreferencesChangeEvent<T> extends Event implements OMPreferen return (Preferences)super.getSource(); } + @Override public Preference<T> getPreference() { return preference; } + @Override public T getOldValue() { return oldValue; } + @Override public T getNewValue() { return newValue; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/StringPreference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/StringPreference.java index 7930d70aa1..4afdf4d611 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/StringPreference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/om/pref/StringPreference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public final class StringPreference extends Preference<String> return value; } + @Override public Type getType() { return Type.STRING; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java index 449bc71987..3281c7796a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/AbstractRange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,10 +25,13 @@ 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>(); @@ -36,6 +39,7 @@ public abstract class AbstractRange implements Range return set; } + @Override public List<Cell> list() { List<Cell> list = new ArrayList<Cell>(); @@ -43,6 +47,7 @@ public abstract class AbstractRange implements Range 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) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Coordinate.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Coordinate.java index 8780643c33..9ce6894e0b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Coordinate.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Coordinate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -74,6 +74,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.net4j.util/src/org/eclipse/net4j/internal/util/table/Formula.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Formula.java index 605a2478dd..eca3c88348 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Formula.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Formula.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -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; @@ -150,6 +154,7 @@ public interface Formula this.range = range; } + @Override public Integer evaluate() { int count = 0; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Generator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Generator.java index 1b79aa54f5..b86e274fc9 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Generator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/internal/util/table/Generator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -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.net4j.util/src/org/eclipse/net4j/util/Predicates.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java index b59a3e9524..1976beeeab 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/Predicates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -72,6 +72,7 @@ public final class Predicates this.inclusions = inclusions; } + @Override public boolean apply(T element) { return inclusions.contains(element); @@ -91,6 +92,7 @@ public final class Predicates this.exclusions = exclusions; } + @Override public boolean apply(T element) { return !exclusions.contains(element); @@ -105,6 +107,7 @@ public final class Predicates { private final Set<T> applied = new HashSet<T>(); + @Override public boolean apply(T element) { return applied.add(element); @@ -118,6 +121,7 @@ public final class Predicates { private static final Predicate<Object> INSTANCE = new FalsePredicate(); + @Override public boolean apply(Object element) { return false; @@ -131,6 +135,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.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java index 7d691e30cb..63b3f543bf 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/Cache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ public abstract class Cache<E> extends Worker implements ICache { } + @Override public ICacheMonitor getCacheMonitor() { return cacheMonitor; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java index 04c3f67a8a..3ba129de81 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -82,6 +82,7 @@ public class CacheMonitor extends Worker implements ICacheMonitor this.pauseRED = pauseRED; } + @Override public ConditionPolicy getConditionPolicy() { return conditionPolicy; @@ -92,6 +93,7 @@ public class CacheMonitor extends Worker implements ICacheMonitor this.conditionPolicy = conditionPolicy; } + @Override public Condition getCondition() { return condition; @@ -105,6 +107,7 @@ public class CacheMonitor extends Worker implements ICacheMonitor } } + @Override public ICacheRegistration registerCache(ICache cache) { if (TRACER.isEnabled()) @@ -127,6 +130,7 @@ public class CacheMonitor extends Worker implements ICacheMonitor return registration; } + @Override public void deregisterCache(ICache cache) { ICacheRegistration registration; @@ -238,11 +242,13 @@ public class CacheMonitor extends Worker implements ICacheMonitor return (ICacheMonitor)super.getSource(); } + @Override public Condition getOldCondition() { return oldCondition; } + @Override public Condition getNewCondition() { return newCondition; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheRegistration.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheRegistration.java index ff5be4ce22..c37b67ffc1 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheRegistration.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/CacheRegistration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,47 +33,56 @@ public class CacheRegistration implements ICacheRegistration this.cache = cache; } + @Override public void dispose() { cacheMonitor = null; cache = null; } + @Override public boolean isDisposed() { return cacheMonitor == null || cache == null; } + @Override public ICacheMonitor getCacheMonitor() { return cacheMonitor; } + @Override public ICache getCache() { return cache; } + @Override public int getElementCount() { return elementCount; } + @Override public long getCacheSize() { return cacheSize; } + @Override public long getAverageElementSize() { return cacheSize / elementCount; } + @Override public long getReconstructionCost() { return reconstructionCost; } + @Override public void elementCached(int elementSize) { checkDisposal(); @@ -81,6 +90,7 @@ public class CacheRegistration implements ICacheRegistration cacheSize += elementSize; } + @Override public void elementEvicted(int elementSize) { checkDisposal(); @@ -88,6 +98,7 @@ public class CacheRegistration implements ICacheRegistration cacheSize -= elementSize; } + @Override public void elementReconstructed(long reconstructionTime) { checkDisposal(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ICacheMonitorEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ICacheMonitorEvent.java index 2c6070d82f..afb5ae1358 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ICacheMonitorEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ICacheMonitorEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ public interface ICacheMonitorEvent extends IEvent /** * @since 3.0 */ + @Override public ICacheMonitor getSource(); public ICacheMonitor.Condition getOldCondition(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ThresholdConditionPolicy.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ThresholdConditionPolicy.java index b7c008bcd2..36b0903a31 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ThresholdConditionPolicy.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/cache/ThresholdConditionPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -42,6 +42,7 @@ public class ThresholdConditionPolicy implements ICacheMonitor.ConditionPolicy return thresholdYellowGreen; } + @Override public Condition getNewCondition(Condition oldCondition) { return getNewCondition(oldCondition, Runtime.getRuntime().freeMemory()); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractCloseableIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractCloseableIterator.java index 87d2473e6d..ca77af7874 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractCloseableIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractCloseableIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,8 +23,10 @@ public abstract class AbstractCloseableIterator<E> extends AbstractIterator<E> i @Override protected abstract Object computeNextElement(); + @Override public abstract void close(); + @Override public abstract boolean isClosed(); @SuppressWarnings("unchecked") diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractIterator.java index 0f19ab2afb..ede0103286 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/AbstractIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2014, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2011, 2012, 2014, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,7 @@ public abstract class AbstractIterator<T> implements Iterator<T> { } + @Override public final boolean hasNext() { if (nextComputed) @@ -56,6 +57,7 @@ public abstract class AbstractIterator<T> implements Iterator<T> return true; } + @Override public final T next() { if (!hasNext()) @@ -67,6 +69,7 @@ public abstract class AbstractIterator<T> implements Iterator<T> return next; } + @Override public void remove() { throw new UnsupportedOperationException(); @@ -93,56 +96,67 @@ public abstract class AbstractIterator<T> implements Iterator<T> { 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(); } + @Override public void close() { // Do nothing. } + @Override public boolean isClosed() { return true; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ArrayIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ArrayIterator.java index c638184795..7d4e8c25da 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ArrayIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ArrayIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,11 +44,13 @@ public class ArrayIterator<T> implements Iterator<T> this.lastElement = lastElement; } + @Override public boolean hasNext() { return elements != null && index <= lastElement; } + @Override public T next() throws NoSuchElementException { if (!hasNext()) @@ -65,6 +67,7 @@ public class ArrayIterator<T> implements Iterator<T> * @throws UnsupportedOperationException * always */ + @Override public void remove() { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidirectionalIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidirectionalIterator.java index 7e1398129f..49e6cd6187 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidirectionalIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/BidirectionalIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -49,16 +49,19 @@ public class BidirectionalIterator<T> implements Iterator<T> this.backward = backward; } + @Override public boolean hasNext() { return backward ? delegate.hasPrevious() : delegate.hasNext(); } + @Override public T next() { return backward ? delegate.previous() : delegate.next(); } + @Override public void remove() { delegate.remove(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java index 642013df10..3d217077c2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/ComposedIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,6 +28,7 @@ public class ComposedIterator<T> extends AbstractIterator<T> private Iterator<T> currentDelegate; + @SafeVarargs public ComposedIterator(Iterator<T>... delegates) { this(Arrays.asList(delegates)); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/DelegatingCloseableIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/DelegatingCloseableIterator.java index 2c357e5264..2eca9b069f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/DelegatingCloseableIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/DelegatingCloseableIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,11 +28,13 @@ public class DelegatingCloseableIterator<E> implements CloseableIterator<E> this.delegate = delegate; } + @Override public boolean hasNext() { return !closed && delegate.hasNext(); } + @Override public E next() { if (closed) @@ -43,16 +45,19 @@ public class DelegatingCloseableIterator<E> implements CloseableIterator<E> return delegate.next(); } + @Override public void remove() { throw new UnsupportedOperationException(); } + @Override public void close() { closed = true; } + @Override public boolean isClosed() { return closed; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java index d277f0b783..28d5f4e52a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/GrowingRandomAccessList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -272,26 +272,31 @@ public class GrowingRandomAccessList<E> extends AbstractList<E> implements Queue throw new UnsupportedOperationException(); } + @Override public boolean offer(E e) { return offerLast(e); } + @Override public E remove() { throw new UnsupportedOperationException(); } + @Override public E poll() { throw new UnsupportedOperationException(); } + @Override public E element() { return getFirst(); } + @Override public E peek() { return peekFirst(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java index 07097a11ca..4c2b57d4d7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HashBag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012, 2014-2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2012, 2014-2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -71,6 +71,7 @@ public final class HashBag<T> implements Set<T> return counter.getValue(); } + @Override public boolean add(T o) { return add(o, 1); @@ -93,6 +94,7 @@ public final class HashBag<T> implements Set<T> return false; } + @Override public boolean addAll(Collection<? extends T> c) { for (T t : c) @@ -103,31 +105,37 @@ public final class HashBag<T> implements Set<T> return true; } + @Override public void clear() { map.clear(); } + @Override public boolean contains(Object o) { return map.containsKey(o); } + @Override public boolean containsAll(Collection<?> c) { return map.keySet().containsAll(c); } + @Override public boolean isEmpty() { return map.isEmpty(); } + @Override public Iterator<T> iterator() { return map.keySet().iterator(); } + @Override public boolean remove(Object o) { return remove(o, 1); @@ -152,6 +160,7 @@ public final class HashBag<T> implements Set<T> return true; } + @Override public boolean removeAll(Collection<?> c) { boolean changed = false; @@ -166,21 +175,25 @@ public final class HashBag<T> implements Set<T> return changed; } + @Override public boolean retainAll(Collection<?> c) { throw new UnsupportedOperationException(); } + @Override public int size() { return map.size(); } + @Override public Object[] toArray() { return map.keySet().toArray(); } + @Override @SuppressWarnings("hiding") public <T> T[] toArray(T[] a) { diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java index 47e42a91de..638050b61d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/History.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -50,18 +50,21 @@ public class History<T> extends Notifier implements IHistory<T> } } + @Override public boolean isEmpty() { lazyLoad(); return elements.isEmpty(); } + @Override public int size() { lazyLoad(); return elements.size(); } + @Override public int indexOf(T data) { lazyLoad(); @@ -76,12 +79,14 @@ public class History<T> extends Notifier implements IHistory<T> return -1; } + @Override public IHistoryElement<T> get(int index) { lazyLoad(); return elements.get(index); } + @Override public boolean add(T data) { lazyLoad(); @@ -98,6 +103,7 @@ public class History<T> extends Notifier implements IHistory<T> return changed; } + @Override public IHistoryElement<T> remove(int index) { lazyLoad(); @@ -110,6 +116,7 @@ public class History<T> extends Notifier implements IHistory<T> return element; } + @Override public boolean clear() { if (elements.isEmpty()) @@ -122,6 +129,7 @@ public class History<T> extends Notifier implements IHistory<T> return true; } + @Override public T getMostRecent() { lazyLoad(); @@ -133,6 +141,7 @@ public class History<T> extends Notifier implements IHistory<T> return elements.get(0).getData(); } + @Override @SuppressWarnings("unchecked") public <D> D[] getData(D[] a) { @@ -156,6 +165,7 @@ public class History<T> extends Notifier implements IHistory<T> return a; } + @Override @SuppressWarnings("unchecked") public IHistoryElement<T>[] toArray() { @@ -163,6 +173,7 @@ public class History<T> extends Notifier implements IHistory<T> return elements.toArray(new IHistoryElement[elements.size()]); } + @Override public Iterator<IHistoryElement<T>> iterator() { lazyLoad(); @@ -207,6 +218,7 @@ public class History<T> extends Notifier implements IHistory<T> { fireEvent(new IHistoryChangeEvent() { + @Override public IHistory<?> getSource() { return History.this; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryElement.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryElement.java index 44c00ad614..98dc520b13 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryElement.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/HistoryElement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,16 +27,19 @@ public class HistoryElement<T> implements IHistoryElement<T> this.data = data; } + @Override public IHistory<IHistoryElement<T>> getHistory() { return history; } + @Override public T getData() { return data; } + @Override public String getText() { return data.toString(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IHistoryChangeEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IHistoryChangeEvent.java index bd6cf4fdd6..f7ee09f598 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IHistoryChangeEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IHistoryChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,5 +22,6 @@ public interface IHistoryChangeEvent extends IEvent /** * @since 3.0 */ + @Override public IHistory<?> getSource(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IndexedList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IndexedList.java index 4eacce291a..9394a543ce 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IndexedList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/IndexedList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,15 +26,19 @@ public abstract class IndexedList<E> implements List<E> { } + @Override public abstract E get(int index); + @Override public abstract int size(); + @Override public boolean isEmpty() { return size() == 0; } + @Override public boolean contains(Object o) { int size = size(); @@ -49,6 +53,7 @@ public abstract class IndexedList<E> implements List<E> return false; } + @Override public boolean containsAll(Collection<?> c) { for (Object object : c) @@ -62,26 +67,31 @@ public abstract class IndexedList<E> implements List<E> return true; } + @Override public int indexOf(Object o) { return 0; } + @Override public int lastIndexOf(Object o) { return 0; } + @Override public Iterator<E> iterator() { return new IndexedIterator(); } + @Override public ListIterator<E> listIterator() { return new IndexedListIterator(0); } + @Override public ListIterator<E> listIterator(int index) { if (index < 0 || index > size()) @@ -92,66 +102,79 @@ public abstract class IndexedList<E> implements List<E> return new IndexedListIterator(index); } + @Override public List<E> subList(int fromIndex, int toIndex) { return null; } + @Override public Object[] toArray() { throw new UnsupportedOperationException(); } + @Override public <T> T[] toArray(T[] a) { throw new UnsupportedOperationException(); } + @Override public boolean add(E o) { throw new UnsupportedOperationException(); } + @Override public boolean remove(Object o) { throw new UnsupportedOperationException(); } + @Override public boolean addAll(Collection<? extends E> c) { throw new UnsupportedOperationException(); } + @Override public boolean addAll(int index, Collection<? extends E> c) { throw new UnsupportedOperationException(); } + @Override public boolean removeAll(Collection<?> c) { throw new UnsupportedOperationException(); } + @Override public boolean retainAll(Collection<?> c) { throw new UnsupportedOperationException(); } + @Override public void clear() { throw new UnsupportedOperationException(); } + @Override public E set(int index, E element) { throw new UnsupportedOperationException(); } + @Override public void add(int index, E element) { throw new UnsupportedOperationException(); } + @Override public E remove(int index) { throw new UnsupportedOperationException(); @@ -183,11 +206,13 @@ public abstract class IndexedList<E> implements List<E> { int pos = 0; + @Override public boolean hasNext() { return pos != size(); } + @Override public E next() { try @@ -200,6 +225,7 @@ public abstract class IndexedList<E> implements List<E> } } + @Override public void remove() { throw new UnsupportedOperationException(); @@ -216,11 +242,13 @@ public abstract class IndexedList<E> implements List<E> pos = index; } + @Override public boolean hasPrevious() { return pos != 0; } + @Override public E previous() { try @@ -233,21 +261,25 @@ public abstract class IndexedList<E> implements List<E> } } + @Override public int nextIndex() { return pos; } + @Override public int previousIndex() { return pos - 1; } + @Override public void set(E o) { throw new UnsupportedOperationException(); } + @Override public void add(E o) { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MapEntry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MapEntry.java index ff3c2afa9d..3da2b75139 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MapEntry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MapEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,16 +36,19 @@ public class MapEntry<K, V> implements Map.Entry<K, V> value = entry.getValue(); } + @Override public K getKey() { return key; } + @Override public V getValue() { return value; } + @Override public V setValue(V value) { V oldValue = this.value; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MoveableArrayList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MoveableArrayList.java index 940c0788b3..c176fb9fa3 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MoveableArrayList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MoveableArrayList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,7 @@ public class MoveableArrayList<E> extends ArrayList<E> implements MoveableList<E move(newPosition, indexOf(object)); } + @Override public E move(int targetIndex, int sourceIndex) { int size = size(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java index 827aa1c11d..b2ef17e752 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/MultiMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -52,6 +52,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public void clear() { throw new UnsupportedOperationException(); @@ -60,6 +61,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public V put(K key, V value) { throw new UnsupportedOperationException(); @@ -68,6 +70,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public void putAll(Map<? extends K, ? extends V> t) { throw new UnsupportedOperationException(); @@ -76,6 +79,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public V remove(Object key) { throw new UnsupportedOperationException(); @@ -84,6 +88,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public boolean containsKey(Object key) { return containsKey(key, getDelegateCount()); @@ -92,6 +97,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public boolean containsValue(Object value) { for (int i = 0; i < getDelegateCount(); i++) @@ -112,6 +118,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public V get(Object key) { for (int i = 0; i < getDelegateCount(); i++) @@ -132,6 +139,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public int size() { int size = 0; @@ -162,6 +170,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public boolean isEmpty() { for (int i = 0; i < getDelegateCount(); i++) @@ -179,6 +188,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> return true; } + @Override public synchronized Set<Map.Entry<K, V>> entrySet() { if (entries == null) @@ -189,6 +199,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> return entries; } + @Override public synchronized Set<K> keySet() { if (keys == null) @@ -199,6 +210,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> return keys; } + @Override public synchronized Collection<V> values() { if (values == null) @@ -403,6 +415,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public void remove() { throw new UnsupportedOperationException(); @@ -411,6 +424,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public boolean hasNext() { next = null; @@ -451,6 +465,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public Map.Entry<K, V> next() { if (next == null) @@ -578,6 +593,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public void remove() { throw new UnsupportedOperationException(); @@ -586,6 +602,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public boolean hasNext() { next = null; @@ -626,6 +643,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public K next() { if (next == null) @@ -749,6 +767,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category WRITE */ + @Override public void remove() { throw new UnsupportedOperationException(); @@ -757,6 +776,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public boolean hasNext() { return delegateIt.hasNext(); @@ -765,6 +785,7 @@ public abstract class MultiMap<K, V> implements Map<K, V> /** * @category READ */ + @Override public V next() { return delegateIt.next().getValue(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java index 45ccfa150d..f49d3ed691 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinBlockingQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,11 +32,13 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> { } + @Override public int remainingCapacity() { return Integer.MAX_VALUE; } + @Override public int size() { int size = 0; @@ -51,6 +53,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> return size; } + @Override public boolean isEmpty() { synchronized (list) @@ -59,6 +62,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public boolean offer(E e) { synchronized (list) @@ -76,21 +80,25 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException { return offer(o); } + @Override public void put(E o) throws InterruptedException { offer(o); } + @Override public boolean add(E o) { return offer(o); } + @Override public E poll(long timeout, TimeUnit unit) throws InterruptedException { synchronized (list) @@ -110,6 +118,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public E poll() { synchronized (list) @@ -129,6 +138,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public E take() throws InterruptedException { synchronized (list) @@ -143,6 +153,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public E peek() { synchronized (list) @@ -157,6 +168,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public E element() { synchronized (list) @@ -171,6 +183,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public E remove() { synchronized (list) @@ -185,6 +198,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public boolean remove(Object o) { synchronized (list) @@ -207,6 +221,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> return false; } + @Override public void clear() { synchronized (list) @@ -215,6 +230,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public Iterator<E> iterator() { List<E> copy = new ArrayList<E>(); @@ -247,6 +263,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> return copy.iterator(); } + @Override public boolean contains(Object o) { synchronized (list) @@ -263,6 +280,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> return false; } + @Override public Object[] toArray() { synchronized (list) @@ -271,6 +289,7 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public <T> T[] toArray(T[] array) { synchronized (list) @@ -279,36 +298,42 @@ public class RoundRobinBlockingQueue<E> implements BlockingQueue<E> } } + @Override public boolean containsAll(Collection<?> c) { // TODO: implement RoundRobinBlockingQueue.containsAll(c) throw new UnsupportedOperationException(); } + @Override public boolean addAll(Collection<? extends E> c) { // TODO: implement RoundRobinBlockingQueue.addAll(c) throw new UnsupportedOperationException(); } + @Override public boolean removeAll(Collection<?> c) { // TODO: implement RoundRobinBlockingQueue.removeAll(c) throw new UnsupportedOperationException(); } + @Override public boolean retainAll(Collection<?> c) { // TODO: implement RoundRobinBlockingQueue.retainAll(c) throw new UnsupportedOperationException(); } + @Override public int drainTo(Collection<? super E> c) { // TODO: implement RoundRobinBlockingQueue.drainTo(c) throw new UnsupportedOperationException(); } + @Override public int drainTo(Collection<? super E> c, int maxElements) { // TODO: implement RoundRobinBlockingQueue.drainTo(c, maxElements) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinIterator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinIterator.java index c340364026..d0ee003dc3 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinIterator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/collection/RoundRobinIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,11 +33,13 @@ public class RoundRobinIterator<T> implements Iterator<T> } } + @Override public boolean hasNext() { return delegate != null; } + @Override public T next() { if (delegate == null) @@ -53,6 +55,7 @@ public class RoundRobinIterator<T> implements Iterator<T> return delegate.next(); } + @Override public void remove() { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/AsynchronousWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/AsynchronousWorkSerializer.java index 8fb805bd19..9f17ccde72 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/AsynchronousWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/AsynchronousWorkSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2010-2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -50,11 +50,13 @@ public class AsynchronousWorkSerializer implements IWorkSerializer, IExecutorSer this(executorService, new ConcurrentLinkedQueue<Runnable>()); } + @Override public ExecutorService getExecutorService() { return executorService; } + @Override public boolean addWork(Runnable work) { // Need to be a block of execution. Cannot add when doing last check @@ -86,6 +88,7 @@ public class AsynchronousWorkSerializer implements IWorkSerializer, IExecutorSer * Executed in the context of the {@link #getExecutorService() executor service}. * <p> */ + @Override public void run() { // XXX synchronized (occupation) @@ -125,6 +128,7 @@ public class AsynchronousWorkSerializer implements IWorkSerializer, IExecutorSer } } + @Override public void dispose() { if (occupation.isOccupied()) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java index d1e04cf740..604d59b6f1 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/CompletionWorkSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -50,10 +50,12 @@ public class CompletionWorkSerializer implements IWorkSerializer return completionService; } + @Override public void dispose() { } + @Override public boolean addWork(Runnable work) { completionService.submit(work, true); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java index 095af4c860..ae336e9a2b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegableReentrantLock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -68,6 +68,7 @@ public class DelegableReentrantLock extends NonFairReentrantLock implements ILif return container; } + @Override public final synchronized void activate() throws LifecycleException { if (!active) @@ -83,6 +84,7 @@ public class DelegableReentrantLock extends NonFairReentrantLock implements ILif } } + @Override public final synchronized Exception deactivate() { if (active) @@ -105,31 +107,37 @@ public class DelegableReentrantLock extends NonFairReentrantLock implements ILif return null; } + @Override public final LifecycleState getLifecycleState() { return active ? LifecycleState.ACTIVE : LifecycleState.INACTIVE; } + @Override public final boolean isActive() { return active; } + @Override public final void addListener(IListener listener) { // Do nothing } + @Override public final void removeListener(IListener listener) { // Do nothing } + @Override public final IListener[] getListeners() { return EventUtil.NO_LISTENERS; } + @Override public final boolean hasListeners() { return false; @@ -196,6 +204,7 @@ public class DelegableReentrantLock extends NonFairReentrantLock implements ILif super(PRODUCT_GROUP, type); } + @Override public abstract DelegateDetector create(String description) throws ProductCreationException; } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegatingExecutorService.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegatingExecutorService.java index 1e768407b0..51ef4e6e8c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegatingExecutorService.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/DelegatingExecutorService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,66 +33,79 @@ public class DelegatingExecutorService implements ExecutorService this.delegate = delegate; } + @Override public void execute(Runnable command) { delegate.execute(command); } + @Override public void shutdown() { // Do nothing. } + @Override public List<Runnable> shutdownNow() { return Collections.emptyList(); } + @Override public boolean isShutdown() { return delegate.isShutdown(); } + @Override public boolean isTerminated() { return delegate.isTerminated(); } + @Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { return delegate.awaitTermination(timeout, unit); } + @Override public <T> Future<T> submit(Callable<T> task) { return delegate.submit(task); } + @Override public <T> Future<T> submit(Runnable task, T result) { return delegate.submit(task, result); } + @Override public Future<?> submit(Runnable task) { return delegate.submit(task); } + @Override public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException { return delegate.invokeAll(tasks); } + @Override public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException { return delegate.invokeAll(tasks, timeout, unit); } + @Override public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException { return delegate.invokeAny(tasks); } + @Override public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return delegate.invokeAny(tasks, timeout, unit); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorServiceFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorServiceFactory.java index 0f325aed15..355140b8a2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorServiceFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorServiceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, 2012, 2015, 2016, 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009, 2011, 2012, 2015, 2016, 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,6 +47,7 @@ public class ExecutorServiceFactory extends Factory super(PRODUCT_GROUP, DEFAULT_TYPE); } + @Override public ExecutorService create(String description) { final ExecutorService executorService = ThreadPool.create(description); @@ -55,11 +56,13 @@ public class ExecutorServiceFactory extends Factory { private boolean active; + @Override public void activate() throws LifecycleException { active = true; } + @Override public Exception deactivate() { try @@ -74,31 +77,37 @@ public class ExecutorServiceFactory extends Factory } } + @Override public LifecycleState getLifecycleState() { return active ? LifecycleState.ACTIVE : LifecycleState.INACTIVE; } + @Override public boolean isActive() { return active; } + @Override public void addListener(IListener listener) { // Do nothing } + @Override public void removeListener(IListener listener) { // Do nothing } + @Override public IListener[] getListeners() { return EventUtil.NO_LISTENERS; } + @Override public boolean hasListeners() { return false; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java index 5491193f37..d7f2cb7689 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ExecutorWorkSerializer.java @@ -54,6 +54,7 @@ public class ExecutorWorkSerializer extends Lifecycle implements IWorkSerializer this.executor = executor; } + @Override public synchronized boolean addWork(Runnable runnable) { if (disposed) @@ -73,6 +74,7 @@ public class ExecutorWorkSerializer extends Lifecycle implements IWorkSerializer return true; } + @Override public synchronized void dispose() { LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG); @@ -99,6 +101,7 @@ public class ExecutorWorkSerializer extends Lifecycle implements IWorkSerializer { executor.execute(new Runnable() { + @Override public void run() { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java index ff1147e890..7d126ad143 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/MonitoredThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -164,6 +164,7 @@ public abstract class MonitoredThread extends Thread } } + @Override public void handleStarting(MonitoredThread thread) { if (startLatch != null) @@ -183,6 +184,7 @@ public abstract class MonitoredThread extends Thread } } + @Override public void handleFinished(MonitoredThread thread) { synchronized (threads) @@ -191,6 +193,7 @@ public abstract class MonitoredThread extends Thread } } + @Override public void run() { startupThreads(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/NonFairReentrantLock.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/NonFairReentrantLock.java index 753d74e36c..f51cbcc46b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/NonFairReentrantLock.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/NonFairReentrantLock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2016, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,31 +31,37 @@ public class NonFairReentrantLock implements Lock, Serializable { } + @Override public void lock() { sync.lock(); } + @Override public void lockInterruptibly() throws InterruptedException { sync.acquireInterruptibly(1); } + @Override public boolean tryLock() { return sync.tryAcquire(1); } + @Override public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException { return sync.tryAcquireNanos(1, unit.toNanos(timeout)); } + @Override public void unlock() { sync.release(1); } + @Override public Condition newCondition() { return sync.newCondition(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/OnePendingExecutor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/OnePendingExecutor.java index 7ec15605da..cddd4b1316 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/OnePendingExecutor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/OnePendingExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ public class OnePendingExecutor implements Executor { } + @Override public synchronized void execute(Runnable command) { if (this.command != null) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ParallelRunner.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ParallelRunner.java index b684771ce7..fd39a37f29 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ParallelRunner.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ParallelRunner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -48,6 +48,7 @@ public class ParallelRunner extends ArrayList<Runnable> { executorService.submit(new Runnable() { + @Override public void run() { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunnable.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunnable.java index 28a1e0b68c..7f2e7e2255 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunnable.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/PriorityQueueRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,6 +16,7 @@ package org.eclipse.net4j.util.concurrent; */ public abstract class PriorityQueueRunnable implements Runnable, Comparable<PriorityQueueRunnable> { + @Override public int compareTo(PriorityQueueRunnable o) { return getPriority().compareTo(o.getPriority()); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorkerWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorkerWorkSerializer.java index b55ef3d387..5f149a9094 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorkerWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/QueueWorkerWorkSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,7 @@ public class QueueWorkerWorkSerializer extends QueueRunner implements IWorkSeria activate(); } + @Override public void dispose() { LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java index 9736f4070b..7ea991c73c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWLockManager.java @@ -39,26 +39,31 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock { private LockStrategy<OBJECT, CONTEXT> readLockStrategy = new LockStrategy<OBJECT, CONTEXT>() { + @Override public boolean isLocked(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.isReadLock(context); } + @Override public boolean isLockedByOthers(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.isReadLockByOthers(context); } + @Override public boolean canObtainLock(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.canObtainReadLock(context); } + @Override public LockEntry<OBJECT, CONTEXT> lock(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.readLock(context); } + @Override public LockEntry<OBJECT, CONTEXT> unlock(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.readUnlock(context); @@ -73,26 +78,31 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock private LockStrategy<OBJECT, CONTEXT> writeLockStrategy = new LockStrategy<OBJECT, CONTEXT>() { + @Override public boolean isLocked(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.isWriteLock(context); } + @Override public boolean isLockedByOthers(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.isWriteLockByOthers(context); } + @Override public boolean canObtainLock(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.canObtainWriteLock(context); } + @Override public LockEntry<OBJECT, CONTEXT> lock(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.writeLock(context); } + @Override public LockEntry<OBJECT, CONTEXT> unlock(LockEntry<OBJECT, CONTEXT> entry, CONTEXT context) { return entry.writeUnlock(context); @@ -112,6 +122,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock /** * @since 3.0 */ + @Override public void lock(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException { LockStrategy<OBJECT, CONTEXT> lockingStrategy = getLockingStrategy(type); @@ -121,6 +132,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock /** * @since 3.0 */ + @Override public void lock(LockType type, CONTEXT context, OBJECT objectToLock, long timeout) throws InterruptedException { List<OBJECT> objectsToLock = Collections.singletonList(objectToLock); @@ -134,6 +146,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock * Unlocking objects without lock. * @since 3.0 */ + @Override public void unlock(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) { LockStrategy<OBJECT, CONTEXT> lockingStrategy = getLockingStrategy(type); @@ -143,6 +156,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock /** * Attempts to release all locks(read and write) for a given context. */ + @Override public void unlock(CONTEXT context) { synchronized (lockChanged) @@ -183,6 +197,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock /** * @since 3.0 */ + @Override public boolean hasLock(LockType type, CONTEXT context, OBJECT objectToLock) { LockStrategy<OBJECT, CONTEXT> lockingStrategy = getLockingStrategy(type); @@ -192,6 +207,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock /** * @since 3.0 */ + @Override public boolean hasLockByOthers(LockType type, CONTEXT context, OBJECT objectToLock) { LockStrategy<OBJECT, CONTEXT> lockingStrategy = getLockingStrategy(type); @@ -469,21 +485,25 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock contexts.add(context); } + @Override public OBJECT getObject() { return object; } + @Override public boolean isReadLock(CONTEXT context) { return contexts.contains(context); } + @Override public boolean isWriteLock(CONTEXT context) { return false; } + @Override public boolean isReadLockByOthers(CONTEXT context) { if (contexts.isEmpty()) @@ -494,43 +514,51 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock return contexts.size() > (isReadLock(context) ? 1 : 0); } + @Override public boolean isWriteLockByOthers(CONTEXT context) { return false; } + @Override public boolean canObtainReadLock(CONTEXT context) { return true; } + @Override public boolean canObtainWriteLock(CONTEXT context) { return contexts.size() == 1 && contexts.contains(context); } + @Override public LockEntry<OBJECT, CONTEXT> readLock(CONTEXT context) { contexts.add(context); return this; } + @Override public LockEntry<OBJECT, CONTEXT> writeLock(CONTEXT context) { return new WriteLockEntry<OBJECT, CONTEXT>(object, context, this); } + @Override public LockEntry<OBJECT, CONTEXT> readUnlock(CONTEXT context) { contexts.remove(context); return contexts.isEmpty() ? null : this; } + @Override public LockEntry<OBJECT, CONTEXT> writeUnlock(CONTEXT context) { throw new IllegalMonitorStateException(); } + @Override public LockEntry<OBJECT, CONTEXT> clearLock(CONTEXT context) { while (contexts.remove(context)) @@ -540,6 +568,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock return contexts.isEmpty() ? null : this; } + @Override public void changeContext(CONTEXT oldContext, CONTEXT newContext) { if (contexts.remove(oldContext)) @@ -548,6 +577,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock } } + @Override public boolean hasContext(CONTEXT context) { return contexts.contains(context); @@ -581,41 +611,49 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock this.count = 1; } + @Override public OBJECT getObject() { return object; } + @Override public boolean isReadLock(CONTEXT context) { return readLock != null ? readLock.isReadLock(context) : false; } + @Override public boolean isWriteLock(CONTEXT context) { return ObjectUtil.equals(this.context, context); } + @Override public boolean isReadLockByOthers(CONTEXT context) { return readLock != null ? readLock.isReadLockByOthers(context) : false; } + @Override public boolean isWriteLockByOthers(CONTEXT context) { return context != this.context; } + @Override public boolean canObtainWriteLock(CONTEXT context) { return ObjectUtil.equals(this.context, context); } + @Override public boolean canObtainReadLock(CONTEXT context) { return ObjectUtil.equals(this.context, context); } + @Override public LockEntry<OBJECT, CONTEXT> readLock(CONTEXT context) { ReadLockEntry<OBJECT, CONTEXT> lock = getReadLock(); @@ -623,12 +661,14 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock return this; } + @Override public LockEntry<OBJECT, CONTEXT> writeLock(CONTEXT context) { count++; return this; } + @Override public LockEntry<OBJECT, CONTEXT> readUnlock(CONTEXT context) { if (readLock != null) @@ -644,11 +684,13 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock throw new IllegalMonitorStateException(); } + @Override public LockEntry<OBJECT, CONTEXT> writeUnlock(CONTEXT context) { return --count <= 0 ? readLock : this; } + @Override public LockEntry<OBJECT, CONTEXT> clearLock(CONTEXT context) { if (readLock != null) @@ -662,6 +704,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock return ObjectUtil.equals(this.context, context) ? readLock : this; } + @Override public void changeContext(CONTEXT oldContext, CONTEXT newContext) { if (ObjectUtil.equals(context, oldContext)) @@ -670,6 +713,7 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock } } + @Override public boolean hasContext(CONTEXT context) { return ObjectUtil.equals(this.context, context); @@ -704,71 +748,85 @@ public class RWLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWLock this.object = objectToLock; } + @Override public OBJECT getObject() { return object; } + @Override public boolean isReadLock(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public boolean isWriteLock(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public boolean isReadLockByOthers(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public boolean isWriteLockByOthers(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public boolean canObtainWriteLock(CONTEXT context) { return true; } + @Override public boolean canObtainReadLock(CONTEXT context) { return true; } + @Override public LockEntry<OBJECT, CONTEXT> readLock(CONTEXT context) { return new ReadLockEntry<OBJECT, CONTEXT>(object, context); } + @Override public LockEntry<OBJECT, CONTEXT> writeLock(CONTEXT context) { return new WriteLockEntry<OBJECT, CONTEXT>(object, context, null); } + @Override public LockEntry<OBJECT, CONTEXT> readUnlock(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public LockEntry<OBJECT, CONTEXT> writeUnlock(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public LockEntry<OBJECT, CONTEXT> clearLock(CONTEXT context) { throw new UnsupportedOperationException(); } + @Override public void changeContext(CONTEXT oldContext, CONTEXT newContext) { // Do nothing } + @Override public boolean hasContext(CONTEXT context) { return false; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java index 3cbdf67caa..9e27bd6714 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RWOLockManager.java @@ -57,11 +57,13 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo */ private final Map<CONTEXT, Set<LockState<OBJECT, CONTEXT>>> contextToLockStates = createContextToLocksMap(); + @Override public void lock(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException { lock2(type, context, objectsToLock, timeout); } + @Override public List<LockState<OBJECT, CONTEXT>> lock2(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToLock, long timeout) throws InterruptedException { @@ -102,22 +104,26 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo } } + @Override public void lock(LockType type, CONTEXT context, OBJECT objectToLock, long timeout) throws InterruptedException { // Do not synchronize the entire method as it would corrupt the timeout! lock(type, context, Collections.singleton(objectToLock), timeout); } + @Override public void unlock(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) { unlock2(type, context, objectsToUnlock); } + @Override public List<LockState<OBJECT, CONTEXT>> unlock2(CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) { return unlock2(ALL_LOCK_TYPES, context, objectsToUnlock); } + @Override public List<LockState<OBJECT, CONTEXT>> unlock2(LockType type, CONTEXT context, Collection<? extends OBJECT> objectsToUnlock) { return unlock2(new LockType[] { type }, context, objectsToUnlock); @@ -180,11 +186,13 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo return new LinkedList<RWOLockManager.LockState<OBJECT, CONTEXT>>(result); } + @Override public synchronized void unlock(CONTEXT context) { unlock2(context); } + @Override public synchronized List<LockState<OBJECT, CONTEXT>> unlock2(CONTEXT context) { Set<LockState<OBJECT, CONTEXT>> lockStates = contextToLockStates.get(context); @@ -230,12 +238,14 @@ public class RWOLockManager<OBJECT, CONTEXT> extends Lifecycle implements IRWOLo return toList(lockStates); } + @Override public synchronized boolean hasLock(LockType type, CONTEXT context, OBJECT objectToLock) { LockState<OBJECT, CONTEXT> lockState = objectToLockStateMap.get(objectToLock); return lockState != null && lockState.hasLock(type, context, false); } + @Override public synchronized boolean hasLockByOthers(LockType type, CONTEXT context, OBJECT objectToLock) { LockState<OBJECT, CONTEXT> lockState = objectToLockStateMap.get(objectToLock); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ResultSynchronizer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ResultSynchronizer.java index f8da8f3e05..f685b6eb69 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ResultSynchronizer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ResultSynchronizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,6 +30,7 @@ public final class ResultSynchronizer<RESULT> implements ISynchronizer<RESULT> { } + @Override public RESULT get(long timeout) { try @@ -64,6 +65,7 @@ public final class ResultSynchronizer<RESULT> implements ISynchronizer<RESULT> } } + @Override public void put(RESULT result) { synchronized (consumerLock) @@ -73,6 +75,7 @@ public final class ResultSynchronizer<RESULT> implements ISynchronizer<RESULT> } } + @Override public boolean put(RESULT result, long timeout) { synchronized (consumerLock) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RunnableWithName.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RunnableWithName.java index de7ab060c8..b0cecdd49a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RunnableWithName.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/RunnableWithName.java @@ -21,6 +21,7 @@ public abstract class RunnableWithName implements Runnable { private static final boolean ENABLE_RUNNABLE_NAMES = OMPlatform.INSTANCE.isProperty("org.eclipse.net4j.util.concurrent.ENABLE_RUNNABLE_NAMES"); + @Override public final void run() { if (!ENABLE_RUNNABLE_NAMES) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java index de1f6833ca..9be6da371a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SerializingExecutor.java @@ -51,6 +51,7 @@ public class SerializingExecutor extends Lifecycle implements Executor, Runnable this.delegate = delegate == null ? SynchronousExecutor.INSTANCE : delegate; } + @Override public final void execute(Runnable task) { tasks.add(task); @@ -61,6 +62,7 @@ public class SerializingExecutor extends Lifecycle implements Executor, Runnable } } + @Override public final void run() { Runnable task; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Stoppable.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Stoppable.java index ea439554c3..c0ac2bbada 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Stoppable.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Stoppable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,7 @@ public abstract class Stoppable implements Runnable stopped = true; } + @Override public final void run() { while (!isStopped()) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java index 599d9d64fc..5c2b0496dc 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronizingCorrelator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2012, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,11 +28,13 @@ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator return map.get(correlation); } + @Override public boolean isCorrelated(CORRELATION correlation) { return map.containsKey(correlation); } + @Override public ISynchronizer<RESULT> correlate(CORRELATION correlation) { ISynchronizer<RESULT> synchronizer = map.get(correlation); @@ -45,6 +47,7 @@ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator return synchronizer; } + @Override public ISynchronizer<RESULT> correlateUnique(CORRELATION correlation) { ISynchronizer<RESULT> synchronizer = createSynchronizer(correlation); @@ -56,6 +59,7 @@ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator return synchronizer; } + @Override public ISynchronizer<RESULT> uncorrelate(CORRELATION correlation) { return map.remove(correlation); @@ -98,6 +102,7 @@ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator { private ISynchronizer<RESULT> delegate = new ResultSynchronizer<RESULT>(); + @Override public RESULT get(long timeout) { RESULT result = delegate.get(timeout); @@ -105,11 +110,13 @@ public class SynchronizingCorrelator<CORRELATION, RESULT> implements ICorrelator return result; } + @Override public void put(RESULT result) { delegate.put(result); } + @Override public boolean put(RESULT result, long timeout) { return delegate.put(result, timeout); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousExecutor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousExecutor.java index db98e9c1d8..cc4fe9c7ba 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousExecutor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousExecutor.java @@ -26,6 +26,7 @@ public final class SynchronousExecutor implements Executor { } + @Override public void execute(Runnable work) { work.run(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousWorkSerializer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousWorkSerializer.java index 4185e5115f..ac58fdbca2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousWorkSerializer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/SynchronousWorkSerializer.java @@ -21,12 +21,14 @@ public class SynchronousWorkSerializer implements IWorkSerializer { } + @Override public boolean addWork(Runnable work) { work.run(); return true; } + @Override public void dispose() { } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java index 961058e0a6..9b2d712a72 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/ThreadPool.java @@ -86,6 +86,7 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH return userHandler; } + @Override public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) { WorkQueue queue = (WorkQueue)getQueue(); @@ -273,6 +274,7 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH { private final AtomicInteger num = new AtomicInteger(); + @Override public Thread newThread(Runnable task) { Thread thread = new Thread(threadGroup, task, threadGroup.getName() + "-thread-" + num.incrementAndGet()); @@ -345,11 +347,13 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH { } + @Override public void setThreadPool(ThreadPool threadPool) { this.threadPool = threadPool; } + @Override public boolean offerLast(Runnable task) { // Call the super method because the method in this class is overridden. @@ -381,11 +385,13 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH { } + @Override public void setThreadPool(ThreadPool threadPool) { this.threadPool = threadPool; } + @Override public boolean offerLast(Runnable task) { try @@ -400,6 +406,7 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH } } + @Override public boolean offer(Runnable task) { if (threadPool.shallEnqueue()) @@ -410,6 +417,7 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH return false; } + @Override public boolean offer(Runnable taske, long timeout, TimeUnit unit) throws InterruptedException { return delegate.offer(taske, timeout, unit); @@ -421,16 +429,19 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH return delegate.size(); } + @Override public Runnable take() throws InterruptedException { return delegate.take(); } + @Override public Runnable poll(long timeout, TimeUnit unit) throws InterruptedException { return delegate.poll(timeout, unit); } + @Override public Runnable poll() { return delegate.poll(); @@ -442,26 +453,31 @@ public class ThreadPool extends ThreadPoolExecutor implements RejectedExecutionH return delegate.iterator(); } + @Override public Runnable peek() { return delegate.peek(); } + @Override public void put(Runnable task) throws InterruptedException { delegate.put(task); } + @Override public int remainingCapacity() { return delegate.remainingCapacity(); } + @Override public int drainTo(Collection<? super Runnable> c) { return delegate.drainTo(c); } + @Override public int drainTo(Collection<? super Runnable> c, int maxElements) { return delegate.drainTo(c, maxElements); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TimerLifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TimerLifecycle.java index 6c9610abc7..ca80819c15 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TimerLifecycle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/TimerLifecycle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -64,41 +64,49 @@ public class TimerLifecycle extends Timer implements ILifecycle /** * @since 3.0 */ + @Override public final LifecycleState getLifecycleState() { return delegate.getLifecycleState(); } + @Override public final boolean isActive() { return delegate.isActive(); } + @Override public void addListener(IListener listener) { delegate.addListener(listener); } + @Override public void removeListener(IListener listener) { delegate.removeListener(listener); } + @Override public IListener[] getListeners() { return delegate.getListeners(); } + @Override public boolean hasListeners() { return delegate.hasListeners(); } + @Override public final void activate() throws LifecycleException { delegate.activate(); } + @Override public final Exception deactivate() { return delegate.deactivate(); @@ -122,6 +130,7 @@ public class TimerLifecycle extends Timer implements ILifecycle super(PRODUCT_GROUP, TYPE); } + @Override public Object create(String name) throws ProductCreationException { if (name == null) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Worker.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Worker.java index 9f1a3687f2..95827b9732 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Worker.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/concurrent/Worker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2013, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2013, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public abstract class Worker extends Lifecycle */ public static final IErrorHandler DEFAULT_ERROR_HANDLER = new IErrorHandler() { + @Override public void handleError(Throwable t) { OM.LOG.error(t); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/confirmation/IConfirmationProvider.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/confirmation/IConfirmationProvider.java index 037eb048c7..b0375cf861 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/confirmation/IConfirmationProvider.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/confirmation/IConfirmationProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -61,6 +61,7 @@ public interface IConfirmationProvider super(DEFAULT_TYPE); } + @Override public Object create(String description) throws ProductCreationException { return new ConfirmationProvider(); @@ -68,11 +69,13 @@ public interface IConfirmationProvider private static final class ConfirmationProvider implements IConfirmationProvider { + @Override public boolean isInteractive() { return false; } + @Override public Confirmation confirm(String subject, String message, Set<Confirmation> acceptable, Confirmation suggestion) { // Just return the suggestion, or else the greatest of the acceptable set diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java index 6b83da866e..b61d6680a2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/Container.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,6 +37,7 @@ public abstract class Container<E> extends ShareableLifecycle implements IContai super(shareable); } + @Override public boolean isEmpty() { if (!isActive()) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerDelta.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerDelta.java index c09ebb4ee8..97aa38f806 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerDelta.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerDelta.java @@ -27,6 +27,7 @@ public class ContainerDelta<E> implements IContainerDelta<E> this.kind = kind; } + @Override public E getElement() { return element; @@ -37,6 +38,7 @@ public class ContainerDelta<E> implements IContainerDelta<E> throw new UnsupportedOperationException(); } + @Override public Kind getKind() { return kind; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java index a129510a07..5eb617a98f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEvent.java @@ -50,17 +50,20 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E> return (IContainer<E>)super.getSource(); } + @Override public boolean isEmpty() { return deltas.isEmpty(); } + @Override @SuppressWarnings("unchecked") public IContainerDelta<E>[] getDeltas() { return deltas.toArray(new IContainerDelta[deltas.size()]); } + @Override public IContainerDelta<E> getDelta() throws IllegalStateException { if (deltas.size() != 1) @@ -71,11 +74,13 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E> return deltas.get(0); } + @Override public E getDeltaElement() throws IllegalStateException { return getDelta().getElement(); } + @Override public IContainerDelta.Kind getDeltaKind() throws IllegalStateException { return getDelta().getKind(); @@ -91,6 +96,7 @@ public class ContainerEvent<E> extends Event implements IContainerEvent<E> deltas.add(delta); } + @Override public void accept(IContainerEventVisitor<E> visitor) { for (IContainerDelta<E> delta : deltas) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEventAdapter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEventAdapter.java index 41f71cbf03..6b1341dac7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEventAdapter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerEventAdapter.java @@ -48,6 +48,7 @@ public class ContainerEventAdapter<E> implements IListener return waitForActive; } + @Override public final void notifyEvent(IEvent event) { if (event instanceof IContainerEvent<?>) @@ -67,6 +68,7 @@ public class ContainerEventAdapter<E> implements IListener final IContainer<E> container = event.getSource(); event.accept(new IContainerEventVisitor<E>() { + @Override public void added(final E element) { if (waitForActive && !LifecycleUtil.isActive(element)) @@ -87,6 +89,7 @@ public class ContainerEventAdapter<E> implements IListener } } + @Override public void removed(E element) { onRemoved(container, element); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java index 19814da043..c637e590a0 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerPersistence.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,6 +29,7 @@ import java.util.Collection; */ public abstract class ContainerPersistence<E> implements Persistence<E> { + @Override public Collection<E> loadElements() throws IORuntimeException { InputStream out = null; @@ -56,6 +57,7 @@ public abstract class ContainerPersistence<E> implements Persistence<E> } } + @Override public void saveElements(Collection<E> elements) throws IORuntimeException { OutputStream out = null; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerUtil.java index 6a7c5825cf..825e169e41 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ContainerUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011-2013, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011-2013, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,29 +30,35 @@ public final class ContainerUtil private static final IContainer<Object> EMPTY = new IContainer<Object>() { + @Override public Object[] getElements() { return NO_ELEMENTS; } + @Override public boolean isEmpty() { return true; } + @Override public void addListener(IListener listener) { } + @Override public void removeListener(IListener listener) { } + @Override public IListener[] getListeners() { return EventUtil.NO_LISTENERS; } + @Override public boolean hasListeners() { return false; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/IContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/IContainerEvent.java index 7f3aef7b97..b5cfbe12a6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/IContainerEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/IContainerEvent.java @@ -25,6 +25,7 @@ public interface IContainerEvent<E> extends IEvent /** * @since 3.0 */ + @Override public IContainer<E> getSource(); public boolean isEmpty(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java index 59b0f7a3ee..5c9aadc50e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/LifecycleEventConverter.java @@ -36,6 +36,7 @@ public class LifecycleEventConverter<E> implements IListener return owner; } + @Override public void notifyEvent(IEvent event) { if (event instanceof ILifecycleEvent) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java index 4a2053d273..60ec7c5c96 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/ManagedContainer.java @@ -89,6 +89,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer /** * @since 3.8 */ + @Override public String getName() { return name; @@ -97,12 +98,14 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer /** * @since 3.8 */ + @Override public void setName(String name) { checkInactive(); this.name = name; } + @Override public synchronized IRegistry<IFactoryKey, IFactory> getFactoryRegistry() { if (factoryRegistry == null) @@ -137,12 +140,14 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return factoryRegistry; } + @Override public ManagedContainer registerFactory(IFactory factory) { getFactoryRegistry().put(factory.getKey(), factory); return this; } + @Override public synchronized List<IElementProcessor> getPostProcessors() { if (postProcessors == null) @@ -153,6 +158,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return postProcessors; } + @Override public synchronized void addPostProcessor(IElementProcessor postProcessor, boolean processExistingElements) { if (processExistingElements) @@ -185,16 +191,19 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer getPostProcessors().add(postProcessor); } + @Override public void addPostProcessor(IElementProcessor postProcessor) { addPostProcessor(postProcessor, false); } + @Override public void removePostProcessor(IElementProcessor postProcessor) { getPostProcessors().remove(postProcessor); } + @Override public Set<String> getProductGroups() { checkActive(); @@ -212,6 +221,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return result; } + @Override public Set<String> getFactoryTypes(String productGroup) { checkActive(); @@ -235,6 +245,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return result; } + @Override public IFactory getFactory(String productGroup, String factoryType) throws FactoryNotFoundException { FactoryKey key = new FactoryKey(productGroup, factoryType); @@ -247,6 +258,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return factory; } + @Override public boolean isEmpty() { checkActive(); @@ -256,6 +268,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer } } + @Override public String[] getElementKey(Object element) { checkActive(); @@ -272,12 +285,14 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return null; } + @Override public Object[] getElements() { checkActive(); return getElementRegistryValues(); } + @Override public Object[] getElements(String productGroup) { checkActive(); @@ -294,6 +309,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return result.toArray(); } + @Override public Object[] getElements(String productGroup, String factoryType) { checkActive(); @@ -310,6 +326,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return result.toArray(); } + @Override public Object getElement(String productGroup, String factoryType, String description) throws FactoryNotFoundException, ProductCreationException { return getElement(productGroup, factoryType, description, true); @@ -318,6 +335,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer /** * @since 2.0 */ + @Override public Object getElement(String productGroup, String factoryType, String description, boolean activate) throws FactoryNotFoundException, ProductCreationException { @@ -370,6 +388,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer } } + @Override public Object putElement(String productGroup, String factoryType, String description, Object element) { checkActive(); @@ -411,6 +430,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return oldElement; } + @Override public Object removeElement(String productGroup, String factoryType, String description) { checkActive(); @@ -440,6 +460,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return element; } + @Override public void clearElements() { checkActive(); @@ -465,6 +486,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer } } + @Override public void loadElements(InputStream stream) throws IOException, FactoryNotFoundException, ProductCreationException { checkActive(); @@ -496,6 +518,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer } } + @Override public void saveElements(OutputStream stream) throws IOException { checkActive(); @@ -729,6 +752,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer return MessageFormat.format("{0}[{1}, {2}]", productGroup, factoryType, description); //$NON-NLS-1$ } + @Override public int compareTo(ElementKey key) { if (id < key.id) @@ -750,6 +774,7 @@ public class ManagedContainer extends Lifecycle implements IManagedContainer */ private static final class EntryComparator implements Comparator<Entry<ElementKey, Object>> { + @Override public int compare(Entry<ElementKey, Object> entry1, Entry<ElementKey, Object> entry2) { return entry1.getKey().compareTo(entry2.getKey()); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SelfAttachingContainerListener.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SelfAttachingContainerListener.java index 77c39e37a9..3365ab2432 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SelfAttachingContainerListener.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SelfAttachingContainerListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -96,6 +96,7 @@ public class SelfAttachingContainerListener implements IListener } } + @Override public void notifyEvent(IEvent event) { if (event instanceof IContainerEvent<?>) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java index 80df083446..cbb9e39fa2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SetContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -56,6 +56,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab /** * @since 3.5 */ + @Override public final Persistence<E> getPersistence() { return persistence; @@ -64,6 +65,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab /** * @since 3.5 */ + @Override public final void setPersistence(Persistence<E> persistence) { this.persistence = persistence; @@ -83,6 +85,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab return set.isEmpty(); } + @Override public E[] getElements() { E[] array; @@ -98,6 +101,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab return array; } + @Override public boolean addElement(E element) { if (!validateElement(element)) @@ -129,6 +133,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab /** * @since 3.5 */ + @Override public boolean addAllElements(Collection<E> elements) { List<E> validElements = new ArrayList<E>(); @@ -174,6 +179,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab return false; } + @Override public boolean removeElement(E element) { IContainerEvent<E> event = null; @@ -200,6 +206,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab /** * @since 3.5 */ + @Override public boolean removeAllElements(Collection<E> elements) { ContainerEvent<E> event = null; @@ -272,6 +279,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab /** * @since 3.5 */ + @Override public synchronized void load() throws IORuntimeException { if (persistence != null) @@ -286,6 +294,7 @@ public class SetContainer<E> extends Container<E> implements IContainer.Modifiab /** * @since 3.5 */ + @Override public synchronized void save() throws IORuntimeException { if (persistence != null) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java index 8a97bebbf1..467002723a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/SingleDeltaContainerEvent.java @@ -44,31 +44,37 @@ public class SingleDeltaContainerEvent<E> extends Event implements IContainerEve return (IContainer<E>)super.getSource(); } + @Override public boolean isEmpty() { return false; } + @Override public IContainerDelta<E>[] getDeltas() { return deltas; } + @Override public IContainerDelta<E> getDelta() throws IllegalStateException { return deltas[0]; } + @Override public E getDeltaElement() throws IllegalStateException { return deltas[0].getElement(); } + @Override public IContainerDelta.Kind getDeltaKind() throws IllegalStateException { return deltas[0].getKind(); } + @Override public void accept(IContainerEventVisitor<E> visitor) { E element = deltas[0].getElement(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java index 33c9a74bc7..f95ecd0b52 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/AbstractDelegator.java @@ -103,6 +103,7 @@ public abstract class AbstractDelegator<E> extends Notifier implements IContaine /** * @category READ */ + @Override public boolean hasNext() { return getDelegate().hasNext(); @@ -111,6 +112,7 @@ public abstract class AbstractDelegator<E> extends Notifier implements IContaine /** * @category READ */ + @Override public E next() { return last = getDelegate().next(); @@ -119,6 +121,7 @@ public abstract class AbstractDelegator<E> extends Notifier implements IContaine /** * @category WRITE */ + @Override public void remove() { getDelegate().remove(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerBlockingQueue.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerBlockingQueue.java index ffb255e85a..02900b2088 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerBlockingQueue.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerBlockingQueue.java @@ -39,6 +39,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category WRITE */ + @Override public int drainTo(Collection<? super E> c) { int drainTo = getDelegate().drainTo(c); @@ -54,6 +55,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category WRITE */ + @Override public int drainTo(Collection<? super E> c, int maxElements) { int drainTo = getDelegate().drainTo(c, maxElements); @@ -70,6 +72,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category WRITE */ + @Override public boolean offer(E o, long timeout, TimeUnit unit) throws InterruptedException { boolean modified = getDelegate().offer(o, timeout, unit); @@ -84,6 +87,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category WRITE */ + @Override public E poll(long timeout, TimeUnit unit) throws InterruptedException { E removed = getDelegate().poll(timeout, unit); @@ -98,6 +102,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category WRITE */ + @Override public void put(E o) throws InterruptedException { getDelegate().put(o); @@ -107,6 +112,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category READ */ + @Override public int remainingCapacity() { return getDelegate().remainingCapacity(); @@ -115,6 +121,7 @@ public class ContainerBlockingQueue<E> extends ContainerQueue<E> implements ICon /** * @category WRITE */ + @Override public E take() throws InterruptedException { E element = getDelegate().take(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java index 88a04226c9..dd6044218f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerCollection.java @@ -31,11 +31,13 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon this.delegate = delegate; } + @Override public Collection<E> getDelegate() { return delegate; } + @Override @SuppressWarnings("unchecked") public E[] getElements() { @@ -45,6 +47,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category WRITE */ + @Override public boolean add(E o) { boolean modified = getDelegate().add(o); @@ -59,6 +62,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category WRITE */ + @Override public boolean addAll(Collection<? extends E> c) { ContainerEvent<E> event = new ContainerEvent<E>(this); @@ -77,6 +81,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category WRITE */ + @Override public void clear() { if (!isEmpty()) @@ -94,6 +99,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category WRITE */ + @Override public boolean remove(Object o) { boolean modified = getDelegate().remove(o); @@ -108,6 +114,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category WRITE */ + @Override @SuppressWarnings("unchecked") public boolean removeAll(Collection<?> c) { @@ -127,6 +134,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category WRITE */ + @Override @SuppressWarnings("unchecked") public boolean retainAll(Collection<?> c) { @@ -146,6 +154,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public boolean contains(Object o) { return getDelegate().contains(o); @@ -154,6 +163,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public boolean containsAll(Collection<?> c) { return getDelegate().containsAll(c); @@ -180,6 +190,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public boolean isEmpty() { return getDelegate().isEmpty(); @@ -188,6 +199,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public Iterator<E> iterator() { return new DelegatingIterator(getDelegate().iterator()); @@ -196,6 +208,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public int size() { return getDelegate().size(); @@ -204,6 +217,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public Object[] toArray() { return getDelegate().toArray(); @@ -212,6 +226,7 @@ public class ContainerCollection<E> extends AbstractDelegator<E> implements ICon /** * @category READ */ + @Override public <T> T[] toArray(T[] a) { return getDelegate().toArray(a); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java index d203d99435..cabe726a93 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerList.java @@ -39,6 +39,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category WRITE */ + @Override public void add(int index, E element) { getDelegate().add(index, element); @@ -48,6 +49,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category WRITE */ + @Override public boolean addAll(int index, Collection<? extends E> c) { ContainerEvent<E> event = createEvent(getDelegate(), IContainerDelta.Kind.ADDED); @@ -58,6 +60,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public E get(int index) { return getDelegate().get(index); @@ -66,6 +69,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public int indexOf(Object o) { return getDelegate().indexOf(o); @@ -74,6 +78,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public int lastIndexOf(Object o) { return getDelegate().lastIndexOf(o); @@ -82,6 +87,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public ListIterator<E> listIterator() { return new DelegatingListIterator(getDelegate().listIterator()); @@ -90,6 +96,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public ListIterator<E> listIterator(int index) { return new DelegatingListIterator(getDelegate().listIterator(index)); @@ -98,6 +105,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category WRITE */ + @Override public E remove(int index) { E removed = getDelegate().remove(index); @@ -112,6 +120,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category WRITE */ + @Override public E set(int index, E element) { E removed = getDelegate().set(index, element); @@ -130,6 +139,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public List<E> subList(int fromIndex, int toIndex) { return getDelegate().subList(fromIndex, toIndex); @@ -156,6 +166,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category WRITE */ + @Override public void add(E o) { getDelegate().add(o); @@ -166,6 +177,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category WRITE */ + @Override public void set(E o) { getDelegate().set(o); @@ -184,6 +196,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public boolean hasPrevious() { return getDelegate().hasPrevious(); @@ -192,6 +205,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public int nextIndex() { return getDelegate().nextIndex(); @@ -200,6 +214,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public E previous() { return getDelegate().previous(); @@ -208,6 +223,7 @@ public class ContainerList<E> extends ContainerCollection<E> implements IContain /** * @category READ */ + @Override public int previousIndex() { return getDelegate().previousIndex(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java index 5fdec37ece..22929de4eb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerMap.java @@ -34,6 +34,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple this.delegate = delegate; } + @Override public Map<K, V> getDelegate() { return delegate; @@ -42,6 +43,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category WRITE */ + @Override public void clear() { if (!isEmpty()) @@ -59,6 +61,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category WRITE */ + @Override public V put(K key, V value) { ContainerEvent<Map.Entry<K, V>> event = new ContainerEvent<Map.Entry<K, V>>(this); @@ -81,6 +84,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category WRITE */ + @Override public void putAll(Map<? extends K, ? extends V> t) { ContainerEvent<Map.Entry<K, V>> event = new ContainerEvent<Map.Entry<K, V>>(this); @@ -105,6 +109,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category WRITE */ + @Override public V remove(Object key) { V removed = getDelegate().remove(key); @@ -119,6 +124,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public boolean containsKey(Object key) { return getDelegate().containsKey(key); @@ -127,6 +133,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public boolean containsValue(Object value) { return getDelegate().containsValue(value); @@ -135,6 +142,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public V get(Object key) { return getDelegate().get(key); @@ -143,6 +151,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public int size() { return getDelegate().size(); @@ -151,6 +160,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override @SuppressWarnings("unchecked") public Map.Entry<K, V>[] getElements() { @@ -160,6 +170,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public boolean isEmpty() { return getDelegate().isEmpty(); @@ -168,6 +179,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public Set<Map.Entry<K, V>> entrySet() { return new ContainerSet<Map.Entry<K, V>>(getDelegate().entrySet()); @@ -176,6 +188,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public Set<K> keySet() { return new ContainerSet<K>(getDelegate().keySet()); @@ -184,6 +197,7 @@ public class ContainerMap<K, V> extends AbstractDelegator<Map.Entry<K, V>> imple /** * @category READ */ + @Override public Collection<V> values() { return new ContainerCollection<V>(getDelegate().values()); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerQueue.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerQueue.java index 81f270d8f7..520f80eda7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerQueue.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerQueue.java @@ -33,6 +33,7 @@ public class ContainerQueue<E> extends ContainerCollection<E> implements IContai /** * @category READ */ + @Override public E element() { return getDelegate().element(); @@ -41,6 +42,7 @@ public class ContainerQueue<E> extends ContainerCollection<E> implements IContai /** * @category WRITE */ + @Override public boolean offer(E o) { boolean modified = getDelegate().offer(o); @@ -55,6 +57,7 @@ public class ContainerQueue<E> extends ContainerCollection<E> implements IContai /** * @category READ */ + @Override public E peek() { return getDelegate().element(); @@ -63,6 +66,7 @@ public class ContainerQueue<E> extends ContainerCollection<E> implements IContai /** * @category WRITE */ + @Override public E poll() { E removed = getDelegate().poll(); @@ -77,6 +81,7 @@ public class ContainerQueue<E> extends ContainerCollection<E> implements IContai /** * @category WRITE */ + @Override public E remove() { E removed = getDelegate().remove(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerSortedSet.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerSortedSet.java index 3853c5c46d..38a85dfbb6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerSortedSet.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/ContainerSortedSet.java @@ -34,6 +34,7 @@ public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainer /** * @category READ */ + @Override public Comparator<? super E> comparator() { return getDelegate().comparator(); @@ -42,6 +43,7 @@ public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainer /** * @category READ */ + @Override public E first() { return getDelegate().first(); @@ -50,6 +52,7 @@ public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainer /** * @category READ */ + @Override public E last() { return getDelegate().last(); @@ -58,6 +61,7 @@ public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainer /** * @category READ */ + @Override public SortedSet<E> headSet(E toElement) { return getDelegate().headSet(toElement); @@ -66,6 +70,7 @@ public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainer /** * @category READ */ + @Override public SortedSet<E> subSet(E fromElement, E toElement) { return getDelegate().subSet(fromElement, toElement); @@ -74,6 +79,7 @@ public class ContainerSortedSet<E> extends ContainerSet<E> implements IContainer /** * @category READ */ + @Override public SortedSet<E> tailSet(E fromElement) { return getDelegate().tailSet(fromElement); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java index 842f54a101..26ed9dfd19 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerBlockingQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,5 +21,6 @@ import java.util.concurrent.BlockingQueue; */ public interface IContainerBlockingQueue<E> extends IContainerQueue<E>, BlockingQueue<E> { + @Override public BlockingQueue<E> getDelegate(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerList.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerList.java index 05930cda4e..45f18f8c6a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerList.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,5 +21,6 @@ import java.util.List; */ public interface IContainerList<E> extends IContainerCollection<E>, List<E> { + @Override public List<E> getDelegate(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java index 4fe3bebf56..ebf0d52a26 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,5 +21,6 @@ import java.util.Queue; */ public interface IContainerQueue<E> extends IContainerCollection<E>, Queue<E> { + @Override public Queue<E> getDelegate(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java index 272def85b9..c46318d739 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,5 +23,6 @@ import java.util.Set; */ public interface IContainerSet<E> extends IContainerCollection<E>, Set<E> { + @Override public Set<E> getDelegate(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java index 6eb069df8c..6d3a493ca8 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/container/delegate/IContainerSortedSet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,5 +21,6 @@ import java.util.SortedSet; */ public interface IContainerSortedSet<E> extends IContainerSet<E>, SortedSet<E> { + @Override public SortedSet<E> getDelegate(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventPrinter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventPrinter.java index a0a52973ab..fc34db8195 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventPrinter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/EventPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,6 +32,7 @@ public class EventPrinter implements IListener this(IOUtil.OUT()); } + @Override public void notifyEvent(IEvent event) { stream.println(event); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ExecutorServiceNotifier.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ExecutorServiceNotifier.java index 4582fa4e38..d2e9ba4011 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ExecutorServiceNotifier.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ExecutorServiceNotifier.java @@ -32,6 +32,7 @@ public class ExecutorServiceNotifier extends Notifier implements IExecutorServic /** * @since 3.6 */ + @Override public ExecutorService getExecutorService() { return notificationExecutorService; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/FinishedEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/FinishedEvent.java index 5dfbe44ed4..839ccbf216 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/FinishedEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/FinishedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,6 +37,7 @@ public class FinishedEvent implements IEvent return result; } + @Override public INotifier getSource() { return null; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/Notifier.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/Notifier.java index 8f031ced8a..141a15bdb3 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/Notifier.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/Notifier.java @@ -52,23 +52,27 @@ public class Notifier implements INotifier { } + @Override public void addListener(IListener listener) { CheckUtil.checkArg(listener, "listener"); //$NON-NLS-1$ listeners.add(listener); } + @Override public void removeListener(IListener listener) { CheckUtil.checkArg(listener, "listener"); //$NON-NLS-1$ listeners.remove(listener); } + @Override public boolean hasListeners() { return !listeners.isEmpty(); } + @Override public IListener[] getListeners() { return listeners.get(); @@ -102,6 +106,7 @@ public class Notifier implements INotifier { notificationService.execute(new Runnable() { + @Override public void run() { fireEventSafe(event, listeners); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ThrowableEventAdapter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ThrowableEventAdapter.java index 9c1c88c321..af95447140 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ThrowableEventAdapter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/event/ThrowableEventAdapter.java @@ -25,6 +25,7 @@ public class ThrowableEventAdapter implements IListener { } + @Override public final void notifyEvent(IEvent event) { if (event instanceof ThrowableEvent) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/Factory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/Factory.java index fb22e662fb..1c6bd40129 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/Factory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/Factory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ public abstract class Factory implements IFactory this(new FactoryKey(productGroup, type)); } + @Override public FactoryKey getKey() { return key; @@ -46,6 +47,7 @@ public abstract class Factory implements IFactory return key.getType(); } + @Override public String getDescriptionFor(Object product) { return null; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryDescriptor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryDescriptor.java index 73f42c73d9..3434730a3d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryDescriptor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryDescriptor.java @@ -65,6 +65,7 @@ public class FactoryDescriptor extends Factory } } + @Override public Object create(String description) { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryKey.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryKey.java index 0504fce13c..bc380eafdc 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryKey.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/FactoryKey.java @@ -35,6 +35,7 @@ public final class FactoryKey implements IFactoryKey, Serializable, Comparable<F this.type = type; } + @Override public String getProductGroup() { return productGroup; @@ -45,6 +46,7 @@ public final class FactoryKey implements IFactoryKey, Serializable, Comparable<F this.productGroup = productGroup; } + @Override public String getType() { return type; @@ -84,6 +86,7 @@ public final class FactoryKey implements IFactoryKey, Serializable, Comparable<F return MessageFormat.format("{0}[{1}]", productGroup, type); //$NON-NLS-1$ } + @Override public int compareTo(FactoryKey key) { int result = StringUtil.compare(productGroup, key.productGroup); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java index 0fab366c6e..8c0852c84a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/factory/PropertiesFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,7 @@ public abstract class PropertiesFactory extends Factory super(productGroup, type); } + @Override public Object create(String description) throws ProductCreationException { Map<String, String> properties = new HashMap<String, String>(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/fsm/FiniteStateMachine.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/fsm/FiniteStateMachine.java index 86134a33b1..bd01eb4f59 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/fsm/FiniteStateMachine.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/fsm/FiniteStateMachine.java @@ -239,6 +239,7 @@ public abstract class FiniteStateMachine<STATE extends Enum<?>, EVENT extends En @Deprecated public static class IgnoreTransition implements ITransition<Enum<?>, Enum<?>, Object, Object> { + @Override public void execute(Object subject, Enum<?> state, Enum<?> event, Object data) { // Do nothing @@ -260,6 +261,7 @@ public abstract class FiniteStateMachine<STATE extends Enum<?>, EVENT extends En @Deprecated public static class FailTransition implements ITransition<Enum<?>, Enum<?>, Object, Object> { + @Override public void execute(Object subject, Enum<?> state, Enum<?> event, Object data) { // Do nothing @@ -279,6 +281,7 @@ public abstract class FiniteStateMachine<STATE extends Enum<?>, EVENT extends En */ private static class InternalIgnoreTransition implements ITransition<Enum<?>, Enum<?>, Object, Object> { + @Override public void execute(Object subject, Enum<?> state, Enum<?> event, Object data) { // Do nothing @@ -298,6 +301,7 @@ public abstract class FiniteStateMachine<STATE extends Enum<?>, EVENT extends En */ private static class InternalFailTransition implements ITransition<Enum<?>, Enum<?>, Object, Object> { + @Override public void execute(Object subject, Enum<?> state, Enum<?> event, Object data) { // Do nothing @@ -329,6 +333,7 @@ public abstract class FiniteStateMachine<STATE extends Enum<?>, EVENT extends En return targetState; } + @Override public void execute(SUBJECT subject, STATE state, EVENT event, Object data) { changeState(subject, targetState); @@ -359,6 +364,7 @@ public abstract class FiniteStateMachine<STATE extends Enum<?>, EVENT extends En this.newState = newState; } + @Override public INotifier getSource() { return FiniteStateMachine.this; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputExtender.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputExtender.java index d51eb442d4..e216ef80db 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputExtender.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputExtender.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2010-2013, 2015, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2010-2013, 2015, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,71 +28,85 @@ public class DataInputExtender implements ExtendedDataInput, Closeable this.input = input; } + @Override public boolean readBoolean() throws IOException { return input.readBoolean(); } + @Override public byte readByte() throws IOException { return input.readByte(); } + @Override public char readChar() throws IOException { return input.readChar(); } + @Override public double readDouble() throws IOException { return input.readDouble(); } + @Override public float readFloat() throws IOException { return input.readFloat(); } + @Override public void readFully(byte[] b, int off, int len) throws IOException { input.readFully(b, off, len); } + @Override public void readFully(byte[] b) throws IOException { input.readFully(b); } + @Override public int readInt() throws IOException { return input.readInt(); } + @Override public String readLine() throws IOException { return input.readLine(); } + @Override public long readLong() throws IOException { return input.readLong(); } + @Override public short readShort() throws IOException { return input.readShort(); } + @Override public int readUnsignedByte() throws IOException { return input.readUnsignedByte(); } + @Override public int readUnsignedShort() throws IOException { return input.readUnsignedShort(); } + @Override public String readUTF() throws IOException { return input.readUTF(); @@ -101,6 +115,7 @@ public class DataInputExtender implements ExtendedDataInput, Closeable /** * @since 3.7 */ + @Override public int readVarInt() throws IOException { return ExtendedIOUtil.readVarInt(input); @@ -109,31 +124,37 @@ public class DataInputExtender implements ExtendedDataInput, Closeable /** * @since 3.7 */ + @Override public long readVarLong() throws IOException { return ExtendedIOUtil.readVarLong(input); } + @Override public byte[] readByteArray() throws IOException { return ExtendedIOUtil.readByteArray(input); } + @Override public Object readObject() throws IOException { return ExtendedIOUtil.readObject(input); } + @Override public Object readObject(ClassLoader classLoader) throws IOException { return ExtendedIOUtil.readObject(input, classLoader); } + @Override public Object readObject(ClassResolver classResolver) throws IOException { return ExtendedIOUtil.readObject(input, classResolver); } + @Override public String readString() throws IOException { return ExtendedIOUtil.readString(input); @@ -142,6 +163,7 @@ public class DataInputExtender implements ExtendedDataInput, Closeable /** * @since 3.0 */ + @Override public <T extends Enum<?>> T readEnum(Class<T> type) throws IOException { return ExtendedIOUtil.readEnum(input, type); @@ -150,11 +172,13 @@ public class DataInputExtender implements ExtendedDataInput, Closeable /** * @since 3.4 */ + @Override public Throwable readException() throws IOException { return ExtendedIOUtil.readException(input); } + @Override public int skipBytes(int n) throws IOException { return input.skipBytes(n); @@ -163,6 +187,7 @@ public class DataInputExtender implements ExtendedDataInput, Closeable /** * @since 3.6 */ + @Override public void close() throws IOException { if (input instanceof Closeable) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputOutputFile.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputOutputFile.java index 4ffbc65d32..d5bf41e270 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputOutputFile.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataInputOutputFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -55,6 +55,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl buffer = new byte[bufferSize]; } + @Override public void close() throws IOException { if (raf != null) @@ -66,6 +67,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl } } + @Override public void flush() throws IOException { if (modified) @@ -124,6 +126,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return fileLength; } + @Override public int skipBytes(int n) throws IOException { seek(getFilePointer() + n); @@ -210,11 +213,13 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return array; } + @Override public void readFully(byte[] array) throws IOException { readFully(array, 0, array.length); } + @Override public void readFully(byte[] array, int offset, int length) throws IOException { int n = 0; @@ -230,6 +235,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl } } + @Override public boolean readBoolean() throws IOException { int ch = this.read(); @@ -241,6 +247,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return ch != 0; } + @Override public byte readByte() throws IOException { int ch = this.read(); @@ -252,6 +259,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return (byte)ch; } + @Override public int readUnsignedByte() throws IOException { int ch = this.read(); @@ -263,6 +271,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return ch; } + @Override public short readShort() throws IOException { int ch1 = this.read(); @@ -275,6 +284,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return (short)((ch1 << 8) + ch2); } + @Override public int readUnsignedShort() throws IOException { int ch1 = this.read(); @@ -287,6 +297,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return (ch1 << 8) + ch2; } + @Override public char readChar() throws IOException { int ch1 = this.read(); @@ -299,6 +310,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return (char)((ch1 << 8) + ch2); } + @Override public int readInt() throws IOException { int ch1 = this.read(); @@ -313,21 +325,25 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return (ch1 << 24) + (ch2 << 16) + (ch3 << 8) + ch4; } + @Override public long readLong() throws IOException { return ((long)readInt() << 32) + (readInt() & 0xFFFFFFFFL); } + @Override public float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } + @Override public double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); } + @Override public String readLine() throws IOException { StringBuffer input = new StringBuffer(); @@ -366,11 +382,13 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl return input.toString(); } + @Override public String readUTF() throws IOException { return DataInputStream.readUTF(this); } + @Override public void write(int byteValue) throws IOException { if (position < end) @@ -401,11 +419,13 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl } } + @Override public void write(byte[] array) throws IOException { write(array, 0, array.length); } + @Override public void write(byte[] array, int offset, int length) throws IOException { if (length < buffer.length) @@ -458,28 +478,33 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl } } + @Override public void writeBoolean(boolean value) throws IOException { write(value ? 1 : 0); } + @Override public void writeByte(int value) throws IOException { write(value); } + @Override public void writeShort(int value) throws IOException { write(value >>> 8 & 0xFF); write(value & 0xFF); } + @Override public void writeChar(int value) throws IOException { write(value >>> 8 & 0xFF); write(value & 0xFF); } + @Override public void writeInt(int value) throws IOException { write(value >>> 24 & 0xFF); @@ -488,6 +513,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl write(value & 0xFF); } + @Override public void writeLong(long value) throws IOException { write((int)(value >>> 56) & 0xFF); @@ -500,16 +526,19 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl write((int)value & 0xFF); } + @Override public void writeFloat(float value) throws IOException { writeInt(Float.floatToIntBits(value)); } + @Override public void writeDouble(double value) throws IOException { writeLong(Double.doubleToLongBits(value)); } + @Override public void writeBytes(String value) throws IOException { int length = value.length(); @@ -519,6 +548,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl } } + @Override public void writeChars(String value) throws IOException { int length = value.length(); @@ -530,6 +560,7 @@ public class DataInputOutputFile implements DataInput, DataOutput, Flushable, Cl } } + @Override public void writeUTF(String value) throws IOException { int length = value.length(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataOutputExtender.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataOutputExtender.java index 7c7119ef75..608535155f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataOutputExtender.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DataOutputExtender.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2010-2013, 2015, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2010-2013, 2015, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,71 +26,85 @@ public class DataOutputExtender implements ExtendedDataOutput, Closeable this.output = output; } + @Override public void write(byte[] b, int off, int len) throws IOException { output.write(b, off, len); } + @Override public void write(byte[] b) throws IOException { output.write(b); } + @Override public void write(int b) throws IOException { output.write(b); } + @Override public void writeBoolean(boolean v) throws IOException { output.writeBoolean(v); } + @Override public void writeByte(int v) throws IOException { output.writeByte(v); } + @Override public void writeBytes(String s) throws IOException { output.writeBytes(s); } + @Override public void writeChar(int v) throws IOException { output.writeChar(v); } + @Override public void writeChars(String s) throws IOException { output.writeChars(s); } + @Override public void writeDouble(double v) throws IOException { output.writeDouble(v); } + @Override public void writeFloat(float v) throws IOException { output.writeFloat(v); } + @Override public void writeInt(int v) throws IOException { output.writeInt(v); } + @Override public void writeLong(long v) throws IOException { output.writeLong(v); } + @Override public void writeShort(int v) throws IOException { output.writeShort(v); } + @Override public void writeUTF(String str) throws IOException { output.writeUTF(str); @@ -99,6 +113,7 @@ public class DataOutputExtender implements ExtendedDataOutput, Closeable /** * @since 3.7 */ + @Override public void writeVarInt(int v) throws IOException { ExtendedIOUtil.writeVarInt(output, v); @@ -107,21 +122,25 @@ public class DataOutputExtender implements ExtendedDataOutput, Closeable /** * @since 3.7 */ + @Override public void writeVarLong(long v) throws IOException { ExtendedIOUtil.writeVarLong(output, v); } + @Override public void writeByteArray(byte[] b) throws IOException { ExtendedIOUtil.writeByteArray(output, b); } + @Override public void writeObject(Object object) throws IOException { ExtendedIOUtil.writeObject(output, object); } + @Override public void writeString(String str) throws IOException { ExtendedIOUtil.writeString(output, str); @@ -130,6 +149,7 @@ public class DataOutputExtender implements ExtendedDataOutput, Closeable /** * @since 3.0 */ + @Override public void writeEnum(Enum<?> literal) throws IOException { ExtendedIOUtil.writeEnum(output, literal); @@ -138,6 +158,7 @@ public class DataOutputExtender implements ExtendedDataOutput, Closeable /** * @since 3.4 */ + @Override public void writeException(Throwable t) throws IOException { ExtendedIOUtil.writeException(output, t); @@ -146,6 +167,7 @@ public class DataOutputExtender implements ExtendedDataOutput, Closeable /** * @since 3.6 */ + @Override public void close() throws IOException { if (output instanceof Closeable) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DelegatingStreamWrapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DelegatingStreamWrapper.java index 3ace9e8294..66dc04e3d9 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DelegatingStreamWrapper.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/DelegatingStreamWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,22 +31,26 @@ public abstract class DelegatingStreamWrapper implements IStreamWrapper return delegate; } + @Override public InputStream wrapInputStream(InputStream in) throws IOException { return doWrapInputStream(delegate.wrapInputStream(in)); } + @Override public OutputStream wrapOutputStream(OutputStream out) throws IOException { return doWrapOutputStream(delegate.wrapOutputStream(out)); } + @Override public void finishInputStream(InputStream in) throws IOException { delegate.finishInputStream(in); doFinishInputStream(in); } + @Override public void finishOutputStream(OutputStream out) throws IOException { delegate.finishOutputStream(out); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInput.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInput.java index 1b24404f2f..8284a25188 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInput.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2013, 2015, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2013, 2015, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -73,81 +73,97 @@ public interface ExtendedDataInput extends DataInput return delegate; } + @Override public boolean readBoolean() throws IOException { return delegate.readBoolean(); } + @Override public byte readByte() throws IOException { return delegate.readByte(); } + @Override public byte[] readByteArray() throws IOException { return delegate.readByteArray(); } + @Override public char readChar() throws IOException { return delegate.readChar(); } + @Override public double readDouble() throws IOException { return delegate.readDouble(); } + @Override public float readFloat() throws IOException { return delegate.readFloat(); } + @Override public void readFully(byte[] b, int off, int len) throws IOException { delegate.readFully(b, off, len); } + @Override public void readFully(byte[] b) throws IOException { delegate.readFully(b); } + @Override public int readInt() throws IOException { return delegate.readInt(); } + @Override public String readLine() throws IOException { return delegate.readLine(); } + @Override public long readLong() throws IOException { return delegate.readLong(); } + @Override public Object readObject() throws IOException { return delegate.readObject(); } + @Override public Object readObject(ClassLoader classLoader) throws IOException { return delegate.readObject(classLoader); } + @Override public Object readObject(ClassResolver classResolver) throws IOException { return delegate.readObject(classResolver); } + @Override public short readShort() throws IOException { return delegate.readShort(); } + @Override public String readString() throws IOException { return delegate.readString(); @@ -156,6 +172,7 @@ public interface ExtendedDataInput extends DataInput /** * @since 3.0 */ + @Override public <T extends Enum<?>> T readEnum(Class<T> type) throws IOException { return delegate.readEnum(type); @@ -164,21 +181,25 @@ public interface ExtendedDataInput extends DataInput /** * @since 3.4 */ + @Override public Throwable readException() throws IOException { return delegate.readException(); } + @Override public int readUnsignedByte() throws IOException { return delegate.readUnsignedByte(); } + @Override public int readUnsignedShort() throws IOException { return delegate.readUnsignedShort(); } + @Override public String readUTF() throws IOException { return delegate.readUTF(); @@ -187,6 +208,7 @@ public interface ExtendedDataInput extends DataInput /** * @since 3.7 */ + @Override public int readVarInt() throws IOException { return delegate.readVarInt(); @@ -195,11 +217,13 @@ public interface ExtendedDataInput extends DataInput /** * @since 3.7 */ + @Override public long readVarLong() throws IOException { return delegate.readVarLong(); } + @Override public int skipBytes(int n) throws IOException { return delegate.skipBytes(n); @@ -208,6 +232,7 @@ public interface ExtendedDataInput extends DataInput /** * @since 3.6 */ + @Override public void close() throws IOException { if (delegate instanceof Closeable) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInputStream.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInputStream.java index bd2b332ce6..975913d0d5 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInputStream.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2010-2013, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2010-2013, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,6 +29,7 @@ public class ExtendedDataInputStream extends DataInputStream implements Extended /** * @since 3.7 */ + @Override public int readVarInt() throws IOException { return ExtendedIOUtil.readVarInt(this); @@ -37,21 +38,25 @@ public class ExtendedDataInputStream extends DataInputStream implements Extended /** * @since 3.7 */ + @Override public long readVarLong() throws IOException { return ExtendedIOUtil.readVarLong(this); } + @Override public byte[] readByteArray() throws IOException { return ExtendedIOUtil.readByteArray(this); } + @Override public String readString() throws IOException { return ExtendedIOUtil.readString(this); } + @Override public Object readObject() throws IOException { return ExtendedIOUtil.readObject(this); @@ -60,6 +65,7 @@ public class ExtendedDataInputStream extends DataInputStream implements Extended /** * @since 3.0 */ + @Override public <T extends Enum<?>> T readEnum(Class<T> type) throws IOException { return ExtendedIOUtil.readEnum(this, type); @@ -68,16 +74,19 @@ public class ExtendedDataInputStream extends DataInputStream implements Extended /** * @since 3.4 */ + @Override public Throwable readException() throws IOException { return ExtendedIOUtil.readException(this); } + @Override public Object readObject(ClassLoader classLoader) throws IOException { return ExtendedIOUtil.readObject(this, classLoader); } + @Override public Object readObject(ClassResolver classResolver) throws IOException { return ExtendedIOUtil.readObject(this, classResolver); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutput.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutput.java index ed7b0ba712..5ac1620664 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutput.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2013, 2015, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2013, 2015, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -66,81 +66,97 @@ public interface ExtendedDataOutput extends DataOutput return delegate; } + @Override public void write(byte[] b, int off, int len) throws IOException { delegate.write(b, off, len); } + @Override public void write(byte[] b) throws IOException { delegate.write(b); } + @Override public void write(int b) throws IOException { delegate.write(b); } + @Override public void writeBoolean(boolean v) throws IOException { delegate.writeBoolean(v); } + @Override public void writeByte(int v) throws IOException { delegate.writeByte(v); } + @Override public void writeByteArray(byte[] b) throws IOException { delegate.writeByteArray(b); } + @Override public void writeBytes(String s) throws IOException { delegate.writeBytes(s); } + @Override public void writeChar(int v) throws IOException { delegate.writeChar(v); } + @Override public void writeChars(String s) throws IOException { delegate.writeChars(s); } + @Override public void writeDouble(double v) throws IOException { delegate.writeDouble(v); } + @Override public void writeFloat(float v) throws IOException { delegate.writeFloat(v); } + @Override public void writeInt(int v) throws IOException { delegate.writeInt(v); } + @Override public void writeLong(long v) throws IOException { delegate.writeLong(v); } + @Override public void writeObject(Object object) throws IOException { delegate.writeObject(object); } + @Override public void writeShort(int v) throws IOException { delegate.writeShort(v); } + @Override public void writeString(String str) throws IOException { delegate.writeString(str); @@ -149,6 +165,7 @@ public interface ExtendedDataOutput extends DataOutput /** * @since 3.0 */ + @Override public void writeEnum(Enum<?> literal) throws IOException { delegate.writeEnum(literal); @@ -157,11 +174,13 @@ public interface ExtendedDataOutput extends DataOutput /** * @since 3.4 */ + @Override public void writeException(Throwable t) throws IOException { delegate.writeException(t); } + @Override public void writeUTF(String str) throws IOException { delegate.writeUTF(str); @@ -170,6 +189,7 @@ public interface ExtendedDataOutput extends DataOutput /** * @since 3.7 */ + @Override public void writeVarInt(int v) throws IOException { delegate.writeVarInt(v); @@ -178,6 +198,7 @@ public interface ExtendedDataOutput extends DataOutput /** * @since 3.7 */ + @Override public void writeVarLong(long v) throws IOException { delegate.writeVarLong(v); @@ -186,6 +207,7 @@ public interface ExtendedDataOutput extends DataOutput /** * @since 3.6 */ + @Override public void close() throws IOException { if (delegate instanceof Closeable) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutputStream.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutputStream.java index 53f588a336..a3b29f66fb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutputStream.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedDataOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2010-2013, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2010-2013, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,6 +27,7 @@ public class ExtendedDataOutputStream extends DataOutputStream implements Extend /** * @since 3.7 */ + @Override public void writeVarInt(int v) throws IOException { ExtendedIOUtil.writeVarInt(this, v); @@ -35,16 +36,19 @@ public class ExtendedDataOutputStream extends DataOutputStream implements Extend /** * @since 3.7 */ + @Override public void writeVarLong(long v) throws IOException { ExtendedIOUtil.writeVarLong(this, v); } + @Override public void writeByteArray(byte[] b) throws IOException { ExtendedIOUtil.writeByteArray(this, b); } + @Override public void writeString(String str) throws IOException { ExtendedIOUtil.writeString(this, str); @@ -53,6 +57,7 @@ public class ExtendedDataOutputStream extends DataOutputStream implements Extend /** * @since 3.0 */ + @Override public void writeEnum(Enum<?> literal) throws IOException { ExtendedIOUtil.writeEnum(this, literal); @@ -61,11 +66,13 @@ public class ExtendedDataOutputStream extends DataOutputStream implements Extend /** * @since 3.4 */ + @Override public void writeException(Throwable t) throws IOException { ExtendedIOUtil.writeException(this, t); } + @Override public void writeObject(Object object) throws IOException { ExtendedIOUtil.writeObject(this, object); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOAdapter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOAdapter.java index ab7840bd78..af39b5b52c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOAdapter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,10 +22,12 @@ public class ExtendedIOAdapter implements ExtendedIOHandler { } + @Override public void handleIn(ExtendedDataInputStream in) throws IOException { } + @Override public void handleOut(ExtendedDataOutputStream out) throws IOException { } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java index 650482d8a0..deab77c3ef 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ExtendedIOUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2013, 2015-2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2013, 2015-2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -569,6 +569,7 @@ public final class ExtendedIOUtil this.classLoader = classLoader; } + @Override public Class<?> resolveClass(ObjectStreamClass v) throws ClassNotFoundException { String className = v.getName(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/GZIPStreamWrapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/GZIPStreamWrapper.java index 85bb498f91..ce5633ad18 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/GZIPStreamWrapper.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/GZIPStreamWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011-2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011-2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,6 +53,7 @@ public class GZIPStreamWrapper implements IStreamWrapper this.compressionLevel = compressionLevel; } + @Override public GZIPInputStream wrapInputStream(InputStream in) throws IOException { if (in instanceof GZIPInputStream) @@ -63,6 +64,7 @@ public class GZIPStreamWrapper implements IStreamWrapper return new GZIPInputStream(in, bufferSize); } + @Override public GZIPOutputStream wrapOutputStream(OutputStream out) throws IOException { if (out instanceof GZIPOutputStream) @@ -78,10 +80,12 @@ public class GZIPStreamWrapper implements IStreamWrapper }; } + @Override public void finishInputStream(InputStream in) throws IOException { } + @Override public void finishOutputStream(OutputStream out) throws IOException { ((GZIPOutputStream)out).finish(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java index bab58b65fb..48e98e6d4e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IOUtil.java @@ -500,6 +500,7 @@ public final class IOUtil } } + @SafeVarargs public static void copyText(File source, File target, IOFilter<String>... lineFilters) throws IORuntimeException { BufferedReader reader = null; @@ -518,6 +519,7 @@ public final class IOUtil } } + @SafeVarargs public static void copyText(BufferedReader reader, BufferedWriter writer, IOFilter<String>... lineFilters) { try @@ -1119,6 +1121,7 @@ public final class IOUtil return files; } + @Override public boolean visit(File file) throws IOException { files.add(file); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IStreamWrapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IStreamWrapper.java index 34d85f3383..ba9b8d7413 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IStreamWrapper.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/IStreamWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -42,6 +42,7 @@ public interface IStreamWrapper super(PRODUCT_GROUP, type); } + @Override public abstract IStreamWrapper create(String description) throws ProductCreationException; } } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java index 4625ebb16d..9461c6903a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/SortedFileMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -52,6 +52,7 @@ public abstract class SortedFileMap<K extends Comparable<K>, V> implements Close } } + @Override public void close() throws IOException { IOUtil.close(randomAccessFile); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java index 52fb65c97c..515758932b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringCompressor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -77,6 +77,7 @@ public class StringCompressor implements StringIO return client; } + @Override public void write(ExtendedDataOutput out, String string) throws IOException { if (DEBUG) @@ -138,6 +139,7 @@ public class StringCompressor implements StringIO } } + @Override public String read(ExtendedDataInput in) throws IOException { if (DEBUG) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringIO.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringIO.java index 58d773da73..5200bd258f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringIO.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/StringIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,11 +20,13 @@ public interface StringIO { public static final StringIO DIRECT = new StringIO() { + @Override public void write(ExtendedDataOutput out, String string) throws IOException { out.writeString(string); } + @Override public String read(ExtendedDataInput in) throws IOException { return in.readString(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java index 6efcaae78e..bdb66ca7d3 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/XORStreamWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ public class XORStreamWrapper implements IStreamWrapper return key; } + @Override public XORInputStream wrapInputStream(InputStream in) throws IOException { if (in instanceof XORInputStream) @@ -41,6 +42,7 @@ public class XORStreamWrapper implements IStreamWrapper return new XORInputStream(in, key); } + @Override public XOROutputStream wrapOutputStream(OutputStream out) throws IOException { if (out instanceof XOROutputStream) @@ -51,10 +53,12 @@ public class XORStreamWrapper implements IStreamWrapper return new XOROutputStream(out, key); } + @Override public void finishInputStream(InputStream in) throws IOException { } + @Override public void finishOutputStream(OutputStream out) throws IOException { } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ZIPUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ZIPUtil.java index 9a38f0968c..6e6a964f52 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ZIPUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/io/ZIPUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011-2013 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011-2013, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -249,6 +249,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); @@ -341,6 +342,7 @@ public final class ZIPUtil } } + @Override public void handleEntry(EntryContext context) throws IOException { if (files.hasNext()) @@ -393,6 +395,7 @@ public final class ZIPUtil return targetFolder; } + @Override public void unzipDirectory(String name) { File directory = new File(targetFolder, name); @@ -402,6 +405,7 @@ public final class ZIPUtil } } + @Override public void unzipFile(String name, InputStream zipStream) { File targetFile = new File(targetFolder, name); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java index d824f605fc..4cfd001741 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycle.java @@ -27,6 +27,7 @@ public interface ILifecycle extends IDeactivateable, INotifier { public void activate() throws LifecycleException; + @Override public Exception deactivate(); /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java index 347c75a669..8e87d74bcc 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/ILifecycleEvent.java @@ -26,6 +26,7 @@ public interface ILifecycleEvent extends IEvent /** * @since 3.0 */ + @Override public ILifecycle getSource(); public Kind getKind(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java index b70a4c54a4..d6fac6347f 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/Lifecycle.java @@ -156,11 +156,13 @@ public class Lifecycle extends Notifier implements ILifecycle, DeferrableActivat } } + @Override public final void activate() throws LifecycleException { internalActivate(); } + @Override public final Exception deactivate() { return internalDeactivate(); @@ -169,11 +171,13 @@ public class Lifecycle extends Notifier implements ILifecycle, DeferrableActivat /** * @since 3.0 */ + @Override public final LifecycleState getLifecycleState() { return lifecycleState; } + @Override public final boolean isActive() { return lifecycleState == LifecycleState.ACTIVE; @@ -270,6 +274,7 @@ public class Lifecycle extends Notifier implements ILifecycle, DeferrableActivat /** * @since 3.2 */ + @Override public boolean isDeferredActivation() { return false; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEvent.java index 279450b995..bdc5be4727 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEvent.java @@ -47,6 +47,7 @@ public class LifecycleEvent extends Event implements ILifecycleEvent return (ILifecycle)super.getSource(); } + @Override public Kind getKind() { return kind; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEventAdapter.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEventAdapter.java index 7c198cff82..07e318dd71 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEventAdapter.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleEventAdapter.java @@ -25,6 +25,7 @@ public class LifecycleEventAdapter implements IListener { } + @Override public final void notifyEvent(IEvent event) { if (event instanceof ILifecycleEvent) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java index c3b5914b7f..fa71a4fe30 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/lifecycle/LifecycleUtil.java @@ -185,6 +185,7 @@ public final class LifecycleUtil final CountDownLatch latch = new CountDownLatch(1); IListener adapter = new IListener() { + @Override public void notifyEvent(IEvent event) { if (event instanceof ILifecycleEvent) @@ -394,6 +395,7 @@ public final class LifecycleUtil this.delegate = delegate; } + @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java index 5fda7c7281..201bf1ee1c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiActivator.java @@ -50,6 +50,7 @@ public abstract class OSGiActivator implements BundleActivator return omBundle; } + @Override public final void start(BundleContext context) throws Exception { bundleContext = context; @@ -77,6 +78,7 @@ public abstract class OSGiActivator implements BundleActivator } } + @Override public final void stop(BundleContext context) throws Exception { OSGiActivator.traceStop(context); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiApplication.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiApplication.java index 5586135825..8323dd6913 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiApplication.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/OSGiApplication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,6 +53,7 @@ public class OSGiApplication implements IApplication return stopLatch != null; } + @Override public final Object start(IApplicationContext context) throws Exception { this.context = context; @@ -84,6 +85,7 @@ public class OSGiApplication implements IApplication return EXIT_OK; } + @Override public final void stop() { traceStop(applicationID); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/AbstractLogHandler.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/AbstractLogHandler.java index 2237e37d7c..c560fb3b70 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/AbstractLogHandler.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/AbstractLogHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -43,6 +43,7 @@ public abstract class AbstractLogHandler implements OMLogHandler this.logLevel = logLevel; } + @Override public void logged(OMLogger logger, Level level, String msg, Throwable t) { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java index 339598a068..9a105f5d81 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/EclipseLoggingBridge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,6 +34,7 @@ public class EclipseLoggingBridge implements OMLogHandler { } + @Override public void logged(OMLogger logger, Level level, String msg, Throwable t) { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/Logger.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/Logger.java index dcfa59b34e..8eadd0d12c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/Logger.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/Logger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,61 +27,73 @@ public class Logger implements OMLogger this.bundle = bundle; } + @Override public OMBundle getBundle() { return bundle; } + @Override public void log(Level level, String msg, Throwable t) { ((AbstractPlatform)bundle.getPlatform()).log(this, level, msg, t); } + @Override public void error(String msg, Throwable t) { log(Level.ERROR, msg, t); } + @Override public void warn(String msg, Throwable t) { log(Level.WARN, msg, t); } + @Override public void info(String msg, Throwable t) { log(Level.INFO, msg, t); } + @Override public void debug(String msg, Throwable t) { log(Level.DEBUG, msg, t); } + @Override public void log(Level level, String msg) { log(level, msg, null); } + @Override public void error(String msg) { log(Level.ERROR, msg); } + @Override public void warn(String msg) { log(Level.WARN, msg); } + @Override public void info(String msg) { log(Level.INFO, msg); } + @Override public void debug(String msg) { log(Level.DEBUG, msg); } + @Override public void log(Level level, Throwable t) { if (t != null) @@ -96,21 +108,25 @@ public class Logger implements OMLogger } } + @Override public void error(Throwable t) { log(Level.ERROR, t); } + @Override public void warn(Throwable t) { log(Level.WARN, t); } + @Override public void info(Throwable t) { log(Level.INFO, t); } + @Override public void debug(Throwable t) { log(Level.DEBUG, t); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLogHandler.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLogHandler.java index ff3f804c27..9d501be68d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLogHandler.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLogHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,6 +35,7 @@ public class OSGiLogHandler implements OMLogHandler { } + @Override public void logged(OMLogger logger, Level level, String msg, Throwable t) { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java index 435a8c5e5c..5590253394 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/OSGiLoggingBridge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2010-2012, 2017 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2008, 2010-2012, 2017, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,6 +33,7 @@ public class OSGiLoggingBridge implements OMLogHandler { } + @Override public void logged(OMLogger logger, Level level, String msg, Throwable t) { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java index 94a5f84241..c151fce457 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/log/RollingLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2018, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -111,6 +111,7 @@ public class RollingLog extends Worker implements Log, Iterable<LogLine> this.writeBulk = writeBulk; } + @Override public final void log(String message) { LogLine logLine = createLogLine(message); @@ -441,6 +442,7 @@ public class RollingLog extends Worker implements Log, Iterable<LogLine> return "RollingLog[" + logFile + "]"; } + @Override public final CloseableIterator<LogLine> iterator() { return iterator(logFile); @@ -532,6 +534,7 @@ public class RollingLog extends Worker implements Log, Iterable<LogLine> } } + @Override public void close() { IOUtil.close(reader); @@ -539,6 +542,7 @@ public class RollingLog extends Worker implements Log, Iterable<LogLine> fileNumber = CLOSED; } + @Override public boolean isClosed() { return fileNumber == CLOSED; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/AbstractMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/AbstractMonitor.java index 801ddb11cd..ef4001fdd8 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/AbstractMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/AbstractMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009-2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,12 +35,14 @@ public abstract class AbstractMonitor implements OMMonitor { } + @Override public boolean hasBegun() throws MonitorCanceledException { checkCanceled(); return totalWork != NOT_BEGUN; } + @Override public OMMonitor begin(double totalWork) throws MonitorCanceledException { checkCanceled(); @@ -48,33 +50,39 @@ public abstract class AbstractMonitor implements OMMonitor return this; } + @Override public OMMonitor begin() throws MonitorCanceledException { return begin(ONE); } + @Override public void worked(double work) throws MonitorCanceledException { checkBegun(); this.work += work; } + @Override public void worked() throws MonitorCanceledException { worked(ONE); } + @Override public OMMonitor fork(double work) { checkBegun(); return createNestedMonitor(work); } + @Override public OMMonitor fork() { return fork(ONE); } + @Override public Async forkAsync(double work) { checkBegun(); @@ -89,11 +97,13 @@ public abstract class AbstractMonitor implements OMMonitor return asyncTimerTask; } + @Override public Async forkAsync() { return forkAsync(ONE); } + @Override public void done() { if (!isCanceled()) @@ -106,16 +116,19 @@ public abstract class AbstractMonitor implements OMMonitor } } + @Override public double getTotalWork() { return totalWork; } + @Override public double getWork() { return work; } + @Override public double getWorkPercent() { return percent(work, totalWork); @@ -188,6 +201,7 @@ public abstract class AbstractMonitor implements OMMonitor } } + @Override public void stop() { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/DelegatingMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/DelegatingMonitor.java index 8f5059f67b..cbc85f157a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/DelegatingMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/DelegatingMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,76 +28,91 @@ public class DelegatingMonitor implements OMMonitor return delegate; } + @Override public boolean hasBegun() throws MonitorCanceledException { return delegate.hasBegun(); } + @Override public OMMonitor begin() throws MonitorCanceledException { return delegate.begin(); } + @Override public OMMonitor begin(double totalWork) throws MonitorCanceledException { return delegate.begin(totalWork); } + @Override public void checkCanceled() throws MonitorCanceledException { delegate.checkCanceled(); } + @Override public void done() { delegate.done(); } + @Override public OMMonitor fork() { return delegate.fork(); } + @Override public OMMonitor fork(double work) { return delegate.fork(work); } + @Override public Async forkAsync() { return delegate.forkAsync(); } + @Override public Async forkAsync(double work) { return delegate.forkAsync(work); } + @Override public double getTotalWork() { return delegate.getTotalWork(); } + @Override public double getWork() { return delegate.getWork(); } + @Override public double getWorkPercent() { return delegate.getWorkPercent(); } + @Override public boolean isCanceled() { return delegate.isCanceled(); } + @Override public void worked() throws MonitorCanceledException { delegate.worked(); } + @Override public void worked(double work) throws MonitorCanceledException { delegate.worked(work); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/Monitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/Monitor.java index b305294979..fe764da39a 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/Monitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/Monitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,11 +44,13 @@ public class Monitor extends AbstractMonitor canceled = true; } + @Override public boolean isCanceled() { return canceled; } + @Override public void checkCanceled() throws MonitorCanceledException { if (cancelException != null) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NestedMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NestedMonitor.java index 11c6270728..cbf4f8647d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NestedMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NestedMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -45,11 +45,13 @@ public class NestedMonitor extends AbstractMonitor return parentWork; } + @Override public boolean isCanceled() { return parent.isCanceled(); } + @Override public void checkCanceled() throws MonitorCanceledException { parent.checkCanceled(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NotifyingMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NotifyingMonitor.java index 15c825f718..f10d33af60 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NotifyingMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/NotifyingMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,21 +51,25 @@ public class NotifyingMonitor extends Monitor implements INotifier return task; } + @Override public boolean hasListeners() { return notifier.hasListeners(); } + @Override public IListener[] getListeners() { return notifier.getListeners(); } + @Override public void addListener(IListener listener) { notifier.addListener(listener); } + @Override public void removeListener(IListener listener) { notifier.removeListener(listener); @@ -116,16 +120,19 @@ public class NotifyingMonitor extends Monitor implements INotifier return null; } + @Override public double getTotalWork() { return totalWork; } + @Override public double getWork() { return work; } + @Override public double getWorkPercent() { return percent(work, totalWork); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java index 4dda538176..993984cadd 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProbingSubMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014-2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -680,6 +680,7 @@ public final class ProbingSubMonitor extends org.eclipse.net4j.util.om.monitor.S public abstract void footer(Table table, int rows); + @Override public int compareTo(Row o) { int result = location.getFileName().compareTo(o.location.getFileName()); @@ -771,6 +772,7 @@ public final class ProbingSubMonitor extends org.eclipse.net4j.util.om.monitor.S 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.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributable.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributable.java index 72118161c5..1b6520f7ba 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributable.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,11 +41,13 @@ public interface ProgressDistributable<CONTEXT> this.loopWork = loopWork; } + @Override public int getLoopCount(CONTEXT context) { return loopCount; } + @Override public double getLoopWork(CONTEXT context) { return loopWork; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributor.java index 56ce8cf1cc..76d174b9cb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/ProgressDistributor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -121,6 +121,7 @@ public abstract class ProgressDistributor protected abstract void distribute(double[] distribution, double[] times); + @SafeVarargs public static <CONTEXT> ProgressDistributable<CONTEXT>[] array(ProgressDistributable<CONTEXT>... ops) { return ops; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/SubMonitor.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/SubMonitor.java index 24bc5b2f28..174a1de719 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/SubMonitor.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/monitor/SubMonitor.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2014-2016 Eike Stepper (Loehne, Germany) and others. - * Copyright (c) 2014-2016 IBM Corporation and others. + * Copyright (c) 2014-2016, 2019 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2014-2016, 2019 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -549,6 +549,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking * (non-Javadoc) * @see org.eclipse.core.runtime.IProgressMonitor#isCanceled() */ + @Override public final boolean isCanceled() { return root.isCanceled(); @@ -558,6 +559,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(); @@ -582,6 +584,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) @@ -596,6 +599,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(); @@ -615,6 +619,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking * (non-Javadoc) * @see org.eclipse.core.runtime.IProgressMonitor#internalWorked(double) */ + @Override public final void internalWorked(double work) { checkCancelation(); @@ -631,6 +636,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(); @@ -654,6 +660,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); @@ -680,6 +687,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); @@ -877,6 +885,7 @@ public class SubMonitor implements IProgressMonitorWithBlocking * (non-Javadoc) * @see org.eclipse.core.runtime.IProgressMonitorWithBlocking#clearBlocked() */ + @Override public final void clearBlocked() { checkCancelation(); @@ -887,6 +896,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.net4j.util/src/org/eclipse/net4j/util/om/pref/OMPreferencesChangeEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/OMPreferencesChangeEvent.java index 99f1aa8a90..e01b192ef6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/OMPreferencesChangeEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/pref/OMPreferencesChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,6 +25,7 @@ public interface OMPreferencesChangeEvent<T> extends IEvent /** * @since 3.0 */ + @Override public OMPreferences getSource(); public OMPreference<T> getPreference(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java index 5791d04a7f..72424c3df9 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/PrintTraceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011, 2012, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011, 2012, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -85,6 +85,7 @@ public class PrintTraceHandler implements OMTraceHandler this.shortContext = shortContext; } + @Override public void traced(OMTraceHandlerEvent event) { String line = pattern == null ? format(shortContext, event) : format(pattern, event); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceHandler.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceHandler.java index 300f315d8d..ee34be73ff 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceHandler.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -78,6 +78,7 @@ public class RemoteTraceHandler implements OMTraceHandler } } + @Override public void traced(OMTraceHandlerEvent event) { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java index 365f388cf4..024f66a81c 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/RemoteTraceServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -414,6 +414,7 @@ public class RemoteTraceServer return stream; } + @Override public void notifyRemoteTrace(Event event) { stream.println("[TRACE] " + event.getAgentID()); //$NON-NLS-1$ diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/TraceHandlerEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/TraceHandlerEvent.java index 572d103389..bc4e21b1d4 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/TraceHandlerEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/TraceHandlerEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,26 +51,31 @@ public class TraceHandlerEvent implements OMTraceHandlerEvent, Serializable this.throwable = throwable; } + @Override public long getTimeStamp() { return timeStamp; } + @Override public OMTracer getTracer() { return tracer; } + @Override public Class<?> getContext() { return context; } + @Override public String getMessage() { return message; } + @Override public Throwable getThrowable() { return throwable; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/Tracer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/Tracer.java index 1d3f9c9ef4..710c4c648e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/Tracer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/om/trace/Tracer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2012, 2014-2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2010-2012, 2014-2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -59,26 +59,31 @@ public class Tracer implements OMTracer fullName = parent.getFullName() + "." + name; //$NON-NLS-1$ } + @Override public OMBundle getBundle() { return bundle; } + @Override public OMTracer getParent() { return parent; } + @Override public String getName() { return name; } + @Override public String getFullName() { return fullName; } + @Override public boolean isEnabled() { if (IS_GLOBALLY_DISABLED) @@ -90,17 +95,20 @@ public class Tracer implements OMTracer return debugSupport.isDebugging() && debugSupport.getDebugOption(fullName, false); } + @Override public void setEnabled(boolean enabled) { DebugSupport debugSupport = bundle.getDebugSupport(); debugSupport.setDebugOption(fullName, enabled); } + @Override public void trace(OMTraceHandlerEvent event) { ((AbstractPlatform)bundle.getPlatform()).trace(event); } + @Override public OMTraceHandlerEvent trace(Class<?> context, String msg, Throwable t) { OMTraceHandlerEvent event = new TraceHandlerEvent(this, context, msg, t); @@ -108,27 +116,32 @@ public class Tracer implements OMTracer return event; } + @Override public OMTraceHandlerEvent format(Class<?> context, String pattern, Throwable t, Object... args) { String msg = MessageFormat.format(pattern, args); return trace(context, msg, t); } + @Override public OMTraceHandlerEvent format(Class<?> context, String pattern, Object... args) { return format(context, pattern, (Throwable)null, args); } + @Override public OMTraceHandlerEvent trace(Class<?> context, String msg) { return trace(context, msg, (Throwable)null); } + @Override public OMTraceHandlerEvent trace(Class<?> context, Throwable t) { return trace(context, (String)null, t); } + @Override public OMTracer tracer(String name) { return new Tracer(this, name); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/IOptionsEvent.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/IOptionsEvent.java index 36bbeac298..e84b641745 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/IOptionsEvent.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/options/IOptionsEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,5 +21,6 @@ import org.eclipse.net4j.util.event.IEvent; */ public interface IOptionsEvent extends IEvent { + @Override public IOptions getSource(); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/DefaultPropertyTester.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/DefaultPropertyTester.java index 1bfe9771f2..729f0c42ff 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/DefaultPropertyTester.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/DefaultPropertyTester.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,26 +37,31 @@ public class DefaultPropertyTester<RECEIVER> extends PropertyTester implements I return namespace; } + @Override public Class<RECEIVER> getReceiverType() { return properties.getReceiverType(); } + @Override public Property<RECEIVER> getProperty(String name) { return properties.getProperty(name); } + @Override public List<Property<RECEIVER>> getProperties() { return properties.getProperties(); } + @Override public void add(Property<RECEIVER> property) { properties.add(property); } + @Override public boolean test(Object receiver, String propertyName, Object[] args, Object expectedValue) { Property<RECEIVER> property = getProperty(propertyName); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java index 9c0d7d0b6b..8c0d3a81cb 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/properties/Properties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,11 +32,13 @@ public class Properties<RECEIVER> implements IProperties<RECEIVER> this.receiverType = receiverType; } + @Override public final Class<RECEIVER> getReceiverType() { return receiverType; } + @Override public final void add(Property<RECEIVER> property) { CheckUtil.checkArg(property, "property"); @@ -44,11 +46,13 @@ public class Properties<RECEIVER> implements IProperties<RECEIVER> properties.add(property); } + @Override public final List<Property<RECEIVER>> getProperties() { return properties; } + @Override public final Property<RECEIVER> getProperty(String name) { for (Property<RECEIVER> property : properties) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedPhantomReference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedPhantomReference.java index 3575a82e6e..6511a6041e 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedPhantomReference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedPhantomReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,11 +27,13 @@ public class KeyedPhantomReference<K, T> extends PhantomReference<T> implements this.key = key; } + @Override public ReferenceType getType() { return ReferenceType.PHANTOM; } + @Override public K getKey() { return key; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedSoftReference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedSoftReference.java index 0b052fe00e..cf91aaf187 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedSoftReference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedSoftReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,11 +33,13 @@ public class KeyedSoftReference<K, T> extends SoftReference<T> implements KeyedR this.key = key; } + @Override public ReferenceType getType() { return ReferenceType.SOFT; } + @Override public K getKey() { return key; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedStrongReference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedStrongReference.java index 0681224ffd..9505f3dee6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedStrongReference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedStrongReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,31 +27,37 @@ public class KeyedStrongReference<K, T> implements KeyedReference<K, T> this.ref = ref; } + @Override public ReferenceType getType() { return ReferenceType.STRONG; } + @Override public K getKey() { return key; } + @Override public T get() { return ref; } + @Override public void clear() { ref = null; } + @Override public boolean isEnqueued() { return false; } + @Override public boolean enqueue() { return false; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedWeakReference.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedWeakReference.java index 663637b6a7..005445c0d4 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedWeakReference.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/KeyedWeakReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,11 +33,13 @@ public class KeyedWeakReference<K, T> extends WeakReference<T> implements KeyedR this.key = key; } + @Override public ReferenceType getType() { return ReferenceType.WEAK; } + @Override public K getKey() { return key; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java index c212986de9..6baffc0cf2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007-2009, 2011-2013, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007-2009, 2011-2013, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -38,6 +38,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i super(map); } + @Override public V putIfAbsent(K key, V value) { try @@ -52,6 +53,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i } } + @Override public V replace(K key, V value) { try @@ -66,6 +68,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i } } + @Override public boolean replace(K key, V oldValue, V newValue) { try @@ -81,6 +84,7 @@ public abstract class ReferenceValueMap<K, V> extends ReferenceValueMap2<K, V> i } } + @Override public boolean remove(Object key, Object value) { // TODO Consider a dummy KeyedReference class for value diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java index 8c426f2d5b..ca350dde8b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/ref/ReferenceValueMap2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -411,6 +411,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> { } + @Override public boolean hasNext() { if (nextEntry != null) @@ -433,6 +434,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> return false; } + @Override public Entry<K, V> next() { if (nextEntry == null) @@ -453,6 +455,7 @@ public abstract class ReferenceValueMap2<K, V> extends AbstractMap<K, V> } } + @Override public void remove() { if (lastKey == null) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java index 2a0a6965e7..d396a4a1ed 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/Registry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -46,36 +46,43 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen return keySet().isEmpty(); } + @Override public int size() { return keySet().size(); } + @Override public Set<Entry<K, V>> entrySet() { return getMap().entrySet(); } + @Override public Set<K> keySet() { return getMap().keySet(); } + @Override public Collection<V> values() { return getMap().values(); } + @Override public boolean containsKey(Object key) { return keySet().contains(key); } + @Override public boolean containsValue(Object value) { return values().contains(value); } + @Override public V get(Object key) { return getMap().get(key); @@ -84,6 +91,7 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen /** * Requires {@link #commit()} to be called later if not {@link #isAutoCommit()}. */ + @Override public synchronized V put(K key, V value) { V result = register(key, value); @@ -94,6 +102,7 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen /** * Requires {@link #commit()} to be called later if not {@link #isAutoCommit()}. */ + @Override public synchronized void putAll(Map<? extends K, ? extends V> t) { if (!t.isEmpty()) @@ -112,6 +121,7 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen /** * Requires {@link #commit()} to be called later if not {@link #isAutoCommit()}. */ + @Override public synchronized V remove(Object key) { V result = deregister(key); @@ -122,6 +132,7 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen /** * Requires {@link #commit()} to be called later if not {@link #isAutoCommit()}. */ + @Override public synchronized void clear() { if (!isEmpty()) @@ -135,22 +146,26 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen } } + @Override @SuppressWarnings("unchecked") public Entry<K, V>[] getElements() { return entrySet().toArray(new Entry[size()]); } + @Override public boolean isAutoCommit() { return autoCommit; } + @Override public void setAutoCommit(boolean autoCommit) { this.autoCommit = autoCommit; } + @Override public synchronized void commit(boolean notifications) { if (transaction != null) @@ -166,6 +181,7 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen } } + @Override public void commit() { commit(true); @@ -310,16 +326,19 @@ public abstract class Registry<K, V> extends Container<Map.Entry<K, V>> implemen this.value = value; } + @Override public K getKey() { return key; } + @Override public V getValue() { return value; } + @Override public V setValue(V value) { throw new UnsupportedOperationException(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/UnmodifiableRegistry.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/UnmodifiableRegistry.java index 4a7d65dfa7..703237710d 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/UnmodifiableRegistry.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/registry/UnmodifiableRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,11 +25,13 @@ public class UnmodifiableRegistry<K, V> implements IRegistry<K, V> this.delegate = delegate; } + @Override public void addListener(IListener listener) { delegate.addListener(listener); } + @Override public void removeListener(IListener listener) { delegate.removeListener(listener); @@ -38,6 +40,7 @@ public class UnmodifiableRegistry<K, V> implements IRegistry<K, V> /** * @since 3.0 */ + @Override public IListener[] getListeners() { return delegate.getListeners(); @@ -46,91 +49,109 @@ public class UnmodifiableRegistry<K, V> implements IRegistry<K, V> /** * @since 3.0 */ + @Override public boolean hasListeners() { return delegate.hasListeners(); } + @Override public V put(K key, V value) { throw new UnsupportedOperationException(); } + @Override public void putAll(Map<? extends K, ? extends V> t) { throw new UnsupportedOperationException(); } + @Override public V remove(Object key) { throw new UnsupportedOperationException(); } + @Override public void clear() { throw new UnsupportedOperationException(); } + @Override public void commit() { throw new UnsupportedOperationException(); } + @Override public void commit(boolean notifications) { throw new UnsupportedOperationException(); } + @Override public void setAutoCommit(boolean on) { throw new UnsupportedOperationException(); } + @Override public boolean isAutoCommit() { return delegate.isAutoCommit(); } + @Override public boolean isEmpty() { return delegate.isEmpty(); } + @Override public int size() { return delegate.size(); } + @Override public Entry<K, V>[] getElements() { return delegate.getElements(); } + @Override public V get(Object key) { return delegate.get(key); } + @Override public boolean containsKey(Object key) { return delegate.containsKey(key); } + @Override public boolean containsValue(Object value) { return delegate.containsValue(value); } + @Override public Set<Entry<K, V>> entrySet() { return delegate.entrySet(); } + @Override public Set<K> keySet() { return delegate.keySet(); } + @Override public Collection<V> values() { return delegate.values(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorConfigurer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorConfigurer.java index 6f3d74f46b..8227d2f53b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorConfigurer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ public class ChallengeNegotiatorConfigurer implements IElementProcessor { } + @Override public Object process(IManagedContainer container, String productGroup, String factoryType, String description, Object element) { if (element instanceof ChallengeNegotiator) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorFactory.java index a789fdc8d8..1f760656f7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeNegotiatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ public class ChallengeNegotiatorFactory extends NegotiatorFactory super(TYPE); } + @Override public ChallengeNegotiator create(String description) { return new ChallengeNegotiator(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeResponseNegotiator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeResponseNegotiator.java index 0dbed36347..79dae798c7 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeResponseNegotiator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ChallengeResponseNegotiator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -189,6 +189,7 @@ public abstract class ChallengeResponseNegotiator extends Negotiator<IChallengeR */ protected abstract class Transition implements ITransition<State, Event, INegotiationContext, ByteBuffer> { + @Override public final void execute(INegotiationContext context, State state, Event event, ByteBuffer buffer) { execute(context, buffer); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Credentials.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Credentials.java index 6d9a994af2..469b6d700b 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Credentials.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Credentials.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ public class Credentials implements ICredentials this.userID = userID; } + @Override public String getUserID() { return userID; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/CredentialsProviderFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/CredentialsProviderFactory.java index e652e80219..8397063482 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/CredentialsProviderFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/CredentialsProviderFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2010-2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,5 +26,6 @@ public abstract class CredentialsProviderFactory extends Factory super(PRODUCT_GROUP, type); } + @Override public abstract ICredentialsProvider create(String description) throws ProductCreationException; } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileAuthenticatorFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileAuthenticatorFactory.java index 61472f0653..69a07514a6 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileAuthenticatorFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileAuthenticatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,6 +25,7 @@ public class FileAuthenticatorFactory extends AuthenticatorFactory super(TYPE); } + @Override public FileUserManager create(String description) { FileUserManager userManager = new FileUserManager(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileUserManagerFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileUserManagerFactory.java index 946b9ca8d9..b5f3f869a8 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileUserManagerFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/FileUserManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,6 +24,7 @@ public class FileUserManagerFactory extends UserManagerFactory super(TYPE); } + @Override public FileUserManager create(String description) { FileUserManager userManager = new FileUserManager(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider.java index 3a3c9ad6dd..ff934f9dfe 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011-2013, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2007, 2011-2013, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,6 +16,7 @@ package org.eclipse.net4j.util.security; */ public interface IPasswordCredentialsProvider extends ICredentialsProvider { + @Override public IPasswordCredentials getCredentials(); /** diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider2.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider2.java index 52b7e4a557..92491bbf40 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider2.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/IPasswordCredentialsProvider2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,5 +16,6 @@ package org.eclipse.net4j.util.security; */ public interface IPasswordCredentialsProvider2 extends IPasswordCredentialsProvider, ICredentialsProvider2 { + @Override public IPasswordCredentials getCredentials(String realm); } diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/NegotiationContext.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/NegotiationContext.java index a3f558e4ca..5ec2b7a9e1 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/NegotiationContext.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/NegotiationContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,36 +32,43 @@ public abstract class NegotiationContext implements INegotiationContext { } + @Override public Receiver getReceiver() { return receiver; } + @Override public void setReceiver(Receiver receiver) { this.receiver = receiver; } + @Override public Enum<?> getState() { return state; } + @Override public void setState(Enum<?> state) { this.state = state; } + @Override public Object getInfo() { return info; } + @Override public void setInfo(Object info) { this.info = info; } + @Override public void setFinished(boolean success) { if (finishedLatch != null) @@ -70,6 +77,7 @@ public abstract class NegotiationContext implements INegotiationContext } } + @Override public Enum<?> waitUntilFinished(long timeout) { if (finishedLatch == null) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Negotiator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Negotiator.java index 27f42a631e..20c4fc8dae 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Negotiator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Negotiator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -94,11 +94,13 @@ public abstract class Negotiator<STATE extends Enum<?>, EVENT extends Enum<?>> e return startEvent; } + @Override public boolean isInitiator() { return initiator; } + @Override public void negotiate(INegotiationContext context) { context.setReceiver(this); @@ -110,6 +112,7 @@ public abstract class Negotiator<STATE extends Enum<?>, EVENT extends Enum<?>> e } } + @Override public void receiveBuffer(INegotiationContext context, ByteBuffer buffer) { process(context, bufferEvent, buffer); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentials.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentials.java index 191b5b1072..1ec40891e0 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentials.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentials.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011-2013, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011-2013, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -39,6 +39,7 @@ public class PasswordCredentials extends Credentials implements IPasswordCredent super(userID); } + @Override public char[] getPassword() { return password; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsProvider.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsProvider.java index eee052a276..adda2478f8 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsProvider.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010-2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2010-2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -45,11 +45,13 @@ public class PasswordCredentialsProvider implements IPasswordCredentialsProvider this(userID, password == null ? null : password.toCharArray()); } + @Override public boolean isInteractive() { return false; } + @Override public IPasswordCredentials getCredentials() { return credentials; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsUpdate.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsUpdate.java index 793fcaaa5e..e01791ac03 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsUpdate.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/PasswordCredentialsUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2013, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,6 +36,7 @@ public class PasswordCredentialsUpdate extends PasswordCredentials implements IP super(userID); } + @Override public char[] getNewPassword() { return newPassword; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Randomizer.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Randomizer.java index 21c3300895..c0651a84c4 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Randomizer.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/Randomizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -72,48 +72,56 @@ public class Randomizer extends Lifecycle implements IRandomizer setSeed(String.valueOf(seed).getBytes()); } + @Override public synchronized boolean nextBoolean() { checkActive(); return secureRandom.nextBoolean(); } + @Override public synchronized double nextDouble() { checkActive(); return secureRandom.nextDouble(); } + @Override public synchronized float nextFloat() { checkActive(); return secureRandom.nextFloat(); } + @Override public synchronized double nextGaussian() { checkActive(); return secureRandom.nextGaussian(); } + @Override public synchronized int nextInt() { checkActive(); return secureRandom.nextInt(); } + @Override public synchronized int nextInt(int n) { checkActive(); return secureRandom.nextInt(n); } + @Override public synchronized long nextLong() { checkActive(); return secureRandom.nextLong(); } + @Override public synchronized byte[] generateSeed(int numBytes) { checkActive(); @@ -126,12 +134,14 @@ public class Randomizer extends Lifecycle implements IRandomizer return secureRandom.getAlgorithm(); } + @Override public synchronized void nextBytes(byte[] bytes) { checkActive(); secureRandom.nextBytes(bytes); } + @Override public synchronized String nextString(int length, String alphabet) { checkActive(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/RandomizerFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/RandomizerFactory.java index 81e336e2b1..84490b2fc2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/RandomizerFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/RandomizerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,6 +27,7 @@ public class RandomizerFactory extends Factory super(PRODUCT_GROUP, TYPE); } + @Override public Randomizer create(String description) throws ProductCreationException { Randomizer randomizer = new Randomizer(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorFactory.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorFactory.java index 52a51f855f..ec460a2f46 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorFactory.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ public class ResponseNegotiatorFactory extends NegotiatorFactory super(TYPE); } + @Override public ResponseNegotiator create(String description) { return new ResponseNegotiator(); diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorInjector.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorInjector.java index 3cce87f633..f781a15c87 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorInjector.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/ResponseNegotiatorInjector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2011, 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ public abstract class ResponseNegotiatorInjector implements IElementProcessor return negotiator; } + @Override public Object process(IManagedContainer container, String productGroup, String factoryType, String description, Object element) { if (element instanceof INegotiatorAware) diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java index 0618c5b61b..fb06249ce3 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2012, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008-2012, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,12 +30,14 @@ public class UserManager extends Lifecycle implements IUserManager, IAuthenticat { } + @Override public synchronized void addUser(String userID, char[] password) { users.put(userID, password); save(users); } + @Override public synchronized void removeUser(String userID) { if (users.remove(userID) != null) @@ -55,6 +57,7 @@ public class UserManager extends Lifecycle implements IUserManager, IAuthenticat /** * @since 3.3 */ + @Override public void authenticate(String userID, char[] password) { char[] userPassword; @@ -77,6 +80,7 @@ public class UserManager extends Lifecycle implements IUserManager, IAuthenticat /** * @since 2.0 */ + @Override public byte[] encrypt(String userID, byte[] data, String algorithmName, byte[] salt, int count) throws SecurityException { char[] password; diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManagerAuthenticator.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManagerAuthenticator.java index 1241f8472b..9b396fe7b9 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManagerAuthenticator.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/security/UserManagerAuthenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, 2016 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2012, 2015, 2016, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -109,6 +109,7 @@ public class UserManagerAuthenticator extends Lifecycle implements IAuthenticato this.userManager = userManager; } + @Override public void authenticate(String userID, char[] password) throws SecurityException { try diff --git a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java index 38d9686155..2d50dc66f2 100644 --- a/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java +++ b/plugins/org.eclipse.net4j.util/src/org/eclipse/net4j/util/transaction/Transaction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2011, 2012, 2015 Eike Stepper (Loehne, Germany) and others. + * Copyright (c) 2008, 2009, 2011, 2012, 2015, 2019 Eike Stepper (Loehne, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -40,16 +40,19 @@ public class Transaction<CONTEXT> implements ITransaction<CONTEXT> return undoPhase1OnRollback; } + @Override public boolean isActive() { return operations != null; } + @Override public CONTEXT getContext() { return context; } + @Override public void execute(ITransactionalOperation<CONTEXT> operation) throws TransactionException { if (!isActive()) @@ -74,6 +77,7 @@ public class Transaction<CONTEXT> implements ITransaction<CONTEXT> } } + @Override public void commit() { for (ITransactionalOperation<CONTEXT> operation : end()) @@ -82,6 +86,7 @@ public class Transaction<CONTEXT> implements ITransaction<CONTEXT> } } + @Override public void rollback() { if (undoPhase1OnRollback) |