diff options
author | Alexander Kurtakov | 2017-01-10 08:40:50 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-01-10 08:40:50 +0000 |
commit | 2a32a28ce58410413c26caeddbb741cdc7a5db41 (patch) | |
tree | 1fb56efb04e5387c11da969a7c4e0e64d03c730e /bundles/org.eclipse.equinox.simpleconfigurator | |
parent | e0011efa5e7fea83479434ecd39831627afe2ac7 (diff) | |
download | rt.equinox.p2-2a32a28ce58410413c26caeddbb741cdc7a5db41.tar.gz rt.equinox.p2-2a32a28ce58410413c26caeddbb741cdc7a5db41.tar.xz rt.equinox.p2-2a32a28ce58410413c26caeddbb741cdc7a5db41.zip |
Bug 509473: Bump p2.engine and equinox.simpleconfigurator to JavaSE-1.7.
Enable some java 1.7 and older code style warnings and fix them:
* Add missing @Override.
* Remove redundant type declarations.
* Remove useless non-javadoc comments.
Change-Id: If80ea62f65204cad77275e07fee096a276d35c5c
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.simpleconfigurator')
8 files changed, 141 insertions, 43 deletions
diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs index 25d9f95b6..7bc4c218d 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.simpleconfigurator/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,15 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 @@ -7,13 +17,40 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public @@ -21,6 +58,64 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/Activator.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/Activator.java index 3ab096aea..2c9cd6c8e 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/Activator.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. + * Copyright (c) 2007, 2017 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 @@ -55,11 +55,12 @@ public class Activator implements BundleActivator { private ServiceRegistration<?> configuratorRegistration; private ServiceRegistration<?> commandRegistration; + @Override public void start(BundleContext context) throws Exception { SimpleConfiguratorImpl bundleConfigurator = new SimpleConfiguratorImpl(context, context.getBundle()); bundleConfigurator.applyConfiguration(); - Dictionary<String, String> props = new Hashtable<String, String>(); + Dictionary<String, String> props = new Hashtable<>(); props.put(Constants.SERVICE_VENDOR, "Eclipse"); //$NON-NLS-1$ props.put(Constants.SERVICE_PID, SimpleConfiguratorConstants.TARGET_CONFIGURATOR_NAME); ServiceFactory<?> configurationFactory = new SimpleConfiguratorFactory(context); @@ -77,6 +78,7 @@ public class Activator implements BundleActivator { System.out.println("registered Configurator"); //$NON-NLS-1$ } + @Override public void stop(BundleContext context) throws Exception { if (configuratorRegistration != null) { configuratorRegistration.unregister(); diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java index 84352f7ee..1fca13371 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/ConfigApplier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. All rights reserved. + * Copyright (c) 2007, 2017 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 http://www.eclipse.org/legal/epl-v10.html @@ -54,7 +54,7 @@ class ConfigApplier { throw new IllegalStateException("No StartLevelService service is available."); //$NON-NLS-1$ startLevelService = manipulatingContext.getService(startLevelRef); - frameworkWiring = (FrameworkWiring) manipulatingContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class); + frameworkWiring = manipulatingContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION).adapt(FrameworkWiring.class); } void install(URL url, boolean exclusiveMode) throws IOException { @@ -85,15 +85,15 @@ class ConfigApplier { if (!exclusiveMode) { BundleInfo[] lastInstalledBundles = getLastState(); if (lastInstalledBundles != null) { - toUninstall = new HashSet<BundleInfo>(Arrays.asList(lastInstalledBundles)); + toUninstall = new HashSet<>(Arrays.asList(lastInstalledBundles)); toUninstall.removeAll(Arrays.asList(expectedState)); } saveStateAsLast(url); } Set<Bundle> prevouslyResolved = getResolvedBundles(); - Collection<Bundle> toRefresh = new ArrayList<Bundle>(); - Collection<Bundle> toStart = new ArrayList<Bundle>(); + Collection<Bundle> toRefresh = new ArrayList<>(); + Collection<Bundle> toStart = new ArrayList<>(); if (exclusiveMode) { toRefresh.addAll(installBundles(expectedState, toStart)); toRefresh.addAll(uninstallBundles(expectedState, packageAdminService)); @@ -102,23 +102,23 @@ class ConfigApplier { if (toUninstall != null) toRefresh.addAll(uninstallBundles(toUninstall)); } - refreshPackages((Bundle[]) toRefresh.toArray(new Bundle[toRefresh.size()]), manipulatingContext); + refreshPackages(toRefresh.toArray(new Bundle[toRefresh.size()]), manipulatingContext); if (toRefresh.size() > 0) { Bundle[] additionalRefresh = getAdditionalRefresh(prevouslyResolved, toRefresh); if (additionalRefresh.length > 0) refreshPackages(additionalRefresh, manipulatingContext); } - startBundles((Bundle[]) toStart.toArray(new Bundle[toStart.size()])); + startBundles(toStart.toArray(new Bundle[toStart.size()])); } private Bundle[] getAdditionalRefresh(Set<Bundle> previouslyResolved, Collection<Bundle> toRefresh) { // This is the luna equinox framework or a non-equinox framework. // Use standard OSGi API. - final Set<Bundle> additionalRefresh = new HashSet<Bundle>(); - final Set<Bundle> originalRefresh = new HashSet<Bundle>(toRefresh); + final Set<Bundle> additionalRefresh = new HashSet<>(); + final Set<Bundle> originalRefresh = new HashSet<>(toRefresh); for (Iterator<Bundle> iToRefresh = toRefresh.iterator(); iToRefresh.hasNext();) { - Bundle bundle = (Bundle) iToRefresh.next(); - BundleRevision revision = (BundleRevision) bundle.adapt(BundleRevision.class); + Bundle bundle = iToRefresh.next(); + BundleRevision revision = bundle.adapt(BundleRevision.class); if (bundle.getState() == Bundle.INSTALLED && revision != null && (revision.getTypes() & BundleRevision.TYPE_FRAGMENT) != 0) { // this is an unresolved fragment; look to see if it has additional payload requirements boolean foundPayLoadReq = false; @@ -148,13 +148,13 @@ class ConfigApplier { for (Iterator<Bundle> iPreviouslyResolved = previouslyResolved.iterator(); iPreviouslyResolved.hasNext();) { Bundle bundle = iPreviouslyResolved.next(); - BundleRevision revision = (BundleRevision) bundle.adapt(BundleRevision.class); + BundleRevision revision = bundle.adapt(BundleRevision.class); BundleWiring wiring = revision == null ? null : revision.getWiring(); if (wiring != null) { Collection<BundleRequirement> reqs = revision.getDeclaredRequirements(null); - Set<BundleRequirement> optionalReqs = new HashSet<BundleRequirement>(); + Set<BundleRequirement> optionalReqs = new HashSet<>(); for (Iterator<BundleRequirement> iReqs = reqs.iterator(); iReqs.hasNext();) { - BundleRequirement req = (BundleRequirement) iReqs.next(); + BundleRequirement req = iReqs.next(); String namespace = req.getNamespace(); // only do this for package and bundle namespaces if (PackageNamespace.PACKAGE_NAMESPACE.equals(namespace) || BundleNamespace.BUNDLE_NAMESPACE.equals(namespace)) { @@ -195,7 +195,7 @@ class ConfigApplier { } } } - return (Bundle[]) additionalRefresh.toArray(new Bundle[additionalRefresh.size()]); + return additionalRefresh.toArray(new Bundle[additionalRefresh.size()]); } private BundleWiring getHostWiring(BundleWiring wiring) { @@ -208,12 +208,12 @@ class ConfigApplier { if (hostWires.isEmpty()) { return wiring; } - BundleWire hostWire = (BundleWire) hostWires.iterator().next(); + BundleWire hostWire = hostWires.iterator().next(); return hostWire.getProviderWiring(); } private Set<Bundle> getResolvedBundles() { - Set<Bundle> resolved = new HashSet<Bundle>(); + Set<Bundle> resolved = new HashSet<>(); Bundle[] allBundles = manipulatingContext.getBundles(); for (int i = 0; i < allBundles.length; i++) if ((allBundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) @@ -222,7 +222,7 @@ class ConfigApplier { } private Collection<Bundle> uninstallBundles(HashSet<BundleInfo> toUninstall) { - Collection<Bundle> removedBundles = new ArrayList<Bundle>(toUninstall.size()); + Collection<Bundle> removedBundles = new ArrayList<>(toUninstall.size()); for (Iterator<BundleInfo> iterator = toUninstall.iterator(); iterator.hasNext();) { BundleInfo current = iterator.next(); Bundle[] matchingBundles = packageAdminService.getBundles(current.getSymbolicName(), getVersionRange(current.getVersion())); @@ -247,7 +247,7 @@ class ConfigApplier { try { destinationStream = new FileOutputStream(lastBundlesTxt); ArrayList<File> sourcesLocation = SimpleConfiguratorUtils.getInfoFiles(); - List<InputStream> sourceStreams = new ArrayList<InputStream>(sourcesLocation.size() + 1); + List<InputStream> sourceStreams = new ArrayList<>(sourcesLocation.size() + 1); sourceStreams.add(url.openStream()); if (Activator.EXTENDED) { for (int i = 0; i < sourcesLocation.size(); i++) { @@ -277,14 +277,14 @@ class ConfigApplier { if (!lastBundlesInfo.isFile()) return null; try { - return (BundleInfo[]) SimpleConfiguratorUtils.readConfiguration(lastBundlesInfo.toURL(), baseLocation).toArray(new BundleInfo[1]); + return SimpleConfiguratorUtils.readConfiguration(lastBundlesInfo.toURL(), baseLocation).toArray(new BundleInfo[1]); } catch (IOException e) { return null; } } private ArrayList<Bundle> installBundles(BundleInfo[] finalList, Collection<Bundle> toStart) { - ArrayList<Bundle> toRefresh = new ArrayList<Bundle>(); + ArrayList<Bundle> toRefresh = new ArrayList<>(); String useReferenceProperty = manipulatingContext.getProperty(SimpleConfiguratorConstants.PROP_KEY_USE_REFERENCE); boolean useReference = useReferenceProperty == null ? runningOnEquinox : Boolean.parseBoolean(useReferenceProperty); @@ -394,7 +394,7 @@ class ConfigApplier { // BSN automatically. This is no longer the case for Luna or other framework // implementations. Here we want to make sure all existing bundles with the // same BSN are refreshed also. - Set<Bundle> allSameBSNs = new LinkedHashSet<Bundle>(); // maintain order and avoid duplicates + Set<Bundle> allSameBSNs = new LinkedHashSet<>(); // maintain order and avoid duplicates for (Bundle bundle : bundles) { allSameBSNs.add(bundle); String bsn = bundle.getLocation(); @@ -475,7 +475,7 @@ class ConfigApplier { Bundle[] allBundles = manipulatingContext.getBundles(); //Build a set with all the bundles from the system - Set<Bundle> removedBundles = new HashSet<Bundle>(allBundles.length); + Set<Bundle> removedBundles = new HashSet<>(allBundles.length); // configurator.setPrerequisiteBundles(allBundles); for (int i = 0; i < allBundles.length; i++) { if (allBundles[i].getBundleId() == 0) diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorFactory.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorFactory.java index acafe1c73..9dc7aea19 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorFactory.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2017 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 @@ -19,10 +19,12 @@ public class SimpleConfiguratorFactory implements ServiceFactory<Object> { this.context = context; } + @Override public Object getService(Bundle bundle, ServiceRegistration<Object> registration) { return new SimpleConfiguratorImpl(context, bundle); } + @Override public void ungetService(Bundle bundle, ServiceRegistration<Object> registration, Object service) { // nothing to do } diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java index 5c68ab0a4..1ab895107 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/SimpleConfiguratorImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 2017 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 @@ -178,6 +178,7 @@ public class SimpleConfiguratorImpl implements Configurator { return new long[] {lastModified, extLastModified}; } + @Override public void applyConfiguration(URL url) throws IOException { synchronized (configurationLock) { if (Activator.DEBUG) @@ -199,6 +200,7 @@ public class SimpleConfiguratorImpl implements Configurator { return Boolean.parseBoolean(value); } + @Override public void applyConfiguration() throws IOException { synchronized (configurationLock) { configurationURL = getConfigurationURL(); @@ -206,6 +208,7 @@ public class SimpleConfiguratorImpl implements Configurator { } } + @Override public URL getUrlInUse() { synchronized (configurationLock) { return configurationURL; diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java index a61a9faea..a32d7ebbf 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/console/ConfiguratorCommandProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. + * Copyright (c) 2007, 2017 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 @@ -71,6 +71,7 @@ public class ConfiguratorCommandProvider implements CommandProvider { return Boolean.FALSE; } + @Override public String getHelp() { return getHelp(null); } diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/BundleInfo.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/BundleInfo.java index 8f44d08b3..491b72806 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/BundleInfo.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/BundleInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2017 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 http://www.eclipse.org/legal/epl-v10.html @@ -63,6 +63,7 @@ public class BundleInfo { /* (non-Javadoc) * @see java.lang.Object#toString() */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("BundleInfo("); //$NON-NLS-1$ @@ -85,6 +86,7 @@ public class BundleInfo { return buffer.toString(); } + @Override public int hashCode() { final int prime = 31; int result = 1; @@ -93,6 +95,7 @@ public class BundleInfo { return result; } + @Override public boolean equals(Object obj) { if (this == obj) return true; diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java index a210530d3..19b3d2a5d 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 IBM Corporation and others. All rights reserved. + * Copyright (c) 2007, 2017 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 http://www.eclipse.org/legal/epl-v10.html @@ -36,7 +36,7 @@ public class SimpleConfiguratorUtils { private static final Set<File> reportedExtensions = Collections.synchronizedSet(new HashSet<File>(0)); public static List<BundleInfo> readConfiguration(URL url, URI base) throws IOException { - List<BundleInfo> result = new ArrayList<BundleInfo>(); + List<BundleInfo> result = new ArrayList<>(); //old behaviour result.addAll(readConfigurationFromFile(url, base)); @@ -103,7 +103,7 @@ public class SimpleConfiguratorUtils { } public static ArrayList<File> getInfoFiles() throws IOException, FileNotFoundException, URISyntaxException { - ArrayList<File> files = new ArrayList<File>(1); + ArrayList<File> files = new ArrayList<>(1); if (Activator.EXTENSIONS != null) { //configured simpleconfigurator extensions location @@ -117,7 +117,7 @@ public class SimpleConfiguratorUtils { } private static ArrayList<File> getInfoFilesFromLocation(String locationToCheck) throws IOException, FileNotFoundException, URISyntaxException { - ArrayList<File> result = new ArrayList<File>(1); + ArrayList<File> result = new ArrayList<>(1); File extensionsLocation = new File(locationToCheck); @@ -202,7 +202,7 @@ public class SimpleConfiguratorUtils { * @throws IOException */ public static List<BundleInfo> readConfiguration(InputStream stream, URI base) throws IOException { - List<BundleInfo> bundles = new ArrayList<BundleInfo>(); + List<BundleInfo> bundles = new ArrayList<>(); BufferedInputStream bufferedStream = new BufferedInputStream(stream); String encoding = determineEncoding(bufferedStream); @@ -403,15 +403,7 @@ public class SimpleConfiguratorUtils { regularTimestamp = infoFileLastModified; } } - } catch (FileNotFoundException e) { - if (Activator.DEBUG) { - e.printStackTrace(); - } - } catch (IOException e) { - if (Activator.DEBUG) { - e.printStackTrace(); - } - } catch (URISyntaxException e) { + } catch (IOException | URISyntaxException e) { if (Activator.DEBUG) { e.printStackTrace(); } |