diff options
author | Alexander Kurtakov | 2017-08-20 06:25:45 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-08-20 06:25:45 +0000 |
commit | ad2ea73909b67c8687b14eb12f608b7862f9eaca (patch) | |
tree | 3c6f6823e09690e52aa13f8f4259711992a8eb55 | |
parent | 20c737d78adb1722d14ded8902b2d091f4117dc8 (diff) | |
download | rt.equinox.p2-ad2ea73909b67c8687b14eb12f608b7862f9eaca.tar.gz rt.equinox.p2-ad2ea73909b67c8687b14eb12f608b7862f9eaca.tar.xz rt.equinox.p2-ad2ea73909b67c8687b14eb12f608b7862f9eaca.zip |
Bug 521156 - Move p2 updatesite bundle to Java 8
Bump minor version, add missing Override annotations, remove duplicated
type declarations, lambda conversions.
Change-Id: Ida3bbc9351433f345ba6c405ede235390f541feb
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
26 files changed, 215 insertions, 192 deletions
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/.classpath b/bundles/org.eclipse.equinox.p2.updatesite/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/.classpath +++ b/bundles/org.eclipse.equinox.p2.updatesite/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs index 1dfc8a476..6cd17b4e0 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.updatesite/.settings/org.eclipse.jdt.core.prefs @@ -10,13 +10,16 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled 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.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -53,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore @@ -63,7 +66,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +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 @@ -71,19 +74,21 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning 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=warning 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=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore @@ -99,6 +104,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore @@ -106,6 +114,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning 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=error org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=error @@ -118,7 +127,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error 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.5 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF index 69b7047c1..8733bf14c 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.updatesite;singleton:=true -Bundle-Version: 1.0.600.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.updatesite.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -12,7 +12,7 @@ Export-Package: org.eclipse.equinox.internal.p2.updatesite;x-friends:="org.eclip Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0.0)", org.eclipse.equinox.p2.metadata.repository;bundle-version="0.1.0", org.eclipse.equinox.p2.artifact.repository;bundle-version="0.1.0" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: javax.xml.parsers, org.eclipse.equinox.app;version="1.1.0", diff --git a/bundles/org.eclipse.equinox.p2.updatesite/pom.xml b/bundles/org.eclipse.equinox.p2.updatesite/pom.xml index f2f6108f5..f88fe50f4 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/pom.xml +++ b/bundles/org.eclipse.equinox.p2.updatesite/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.updatesite</artifactId> - <version>1.0.600-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/Activator.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/Activator.java index 79f37a3fc..51e369f80 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/Activator.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/Activator.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 @@ -21,16 +21,12 @@ public class Activator implements BundleActivator { public static String ID = "org.eclipse.equinox.p2.updatesite"; //$NON-NLS-1$ private static BundleContext bundleContext; - /* (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext context) throws Exception { setBundleContext(context); } - /* (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ + @Override public void stop(BundleContext context) throws Exception { setBundleContext(null); } diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryParser.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryParser.java index 6871ab164..f006b40ca 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryParser.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -69,15 +69,15 @@ public class CategoryParser extends DefaultHandler { private boolean DESCRIPTION_SITE_ALREADY_SEEN = false; // Current object stack (used to hold the current object we are // populating in this plugin descriptor - Stack<Object> objectStack = new Stack<Object>(); + Stack<Object> objectStack = new Stack<>(); private SAXParser parser; // Current State Information - Stack<Integer> stateStack = new Stack<Integer>(); + Stack<Integer> stateStack = new Stack<>(); // List of string keys for translated strings - private final List<String> messageKeys = new ArrayList<String>(4); + private final List<String> messageKeys = new ArrayList<>(4); private MultiStatus status; @@ -105,8 +105,8 @@ public class CategoryParser extends DefaultHandler { */ public CategoryParser(URI siteLocation) { super(); - stateStack = new Stack<Integer>(); - objectStack = new Stack<Object>(); + stateStack = new Stack<>(); + objectStack = new Stack<>(); status = null; DESCRIPTION_SITE_ALREADY_SEEN = false; try { @@ -134,6 +134,7 @@ public class CategoryParser extends DefaultHandler { * @see DefaultHandler#characters(char[], int, int) * @since 2.0 */ + @Override public void characters(char[] ch, int start, int length) { String text = new String(ch, start, length); //only push if description @@ -164,6 +165,7 @@ public class CategoryParser extends DefaultHandler { * @see DefaultHandler#endElement(String, String, String) * @since 2.0 */ + @Override public void endElement(String uri, String localName, String qName) { String text = null; @@ -342,6 +344,7 @@ public class CategoryParser extends DefaultHandler { * @see DefaultHandler#error(SAXParseException) * @since 2.0 */ + @Override public void error(SAXParseException ex) { logStatus(ex); } @@ -352,6 +355,7 @@ public class CategoryParser extends DefaultHandler { * @exception SAXException * @since 2.0 */ + @Override public void fatalError(SAXParseException ex) throws SAXException { logStatus(ex); throw ex; @@ -889,6 +893,7 @@ public class CategoryParser extends DefaultHandler { * @see DefaultHandler#startElement(String, String, String, Attributes) * @since 2.0 */ + @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (Tracing.DEBUG_GENERATOR_PARSING) { diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryPublisherApplication.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryPublisherApplication.java index 28f0525e1..b3ca1632e 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryPublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This + * Copyright (c) 2009, 2017 EclipseSource 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 @@ -35,6 +35,7 @@ public class CategoryPublisherApplication extends AbstractPublisherApplication { /* * Check to see if an existing repository already has the "compressed" flag set */ + @Override protected void initializeRepositories(PublisherInfo publisherInfo) throws ProvisionException { try { if (metadataLocation != null) { @@ -57,6 +58,7 @@ public class CategoryPublisherApplication extends AbstractPublisherApplication { super.initializeRepositories(publisherInfo); } + @Override protected void processParameter(String arg, String parameter, PublisherInfo pinfo) throws URISyntaxException { super.processParameter(arg, parameter, pinfo); @@ -70,6 +72,7 @@ public class CategoryPublisherApplication extends AbstractPublisherApplication { } + @Override protected IPublisherAction[] createActions() { return new IPublisherAction[] {new CategoryXMLAction(categoryDefinition, categoryQualifier)}; } diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryXMLAction.java index 2f6eaa259..303b7995b 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryXMLAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/CategoryXMLAction.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource 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 @@ -26,6 +26,7 @@ public class CategoryXMLAction extends SiteXMLAction { super(location, categoryQualifier); } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { try { updateSite = UpdateSite.loadCategoryFile(location, getTransport(publisherInfo), monitor); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java index be4972703..24112bcf2 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DefaultSiteParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -62,15 +62,15 @@ public class DefaultSiteParser extends DefaultHandler { private boolean DESCRIPTION_SITE_ALREADY_SEEN = false; // Current object stack (used to hold the current object we are // populating in this plugin descriptor - Stack<Object> objectStack = new Stack<Object>(); + Stack<Object> objectStack = new Stack<>(); private SAXParser parser; // Current State Information - Stack<Integer> stateStack = new Stack<Integer>(); + Stack<Integer> stateStack = new Stack<>(); // List of string keys for translated strings - private final List<String> messageKeys = new ArrayList<String>(4); + private final List<String> messageKeys = new ArrayList<>(4); private MultiStatus status; private final URI siteLocation; @@ -134,8 +134,8 @@ public class DefaultSiteParser extends DefaultHandler { public DefaultSiteParser(URI siteLocation) { super(); this.siteLocation = siteLocation; - stateStack = new Stack<Integer>(); - objectStack = new Stack<Object>(); + stateStack = new Stack<>(); + objectStack = new Stack<>(); status = null; DESCRIPTION_SITE_ALREADY_SEEN = false; try { @@ -156,6 +156,7 @@ public class DefaultSiteParser extends DefaultHandler { * @see DefaultHandler#characters(char[], int, int) * @since 2.0 */ + @Override public void characters(char[] ch, int start, int length) { String text = new String(ch, start, length); //only push if description @@ -170,6 +171,7 @@ public class DefaultSiteParser extends DefaultHandler { * @see DefaultHandler#endElement(String, String, String) * @since 2.0 */ + @Override public void endElement(String uri, String localName, String qName) { String text = null; @@ -307,6 +309,7 @@ public class DefaultSiteParser extends DefaultHandler { * @see DefaultHandler#error(SAXParseException) * @since 2.0 */ + @Override public void error(SAXParseException ex) { logStatus(ex); } @@ -317,6 +320,7 @@ public class DefaultSiteParser extends DefaultHandler { * @exception SAXException * @since 2.0 */ + @Override public void fatalError(SAXParseException ex) throws SAXException { logStatus(ex); throw ex; @@ -871,6 +875,7 @@ public class DefaultSiteParser extends DefaultHandler { * @see DefaultHandler#startElement(String, String, String, Attributes) * @since 2.0 */ + @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (Tracing.DEBUG_GENERATOR_PARSING) { diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java index 86fabf2ce..6ce7fd713 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/DigestParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -36,7 +36,7 @@ public class DigestParser extends DefaultHandler { private final static SAXParserFactory parserFactory = SAXParserFactory.newInstance(); private SAXParser parser; - private final List<Feature> features = new ArrayList<Feature>(); + private final List<Feature> features = new ArrayList<>(); private final FeatureManifestParser featureHandler = new FeatureManifestParser(false); public DigestParser() { @@ -51,10 +51,12 @@ public class DigestParser extends DefaultHandler { } } + @Override public void characters(char[] ch, int start, int length) throws SAXException { featureHandler.characters(ch, start, length); } + @Override public void endElement(String uri, String localName, String qName) throws SAXException { if ("digest".equals(localName)) { //$NON-NLS-1$ return; @@ -104,6 +106,7 @@ public class DigestParser extends DefaultHandler { return null; } + @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("digest".equals(localName)) { //$NON-NLS-1$ return; diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java index 251f31d43..fc4ad3e70 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/LocalUpdateSiteAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 @@ -61,6 +61,7 @@ public class LocalUpdateSiteAction implements IPublisherAction { categoryVersion = version; } + @Override public IStatus perform(IPublisherInfo info, IPublisherResult results, IProgressMonitor monitor) { IPublisherAction[] actions = createActions(); MultiStatus finalStatus = new MultiStatus(LocalUpdateSiteAction.class.getName(), 0, NLS.bind(Messages.Error_Generation, source != null ? source : (updateSite != null ? updateSite.getLocation().toString() : "Unknown")), null); //$NON-NLS-1$ @@ -76,7 +77,7 @@ public class LocalUpdateSiteAction implements IPublisherAction { protected IPublisherAction[] createActions() { createAdvice(); - ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> result = new ArrayList<>(); // create an action that just publishes the raw bundles and features IPublisherAction action = new MergeResultsAction(new IPublisherAction[] {createFeaturesAction(), createBundlesAction()}, IPublisherResult.MERGE_ALL_NON_ROOT); result.add(action); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java index a66fd64bd..21195d5d2 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteFeaturesAction.java @@ -33,6 +33,7 @@ public class RemoteFeaturesAction extends FeaturesAction { throw new IllegalArgumentException(); } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { try { this.info = publisherInfo; @@ -46,8 +47,9 @@ public class RemoteFeaturesAction extends FeaturesAction { } + @Override protected void generateFeatureIUs(Feature[] featureList, IPublisherResult result) { - Map<String, String> extraProperties = new HashMap<String, String>(); + Map<String, String> extraProperties = new HashMap<>(); extraProperties.put(IInstallableUnit.PROP_PARTIAL_IU, Boolean.TRUE.toString()); for (int i = 0; i < featureList.length; i++) { Feature feature = featureList[i]; @@ -55,7 +57,7 @@ public class RemoteFeaturesAction extends FeaturesAction { for (int j = 0; j < featureEntries.length; j++) { FeatureEntry entry = featureEntries[j]; if (entry.isPlugin() && !entry.isRequires()) { - Dictionary<String, String> mockManifest = new Hashtable<String, String>(); + Dictionary<String, String> mockManifest = new Hashtable<>(); mockManifest.put("Manifest-Version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ mockManifest.put("Bundle-ManifestVersion", "2"); //$NON-NLS-1$ //$NON-NLS-2$ mockManifest.put("Bundle-SymbolicName", entry.getId()); //$NON-NLS-1$ @@ -68,7 +70,7 @@ public class RemoteFeaturesAction extends FeaturesAction { } } IInstallableUnit featureIU = createFeatureJarIU(feature, new PublisherInfo()); - List<IInstallableUnit> childIUs = new ArrayList<IInstallableUnit>(); + List<IInstallableUnit> childIUs = new ArrayList<>(); childIUs.add(featureIU); IInstallableUnit groupIU = createGroupIU(feature, childIUs, new PublisherInfo()); result.addIU(featureIU, IPublisherResult.ROOT); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java index bd983ae86..e1f5be849 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/RemoteUpdateSiteAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 @@ -10,8 +10,6 @@ ******************************************************************************/ package org.eclipse.equinox.internal.p2.updatesite; -import org.eclipse.equinox.p2.publisher.IPublisherAction; - import java.util.ArrayList; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.core.helpers.Tracing; @@ -39,6 +37,7 @@ public class RemoteUpdateSiteAction implements IPublisherAction { this.categoryQualifier = categoryQualifier; } + @Override public IStatus perform(IPublisherInfo info, IPublisherResult results, IProgressMonitor monitor) { if (Tracing.DEBUG_PUBLISHING) Tracing.debug("Generating metadata for update site: " + updateSite.getLocation()); //$NON-NLS-1$ @@ -57,7 +56,7 @@ public class RemoteUpdateSiteAction implements IPublisherAction { } protected IPublisherAction[] createActions() { - ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> result = new ArrayList<>(); result.add(new RemoteFeaturesAction(updateSite)); result.add(createSiteXMLAction()); return result.toArray(new IPublisherAction[result.size()]); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java index 880fd5a30..8236e6fbb 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteBundle.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, Red Hat Inc. and others + * Copyright (c) 2012, 2017 Red Hat Inc. 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 @@ -93,7 +93,7 @@ public class SiteBundle { */ public void addCategoryName(String categoryName) { if (this.categoryNames == null) - this.categoryNames = new ArrayList<String>(); + this.categoryNames = new ArrayList<>(); if (!this.categoryNames.contains(categoryName)) this.categoryNames.add(categoryName); } @@ -119,6 +119,7 @@ public class SiteBundle { * @return <code>true</code> if the two models are equal, * <code>false</code> otherwise */ + @Override public boolean equals(Object object) { if (object == null) return false; @@ -146,6 +147,7 @@ public class SiteBundle { /* (non-Javadoc) * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { final int prime = 31; int result = 1; @@ -331,7 +333,7 @@ public class SiteBundle { if (categoryNames == null) this.categoryNames = null; else - this.categoryNames = new ArrayList<String>(Arrays.asList(categoryNames)); + this.categoryNames = new ArrayList<>(Arrays.asList(categoryNames)); } /** @@ -433,6 +435,7 @@ public class SiteBundle { /** * @see Object#toString() */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(getClass().toString() + " :"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java index cc56b4cec..d097604fd 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteCategory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -37,19 +37,16 @@ public class SiteCategory { */ public static Comparator<SiteCategory> getComparator() { if (comp == null) { - comp = new Comparator<SiteCategory>() { - /* - * @see Comparator#compare(Object,Object) - * Returns 0 if versions are equal. - * Returns -1 if object1 is after than object2. - * Returns +1 if object1 is before than object2. - */ - public int compare(SiteCategory cat1, SiteCategory cat2) { - - if (cat1.equals(cat2)) - return 0; - return cat1.getName().compareTo(cat2.getName()); - } + /* + * Returns 0 if versions are equal. + * Returns -1 if object1 is after than object2. + * Returns +1 if object1 is before than object2. + */ + comp = (cat1, cat2) -> { + + if (cat1.equals(cat2)) + return 0; + return cat1.getName().compareTo(cat2.getName()); }; } return comp; @@ -70,6 +67,7 @@ public class SiteCategory { * @see Object#equals(Object) * @since 2.0 */ + @Override public boolean equals(Object obj) { boolean result = false; if (obj instanceof SiteCategory) { @@ -126,6 +124,7 @@ public class SiteCategory { * @see Object#hashCode() * @since 2.0 */ + @Override public int hashCode() { return getName().hashCode(); } @@ -202,7 +201,7 @@ public class SiteCategory { */ public void addCategoryName(String categoryName) { if (this.categoryNames == null) { - this.categoryNames = new ArrayList<String>(); + this.categoryNames = new ArrayList<>(); } if (!this.categoryNames.contains(categoryName)) { this.categoryNames.add(categoryName); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java index 96bbee170..b6af32bdf 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteFeature.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -99,7 +99,7 @@ public class SiteFeature { */ public void addCategoryName(String categoryName) { if (this.categoryNames == null) - this.categoryNames = new ArrayList<String>(); + this.categoryNames = new ArrayList<>(); if (!this.categoryNames.contains(categoryName)) this.categoryNames.add(categoryName); } @@ -125,6 +125,7 @@ public class SiteFeature { * @return <code>true</code> if the two models are equal, * <code>false</code> otherwise */ + @Override public boolean equals(Object object) { if (object == null) return false; @@ -152,6 +153,7 @@ public class SiteFeature { /* (non-Javadoc) * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { final int prime = 31; int result = 1; @@ -337,7 +339,7 @@ public class SiteFeature { if (categoryNames == null) this.categoryNames = null; else - this.categoryNames = new ArrayList<String>(Arrays.asList(categoryNames)); + this.categoryNames = new ArrayList<>(Arrays.asList(categoryNames)); } /** @@ -439,6 +441,7 @@ public class SiteFeature { /** * @see Object#toString() */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); if (featureId != null) diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteIU.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteIU.java index bacf48ae4..301cc26c8 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteIU.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteIU.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 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 @@ -124,7 +124,7 @@ public class SiteIU { */ public void addCategoryName(String categoryName) { if (this.categoryNames == null) - this.categoryNames = new ArrayList<String>(); + this.categoryNames = new ArrayList<>(); if (!this.categoryNames.contains(categoryName)) this.categoryNames.add(categoryName); } @@ -136,7 +136,7 @@ public class SiteIU { */ public void addQueryParams(String queryParam) { if (this.queryParams == null) - this.queryParams = new ArrayList<String>(); + this.queryParams = new ArrayList<>(); // don't do contains check, order matters and there may be duplicates this.queryParams.add(queryParam); } diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java index 087659606..791de3a29 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -67,7 +67,7 @@ public class SiteModel { */ public void addArchive(URLEntry archiveReference) { if (this.archiveReferences == null) - this.archiveReferences = new ArrayList<URLEntry>(); + this.archiveReferences = new ArrayList<>(); if (!this.archiveReferences.contains(archiveReference)) this.archiveReferences.add(archiveReference); } @@ -79,7 +79,7 @@ public class SiteModel { */ public void addCategory(SiteCategory category) { if (categories == null) - categories = new HashMap<String, SiteCategory>(); + categories = new HashMap<>(); if (!categories.containsKey(category.getName())) { categories.put(category.getName(), category); if (localizations != null && !localizations.isEmpty()) @@ -94,7 +94,7 @@ public class SiteModel { */ public void addFeature(SiteFeature featureReference) { if (this.features == null) - this.features = new ArrayList<SiteFeature>(); + this.features = new ArrayList<>(); this.features.add(featureReference); } @@ -105,7 +105,7 @@ public class SiteModel { */ public void addBundle(SiteBundle bundleReference) { if (this.bundles == null) - this.bundles = new ArrayList<SiteBundle>(); + this.bundles = new ArrayList<>(); this.bundles.add(bundleReference); } @@ -116,7 +116,7 @@ public class SiteModel { */ public void addStatsFeature(SiteFeature featureReference) { if (this.statsFeatures == null) - this.statsFeatures = new ArrayList<SiteFeature>(); + this.statsFeatures = new ArrayList<>(); this.statsFeatures.add(featureReference); } @@ -127,7 +127,7 @@ public class SiteModel { */ public void addStatsBundle(SiteBundle bundleReference) { if (this.statsBundles == null) - this.statsBundles = new ArrayList<SiteBundle>(); + this.statsBundles = new ArrayList<>(); this.statsBundles.add(bundleReference); } @@ -138,7 +138,7 @@ public class SiteModel { */ public void addIU(SiteIU iu) { if (this.ius == null) - this.ius = new ArrayList<SiteIU>(); + this.ius = new ArrayList<>(); this.ius.add(iu); } @@ -149,7 +149,7 @@ public class SiteModel { */ public void addRepositoryReference(RepositoryReference ref) { if (this.repositoryReferences == null) - this.repositoryReferences = new ArrayList<RepositoryReference>(); + this.repositoryReferences = new ArrayList<>(); this.repositoryReferences.add(ref); } diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java index 28c70f501..7f5329c45 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 @@ -88,10 +88,11 @@ public class SiteXMLAction extends AbstractPublisherAction { defaultCategory.setDescription("Default category for otherwise uncategorized features"); //$NON-NLS-1$ defaultCategory.setLabel("Uncategorized"); //$NON-NLS-1$ defaultCategory.setName("Default"); //$NON-NLS-1$ - defaultCategorySet = new HashSet<SiteCategory>(1); + defaultCategorySet = new HashSet<>(1); defaultCategorySet.add(defaultCategory); } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { if (updateSite == null) { try { @@ -126,7 +127,7 @@ public class SiteXMLAction extends AbstractPublisherAction { IArtifactKey key = FeaturesAction.createFeatureArtifactKey(feature.getFeatureIdentifier(), iu.getVersion().toString()); IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key); if (descriptors.length > 0 && descriptors[0] instanceof ArtifactDescriptor) { - HashMap<String, String> map = new HashMap<String, String>(); + HashMap<String, String> map = new HashMap<>(); map.put(P_STATS_MARKER, feature.getFeatureIdentifier()); ((ArtifactDescriptor) descriptors[0]).addProperties(map); } @@ -146,7 +147,7 @@ public class SiteXMLAction extends AbstractPublisherAction { IArtifactKey key = BundlesAction.createBundleArtifactKey(iu.getId(), iu.getVersion().toString()); IArtifactDescriptor[] descriptors = artifactRepo.getArtifactDescriptors(key); if (descriptors.length > 0 && descriptors[0] instanceof ArtifactDescriptor) { - HashMap<String, String> map = new HashMap<String, String>(); + HashMap<String, String> map = new HashMap<>(); map.put(P_STATS_MARKER, iu.getId()); ((ArtifactDescriptor) descriptors[0]).addProperties(map); } @@ -165,7 +166,7 @@ public class SiteXMLAction extends AbstractPublisherAction { } private IStatus generateCategories(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { - Map<SiteCategory, Set<IInstallableUnit>> categoriesToIUs = new HashMap<SiteCategory, Set<IInstallableUnit>>(); + Map<SiteCategory, Set<IInstallableUnit>> categoriesToIUs = new HashMap<>(); Map<SiteFeature, Set<SiteCategory>> featuresToCategories = getFeatureToCategoryMappings(publisherInfo); for (SiteFeature feature : featuresToCategories.keySet()) { if (monitor.isCanceled()) @@ -180,7 +181,7 @@ public class SiteXMLAction extends AbstractPublisherAction { for (SiteCategory category : categories) { Set<IInstallableUnit> iusInCategory = categoriesToIUs.get(category); if (iusInCategory == null) { - iusInCategory = new HashSet<IInstallableUnit>(); + iusInCategory = new HashSet<>(); categoriesToIUs.put(category, iusInCategory); } iusInCategory.addAll(ius); @@ -201,7 +202,7 @@ public class SiteXMLAction extends AbstractPublisherAction { for (SiteCategory category : categories) { Set<IInstallableUnit> iusInCategory = categoriesToIUs.get(category); if (iusInCategory == null) { - iusInCategory = new HashSet<IInstallableUnit>(); + iusInCategory = new HashSet<>(); categoriesToIUs.put(category, iusInCategory); } iusInCategory.addAll(ius); @@ -230,7 +231,7 @@ public class SiteXMLAction extends AbstractPublisherAction { for (SiteCategory category : categories) { Set<IInstallableUnit> iusInCategory = categoriesToIUs.get(category); if (iusInCategory == null) { - iusInCategory = new HashSet<IInstallableUnit>(); + iusInCategory = new HashSet<>(); categoriesToIUs.put(category, iusInCategory); } iusInCategory.addAll(ius); @@ -239,7 +240,7 @@ public class SiteXMLAction extends AbstractPublisherAction { } private Map<SiteIU, Set<SiteCategory>> getIUToCategoryMappings(IPublisherInfo publisherInfo) { - HashMap<SiteIU, Set<SiteCategory>> mappings = new HashMap<SiteIU, Set<SiteCategory>>(); + HashMap<SiteIU, Set<SiteCategory>> mappings = new HashMap<>(); if (updateSite == null) return mappings; SiteModel site = updateSite.getSite(); @@ -250,7 +251,7 @@ public class SiteXMLAction extends AbstractPublisherAction { for (int i = 0; i < ius.length; i++) { //add a mapping for each category this feature belongs to String[] categoryNames = ius[i].getCategoryNames(); - Set<SiteCategory> categories = new HashSet<SiteCategory>(); + Set<SiteCategory> categories = new HashSet<>(); mappings.put(ius[i], categories); for (int j = 0; j < categoryNames.length; j++) { SiteCategory category = site.getCategory(categoryNames[j]); @@ -392,7 +393,7 @@ public class SiteXMLAction extends AbstractPublisherAction { * @return A map of SiteFeature -> Set<SiteCategory>. */ protected Map<SiteFeature, Set<SiteCategory>> getFeatureToCategoryMappings(IPublisherInfo publisherInfo) { - HashMap<SiteFeature, Set<SiteCategory>> mappings = new HashMap<SiteFeature, Set<SiteCategory>>(); + HashMap<SiteFeature, Set<SiteCategory>> mappings = new HashMap<>(); if (updateSite == null) return mappings; SiteModel site = updateSite.getSite(); @@ -405,7 +406,7 @@ public class SiteXMLAction extends AbstractPublisherAction { String[] categoryNames = features[i].getCategoryNames(); Set<SiteCategory> categories = mappings.get(features[i]); if (categories == null) { - categories = new HashSet<SiteCategory>(); + categories = new HashSet<>(); mappings.put(features[i], categories); } for (int j = 0; j < categoryNames.length; j++) { @@ -423,7 +424,7 @@ public class SiteXMLAction extends AbstractPublisherAction { * @return A map of SiteBundle -> Set<SiteCategory>. */ protected Map<SiteBundle, Set<SiteCategory>> getBundleToCategoryMappings(IPublisherInfo publisherInfo) { - HashMap<SiteBundle, Set<SiteCategory>> mappings = new HashMap<SiteBundle, Set<SiteCategory>>(); + HashMap<SiteBundle, Set<SiteCategory>> mappings = new HashMap<>(); if (updateSite == null) return mappings; SiteModel site = updateSite.getSite(); @@ -434,7 +435,7 @@ public class SiteXMLAction extends AbstractPublisherAction { for (int i = 0; i < bundles.length; i++) { //add a mapping for each category this feature belongs to String[] categoryNames = bundles[i].getCategoryNames(); - Set<SiteCategory> categories = new HashSet<SiteCategory>(); + Set<SiteCategory> categories = new HashSet<>(); mappings.put(bundles[i], categories); for (int j = 0; j < categoryNames.length; j++) { SiteCategory category = site.getCategory(categoryNames[j]); @@ -467,7 +468,7 @@ public class SiteXMLAction extends AbstractPublisherAction { //publish associate sites as repository references URLEntry[] associatedSites = site.getAssociatedSites(); if (associatedSites != null) { - ArrayList<IRepositoryReference> refs = new ArrayList<IRepositoryReference>(associatedSites.length * 2); + ArrayList<IRepositoryReference> refs = new ArrayList<>(associatedSites.length * 2); for (int i = 0; i < associatedSites.length; i++) { URLEntry associatedSite = associatedSites[i]; String siteLocation = associatedSite.getURL(); @@ -487,7 +488,7 @@ public class SiteXMLAction extends AbstractPublisherAction { //publish repository references from category file IRepositoryReference[] refs = site.getRepositoryReferences(); if (refs != null) { - ArrayList<IRepositoryReference> toAdd = new ArrayList<IRepositoryReference>(Arrays.asList(refs)); + ArrayList<IRepositoryReference> toAdd = new ArrayList<>(Arrays.asList(refs)); publisherInfo.getMetadataRepository().addReferences(toAdd); } @@ -518,11 +519,11 @@ public class SiteXMLAction extends AbstractPublisherAction { * @param result The generator result being built */ protected void generateCategoryIUs(Map<SiteCategory, Set<IInstallableUnit>> categoriesToIUs, IPublisherResult result) { - Map<String, SiteCategory> nameToCategory = new HashMap<String, SiteCategory>(); + Map<String, SiteCategory> nameToCategory = new HashMap<>(); for (SiteCategory category : this.updateSite.getSite().getCategories()) { nameToCategory.put(category.getName(), category); } - final Map<SiteCategory, Set<SiteCategory>> categoryToNestedCategories = new HashMap<SiteCategory, Set<SiteCategory>>(); + final Map<SiteCategory, Set<SiteCategory>> categoryToNestedCategories = new HashMap<>(); for (SiteCategory category : this.updateSite.getSite().getCategories()) { for (String parentCategoryName : category.getCategoryNames()) { SiteCategory parentCategory = nameToCategory.get(parentCategoryName); @@ -533,11 +534,12 @@ public class SiteXMLAction extends AbstractPublisherAction { } } - List<SiteCategory> categories = new ArrayList<SiteCategory>(Arrays.asList(this.updateSite.getSite().getCategories())); + List<SiteCategory> categories = new ArrayList<>(Arrays.asList(this.updateSite.getSite().getCategories())); categories.add(this.defaultCategory); // sort category so they are processed in reverse order of dependency // (Nested categories go first) Comparator<SiteCategory> isNestedCategoryComparator = new Comparator<SiteCategory>() { + @Override public int compare(SiteCategory category1, SiteCategory category2) { Set<SiteCategory> childrenOfCategory1 = categoryToNestedCategories.get(category1); Set<SiteCategory> childrenOfCategory2 = categoryToNestedCategories.get(category2); @@ -572,11 +574,11 @@ public class SiteXMLAction extends AbstractPublisherAction { Collections.sort(categories, isNestedCategoryComparator); // Then create categories in the right order - Map<String, IInstallableUnit> nameToCategoryIU = new HashMap<String, IInstallableUnit>(); + Map<String, IInstallableUnit> nameToCategoryIU = new HashMap<>(); for (SiteCategory category : categories) { Set<IInstallableUnit> units = categoriesToIUs.get(category); if (units == null) { - units = new HashSet<IInstallableUnit>(); + units = new HashSet<>(); } Set<SiteCategory> nestedCategories = categoryToNestedCategories.get(category); if (nestedCategories != null) { @@ -605,7 +607,7 @@ public class SiteXMLAction extends AbstractPublisherAction { */ @Deprecated public IInstallableUnit createCategoryIU(SiteCategory category, Set<IInstallableUnit> childrenIUs, IInstallableUnit nestedCategory) { - Set<IInstallableUnit> allIUs = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> allIUs = new HashSet<>(); if (childrenIUs != null) { allIUs.addAll(childrenIUs); } @@ -645,7 +647,7 @@ public class SiteXMLAction extends AbstractPublisherAction { cat.setProperty(IInstallableUnit.PROP_NAME, label != null ? label : category.getName()); cat.setProperty(IInstallableUnit.PROP_DESCRIPTION, category.getDescription()); - ArrayList<IRequirement> reqsConfigurationUnits = new ArrayList<IRequirement>(childrenIUs.size()); + ArrayList<IRequirement> reqsConfigurationUnits = new ArrayList<>(childrenIUs.size()); for (IInstallableUnit iu : childrenIUs) { VersionRange range = new VersionRange(iu.getVersion(), true, iu.getVersion(), true); reqsConfigurationUnits.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, iu.getId(), range, iu.getFilter(), false, false)); @@ -653,7 +655,7 @@ public class SiteXMLAction extends AbstractPublisherAction { cat.setRequirements(reqsConfigurationUnits.toArray(new IRequirement[reqsConfigurationUnits.size()])); // Create set of provided capabilities - ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(); + ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(); providedCapabilities.add(PublisherHelper.createSelfCapability(categoryId, cat.getVersion())); Map<Locale, Map<String, String>> localizations = category.getLocalizations(); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java index ba5bae281..9d96f4664 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 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 @@ -51,13 +51,13 @@ public class UpdateSite { * Some variables for caching. */ // map of String (URI.toString()) to UpdateSite - private static Map<String, SoftReference<UpdateSite>> siteCache = new HashMap<String, SoftReference<UpdateSite>>(); + private static Map<String, SoftReference<UpdateSite>> siteCache = new HashMap<>(); // map of String (URI.toString()) to UpdateSite (for category xmls) - private static Map<String, SoftReference<UpdateSite>> categoryCache = new HashMap<String, SoftReference<UpdateSite>>(); + private static Map<String, SoftReference<UpdateSite>> categoryCache = new HashMap<>(); // map of String (featureID_featureVersion) to Feature - private Map<String, Feature> featureCache = new HashMap<String, Feature>(); + private Map<String, Feature> featureCache = new HashMap<>(); // map of String (bundleID_featureVersion) to BundleDescriptr - private Map<String, BundleDescription> bundleCache = new HashMap<String, BundleDescription>(); + private Map<String, BundleDescription> bundleCache = new HashMap<>(); private Transport transport; /* @@ -106,7 +106,7 @@ public class UpdateSite { String checksumString = Long.toString(checksum.getValue()); result = new UpdateSite(siteModel, location, transport, checksumString); if (!PROTOCOL_FILE.equals(location.getScheme())) - categoryCache.put(location.toString(), new SoftReference<UpdateSite>(result)); + categoryCache.put(location.toString(), new SoftReference<>(result)); return result; } catch (SAXException e) { String msg = NLS.bind(Messages.ErrorReadingSite, location); @@ -153,7 +153,7 @@ public class UpdateSite { String checksumString = Long.toString(checksum.getValue()); result = new UpdateSite(siteModel, getSiteURI(location), transport, checksumString); if (!PROTOCOL_FILE.equals(location.getScheme())) - siteCache.put(location.toString(), new SoftReference<UpdateSite>(result)); + siteCache.put(location.toString(), new SoftReference<>(result)); return result; } catch (SAXException e) { String msg = NLS.bind(Messages.ErrorReadingSite, location); @@ -520,7 +520,7 @@ public class UpdateSite { Feature[] features = new DigestParser().parse(digestFile, digestURI); if (features == null) return null; - Map<String, Feature> tmpFeatureCache = new HashMap<String, Feature>(features.length); + Map<String, Feature> tmpFeatureCache = new HashMap<>(features.length); for (int i = 0; i < features.length; i++) { String key = features[i].getId() + VERSION_SEPARATOR + features[i].getVersion(); tmpFeatureCache.put(key, features[i]); @@ -561,7 +561,7 @@ public class UpdateSite { private Feature[] loadFeaturesFromSite(IProgressMonitor monitor) throws ProvisionException { SiteFeature[] siteFeatures = site.getFeatures(); FeatureParser featureParser = new FeatureParser(); - Map<String, Feature> tmpFeatureCache = new HashMap<String, Feature>(siteFeatures.length); + Map<String, Feature> tmpFeatureCache = new HashMap<>(siteFeatures.length); for (int i = 0; i < siteFeatures.length; i++) { if (monitor.isCanceled()) { @@ -624,7 +624,7 @@ public class UpdateSite { */ private BundleDescription[] loadBundlesFromSite(IProgressMonitor monitor) { SiteBundle[] siteBundles = site.getBundles(); - Map<String, BundleDescription> tmpBundleCache = new HashMap<String, BundleDescription>(siteBundles.length); + Map<String, BundleDescription> tmpBundleCache = new HashMap<>(siteBundles.length); for (int i = 0; i < siteBundles.length; i++) { if (monitor.isCanceled()) { diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSitePublisherApplication.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSitePublisherApplication.java index 928fdaf51..5578dd0dd 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSitePublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSitePublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This + * Copyright (c) 2008, 2017 Code 9 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 @@ -28,6 +28,7 @@ public class UpdateSitePublisherApplication extends AbstractPublisherApplication // nothing todo } + @Override protected void processParameter(String arg, String parameter, PublisherInfo pinfo) throws URISyntaxException { super.processParameter(arg, parameter, pinfo); @@ -38,6 +39,7 @@ public class UpdateSitePublisherApplication extends AbstractPublisherApplication categoryVersion = parameter; } + @Override protected IPublisherAction[] createActions() { LocalUpdateSiteAction action = new LocalUpdateSiteAction(source, categoryQualifier); action.setCategoryVersion(categoryVersion); @@ -53,6 +55,7 @@ public class UpdateSitePublisherApplication extends AbstractPublisherApplication /** * Detect the flag -addJREIU to turn on the generation of the JREIU. */ + @Override protected void processFlag(String flag, PublisherInfo publisherInfo) { super.processFlag(flag, publisherInfo); if (flag.equalsIgnoreCase("-addJREIU"))//$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/VersionSuffixGenerator.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/VersionSuffixGenerator.java index 788701d8c..51ee51179 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/VersionSuffixGenerator.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/VersionSuffixGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -183,7 +183,7 @@ public class VersionSuffixGenerator { // changes. // majorSum += QUALIFIER_SUFFIX_VERSION; - ArrayList<String> qualifiers = new ArrayList<String>(); + ArrayList<String> qualifiers = new ArrayList<>(); // Loop through the included features, adding the version number parts // to the running totals and storing the qualifier suffixes. diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java index 31d2cea5e..749a67c79 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 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 @@ -37,134 +37,165 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository { this.delegate = repository; } + @Override public void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void addDescriptor(IArtifactDescriptor descriptor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void addDescriptors(IArtifactDescriptor[] descriptors) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public boolean contains(IArtifactDescriptor descriptor) { return delegate.contains(descriptor); } + @Override public boolean contains(IArtifactKey key) { return delegate.contains(key); } + @Override public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return delegate.getArtifact(descriptor, destination, monitor); } + @Override public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) { return delegate.getArtifactDescriptors(key); } + @Override public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) { return delegate.getArtifacts(requests, monitor); } + @Override public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException { // TODO Auto-generated method stub return null; } + @Override public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return delegate.getRawArtifact(descriptor, destination, monitor); } + @Override public void removeAll(IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void removeAll() { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void removeDescriptor(IArtifactDescriptor descriptor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void removeDescriptors(IArtifactDescriptor[] descriptors) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void removeDescriptor(IArtifactKey key) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override @Deprecated public void removeDescriptors(IArtifactKey[] keys) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public String getDescription() { return delegate.getDescription(); } + @Override public URI getLocation() { return this.location; } + @Override public String getName() { return delegate.getName(); } + @Override public Map<String, String> getProperties() { return delegate.getProperties(); } + @Override public String getProperty(String key) { return delegate.getProperty(key); } + @Override public String getProvider() { return delegate.getProvider(); } + @Override public IProvisioningAgent getProvisioningAgent() { return delegate.getProvisioningAgent(); } + @Override public String getType() { return TYPE; } + @Override public String getVersion() { return VERSION; } + @Override public boolean isModifiable() { return false; } @@ -177,10 +208,12 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public String setProperty(String key, String value, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public String setProperty(String key, String value) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } @@ -189,26 +222,32 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public <T> T getAdapter(Class<T> adapter) { return delegate.getAdapter(adapter); } + @Override public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key) { return delegate.createArtifactDescriptor(key); } + @Override public IArtifactKey createArtifactKey(String classifier, String id, Version version) { return delegate.createArtifactKey(classifier, id, version); } + @Override public IQueryable<IArtifactDescriptor> descriptorQueryable() { return delegate.descriptorQueryable(); } + @Override public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) { return delegate.query(query, monitor); } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { return delegate.executeBatch(runnable, monitor); } diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java index 100046f35..d9782f081 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepositoryFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 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 @@ -33,9 +33,7 @@ import org.eclipse.osgi.util.NLS; public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFactory { - /* (non-Javadoc) - * @see org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map) - */ + @Override public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) { return null; } @@ -45,9 +43,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto private static final String PROP_SITE_CHECKSUM = "site.checksum"; //$NON-NLS-1$ private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$ - /* (non-Javadoc) - * @see org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory#load(java.net.URL, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException { //return null if the caller wanted a modifiable repo if ((flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0) { @@ -115,7 +111,7 @@ public class UpdateSiteArtifactRepositoryFactory extends ArtifactRepositoryFacto private void generateArtifactDescriptors(UpdateSite updateSite, IArtifactRepository repository, IProgressMonitor monitor) throws ProvisionException { final String PACK_EXT = ".pack.gz"; //$NON-NLS-1$ - Set<IArtifactDescriptor> allSiteArtifacts = new HashSet<IArtifactDescriptor>(); + Set<IArtifactDescriptor> allSiteArtifacts = new HashSet<>(); boolean packSupported = updateSite.getSite().isPack200Supported(); { Feature[] features = updateSite.loadFeatures(monitor); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java index e4bcb0130..e21efdefc 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 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 @@ -43,30 +43,22 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addInstallableUnits(java.util.Collection) - */ + @Override public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#addReferences(java.util.Collection) - */ + @Override public void addReferences(Collection<? extends IRepositoryReference> references) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#getReferences() - */ + @Override public Collection<IRepositoryReference> getReferences() { return delegate.getReferences(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeAll() - */ + @Override public void removeAll() { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } @@ -76,136 +68,99 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#removeInstallableUnits(java.util.Collection) - */ + @Override public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getDescription() - */ + @Override public String getDescription() { return delegate.getDescription(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getLocation() - */ + @Override public URI getLocation() { return location; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getName() - */ + @Override public String getName() { return delegate.getName(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getProperties() - */ + @Override public Map<String, String> getProperties() { return delegate.getProperties(); } + @Override public String getProperty(String key) { return delegate.getProperty(key); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getProvider() - */ + @Override public String getProvider() { return delegate.getProvider(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getProvisioningAgent() - */ + @Override public IProvisioningAgent getProvisioningAgent() { return delegate.getProvisioningAgent(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getType() - */ + @Override public String getType() { return TYPE; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#getVersion() - */ + @Override public String getVersion() { return VERSION; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#isModifiable() - */ + @Override public boolean isModifiable() { return false; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#setDescription(java.lang.String) - */ public void setDescription(String description) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#setName(java.lang.String) - */ public void setName(String name) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#setProperty(java.lang.String, java.lang.String) - */ + @Override public String setProperty(String key, String value, IProgressMonitor monitor) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#setProperty(java.lang.String, java.lang.String) - */ + @Override public String setProperty(String key, String value) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.IRepository#setProvider(java.lang.String) - */ public void setProvider(String provider) { throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$ } + @Override public <T> T getAdapter(Class<T> adapter) { return delegate.getAdapter(adapter); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { return delegate.query(query, monitor); } - /** - * {@inheritDoc} - */ + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { return delegate.executeBatch(runnable, monitor); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#compress(IPool<IInstallableUnit> iuPool) - */ + @Override public void compress(IPool<IInstallableUnit> iuPool) { delegate.compress(iuPool); } diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java index d3142217a..dcf5c3d1c 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepositoryFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 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 @@ -38,13 +38,12 @@ public class UpdateSiteMetadataRepositoryFactory extends MetadataRepositoryFacto return stateDir.toURI(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map) - */ + @Override public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) { return null; } + @Override public IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException { //return null if the caller wanted a modifiable repo if ((flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0) { |