diff options
author | Alexander Kurtakov | 2017-08-18 14:07:19 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-08-18 19:19:54 +0000 |
commit | 56284608e960d37831deab796372604aa40b7771 (patch) | |
tree | 2676b93d7fd22b55eac47ad3a03caa1b5a1c02c3 | |
parent | a348349ea5b00131465c536b1a324326b0c9b9c5 (diff) | |
download | rt.equinox.p2-56284608e960d37831deab796372604aa40b7771.tar.gz rt.equinox.p2-56284608e960d37831deab796372604aa40b7771.tar.xz rt.equinox.p2-56284608e960d37831deab796372604aa40b7771.zip |
Bug 521121 - Move p2 publisher.eclipse to Java 8I20170819-1500I20170818-2000
Bump minor version, remove duplicate type declarations, add missing
override/deprecated annotations.
Change-Id: I9ab3e7bcdf76e8d359d8fb3da1d27d3fcc4673b7
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
40 files changed, 255 insertions, 168 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.classpath b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.classpath index c8fe84b9d..030607499 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.classpath +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.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/JavaSE-1.6"/> + <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="src" output="bin_ant" path="src_ant"/> diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs index 3cf18524e..eb0731798 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/.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.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +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=ignore 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=warning @@ -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=warning -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=enabled +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=warning @@ -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.6 +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.publisher.eclipse/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF index 3b28e9fed..ffb2caa61 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.publisher.eclipse;singleton:=true -Bundle-Version: 1.2.200.qualifier +Bundle-Version: 1.3.0.qualifier Bundle-Activator: org.eclipse.pde.internal.publishing.Activator Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: org.eclipse.equinox.app;version="[1.0.0,2.0.0)", org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", org.eclipse.equinox.internal.frameworkadmin.equinox, diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml b/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml index 57a69def0..15c45eb37 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/pom.xml @@ -10,6 +10,6 @@ <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.publisher.eclipse</artifactId> - <version>1.2.200-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java index 27681d440..ebee06289 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/compatibility/GeneratorApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 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 @@ -31,10 +31,12 @@ public class GeneratorApplication implements IApplication { public static final String INSTALL_APPLICATION = "org.eclipse.equinox.p2.publisher.InstallPublisher"; //$NON-NLS-1$ public static final String FEATURES_BUNDLES_APPLICATION = "org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher"; //$NON-NLS-1$ + @Override public Object start(IApplicationContext context) throws Exception { return run((String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS)); } + @Override public void stop() { // TODO Auto-generated method stub } @@ -62,8 +64,8 @@ public class GeneratorApplication implements IApplication { } private Map<String, Object> parseArguments(String[] arguments) { - Map<String, Object> applicationMap = new HashMap<String, Object>(); - Map<String, String> args = new HashMap<String, String>(arguments.length); + Map<String, Object> applicationMap = new HashMap<>(); + Map<String, String> args = new HashMap<>(arguments.length); for (int i = 0; i < arguments.length; i++) { if (i == arguments.length - 1 || arguments[i + 1].startsWith(IGeneratorConstants.DASH)) args.put(arguments[i], null); @@ -125,7 +127,7 @@ public class GeneratorApplication implements IApplication { } private String[] flattenMap(Map<String, String> map) { - ArrayList<String> list = new ArrayList<String>(map.size()); + ArrayList<String> list = new ArrayList<>(map.size()); for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext();) { String key = iterator.next(); String value = map.get(key); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java index 77fb4bdb5..e0554d3c6 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ExecutablesDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 EclipseSource and others. + * Copyright (c) 2008, 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 @@ -111,6 +111,7 @@ public class ExecutablesDescriptor { private static ExecutablesDescriptor createMacDescriptor(String os, String executable, File location) { File files[] = location.listFiles(new FilenameFilter() { + @Override public boolean accept(File dir, String name) { int length = name.length(); return length > 3 && name.substring(length - 4, length).equalsIgnoreCase(".app"); //$NON-NLS-1$ @@ -126,9 +127,9 @@ public class ExecutablesDescriptor { this.executableName = executable; this.location = location; if (files == null) - this.files = new HashSet<File>(11); + this.files = new HashSet<>(11); else { - this.files = new HashSet<File>(files.length); + this.files = new HashSet<>(files.length); for (int i = 0; i < files.length; i++) addAllFiles(files[i]); } @@ -139,7 +140,7 @@ public class ExecutablesDescriptor { this.location = descriptor.location; this.executableName = descriptor.executableName; this.temporary = descriptor.temporary; - this.files = new HashSet<File>(descriptor.files); + this.files = new HashSet<>(descriptor.files); } public void addAllFiles(File file) { @@ -246,7 +247,7 @@ public class ExecutablesDescriptor { String targetExecutable = executableName; String executableExtension = Constants.OS_WIN32.equals(os) ? ".exe" : ""; //$NON-NLS-1$ //$NON-NLS-2$ targetExecutable = executableName + executableExtension; - Set<File> filesCopy = new HashSet<File>(files); + Set<File> filesCopy = new HashSet<>(files); for (File file : filesCopy) { String base = file.getParent(); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java index 30fa51335..a7e0e7281 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/FeatureManifestParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 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 @@ -41,7 +41,7 @@ public class FeatureManifestParser extends DefaultHandler { private MultiStatus status = null; private boolean hasImports = false; - private final List<String> messageKeys = new ArrayList<String>(); + private final List<String> messageKeys = new ArrayList<>(); public FeatureManifestParser() { this(true); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/GeneratorBundleInfo.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/GeneratorBundleInfo.java index d68c0007f..9d9a4c849 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/GeneratorBundleInfo.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/GeneratorBundleInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 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 @@ -57,9 +57,7 @@ public class GeneratorBundleInfo extends BundleInfo { this.specialUnconfigCommands = specialUnconfigCommands; } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer buffer = new StringBuffer(); String superSt = super.toString(); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/InfoPListEditor.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/InfoPListEditor.java index 9599eb27c..03cd645f4 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/InfoPListEditor.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/InfoPListEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 Rapicorp, Inc and others. + * Copyright (c) 2015, 2017 Rapicorp, 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 @@ -147,7 +147,7 @@ public class InfoPListEditor { private List<String> getValues(Object startingPoint, String expression) throws XPathExpressionException { NodeList nodeList = (NodeList) getXPathTool().evaluate(expression, startingPoint, XPathConstants.NODESET); - List<String> result = new ArrayList<String>(nodeList.getLength()); + List<String> result = new ArrayList<>(nodeList.getLength()); for (int ix = 0; ix < nodeList.getLength(); ++ix) { result.add(nodeList.item(ix).getNodeValue()); } @@ -157,7 +157,7 @@ public class InfoPListEditor { private List<Node> removeNodes(Object startingPoint, String expression) throws XPathExpressionException { NodeList nodeList = (NodeList) getXPathTool().evaluate(expression, startingPoint, XPathConstants.NODESET); - List<Node> result = new ArrayList<Node>(nodeList.getLength()); + List<Node> result = new ArrayList<>(nodeList.getLength()); for (int ix = 0; ix < nodeList.getLength(); ++ix) { result.add(nodeList.item(ix).getParentNode().removeChild(nodeList.item(ix))); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductContentType.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductContentType.java index d8be6e9d9..1ae083d45 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductContentType.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductContentType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 SAP AG and others. + * Copyright (c) 2011, 2017 SAP AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ public enum ProductContentType { MIXED("mixed"); // all kinds of installable units are accepted in the product //$NON-NLS-1$ private String contentTypeString; - private static Map<String, ProductContentType> mappings = new HashMap<String, ProductContentType>(); + private static Map<String, ProductContentType> mappings = new HashMap<>(); static { mappings.put("bundles", BUNDLES); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java index 2f89f0460..1fc305cba 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 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 @@ -174,18 +174,18 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { private SAXParser parser; private String launcherName = null; // private boolean useIco = false; - private final Map<String, Collection<String>> icons = new HashMap<String, Collection<String>>(6); + private final Map<String, Collection<String>> icons = new HashMap<>(6); private String configPath = null; - private final Map<String, String> platformSpecificConfigPaths = new HashMap<String, String>(); + private final Map<String, String> platformSpecificConfigPaths = new HashMap<>(); private String configPlatform = null; private String platformConfigPath = null; private String id = null; private String uid = null; private ProductContentType productContentType = null; - protected List<FeatureEntry> plugins = new ArrayList<FeatureEntry>(); - protected List<FeatureEntry> fragments = new ArrayList<FeatureEntry>(); - private final List<FeatureEntry> features = new ArrayList<FeatureEntry>(); - private final List<FeatureEntry> rootFeatures = new ArrayList<FeatureEntry>(); + protected List<FeatureEntry> plugins = new ArrayList<>(); + protected List<FeatureEntry> fragments = new ArrayList<>(); + private final List<FeatureEntry> features = new ArrayList<>(); + private final List<FeatureEntry> rootFeatures = new ArrayList<>(); private String splashLocation = null; private String productName = null; private String application = null; @@ -199,7 +199,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { private String licenseURL; private String licenseText = null; private String currentOS; - private final List<IRepositoryReference> repositories = new ArrayList<IRepositoryReference>(); + private final List<IRepositoryReference> repositories = new ArrayList<>(); private static String normalize(String text) { if (text == null || text.trim().length() == 0) @@ -271,6 +271,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Gets the name of the launcher specified in the .product file. */ + @Override public String getLauncherName() { return launcherName; } @@ -278,6 +279,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Gets the location of the .product file. */ + @Override public File getLocation() { return location; } @@ -286,6 +288,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * Returns the properties found in .product file. Properties * are located in the <configurations> block of the file */ + @Override public Map<String, String> getConfigurationProperties() { return getConfigurationProperties(null, null); } @@ -297,9 +300,10 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * that are not filtered by the unspecified os and/or arch. * Properties are located in the <configurations> block of the file */ + @Override public Map<String, String> getConfigurationProperties(String os, String arch) { // add all generic properties - Map<String, String> result = properties != null ? properties : new HashMap<String, String>(); + Map<String, String> result = properties != null ? properties : new HashMap<>(); // add any properties filtered on os and/or arch if (filteredProperties != null) { String[] filteredKeys = new String[3]; // ".arch", "os.", "os.arch" @@ -346,8 +350,9 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * @param includeFragments Indicates whether or not fragments should * be included in the list */ + @Override public List<IVersionedId> getBundles(boolean includeFragments) { - List<IVersionedId> result = new LinkedList<IVersionedId>(); + List<IVersionedId> result = new LinkedList<>(); for (FeatureEntry plugin : plugins) { result.add(new VersionedId(plugin.getId(), plugin.getVersion())); @@ -362,13 +367,14 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { return result; } + @Override public boolean hasBundles(boolean includeFragments) { // implement directly; don't call the potentially overridden getBundles return !plugins.isEmpty() || (includeFragments && !fragments.isEmpty()); } private List<FeatureEntry> getBundleEntries(boolean includeFragments) { - List<FeatureEntry> result = new LinkedList<FeatureEntry>(); + List<FeatureEntry> result = new LinkedList<>(); result.addAll(plugins); if (includeFragments) result.addAll(fragments); @@ -380,6 +386,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * in the product file. * @return A List<BundleInfo> */ + @Override public List<BundleInfo> getBundleInfos() { return bundleInfos != null ? bundleInfos : Collections.<BundleInfo> emptyList(); } @@ -387,8 +394,9 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns a list<VersionedName> of fragments that constitute this product. */ + @Override public List<IVersionedId> getFragments() { - List<IVersionedId> result = new LinkedList<IVersionedId>(); + List<IVersionedId> result = new LinkedList<>(); for (FeatureEntry fragment : fragments) { result.add(new VersionedId(fragment.getId(), fragment.getVersion())); @@ -400,17 +408,20 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns a List<VersionedName> of features that constitute this product. */ + @Override public List<IVersionedId> getFeatures() { return getFeatures(INCLUDED_FEATURES); } + @Override public boolean hasFeatures() { // implement directly; don't call the potentially overridden getFeatures return !features.isEmpty(); } + @Override public List<IVersionedId> getFeatures(int options) { - List<IVersionedId> result = new LinkedList<IVersionedId>(); + List<IVersionedId> result = new LinkedList<>(); if ((options & INCLUDED_FEATURES) != 0) { for (FeatureEntry feature : features) { @@ -447,6 +458,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { return getIcons(currentOS); } + @Override public String[] getIcons(String os) { Collection<String> result = icons.get(os); if (result == null) @@ -454,6 +466,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { return result.toArray(new String[result.size()]); } + @Override public String getConfigIniPath(String os) { String specific = platformSpecificConfigPaths.get(os); return specific == null ? configPath : specific; @@ -470,12 +483,14 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns the ID for this product. */ + @Override public String getId() { if (uid != null) return uid; return id; } + @Override public String getProductId() { return id; } @@ -483,6 +498,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns the location (the bundle) that defines the splash screen */ + @Override public String getSplashLocation() { return splashLocation; } @@ -490,6 +506,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns the product name. */ + @Override public String getProductName() { return productName; } @@ -497,6 +514,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns the application identifier for this product. */ + @Override public String getApplication() { return application; } @@ -505,6 +523,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * Returns true if this product is built using feature, * false otherwise. */ + @Override public boolean useFeatures() { return productContentType == ProductContentType.FEATURES; } @@ -512,16 +531,18 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { /** * Returns the version of the product */ + @Override public String getVersion() { return (version == null || version.length() == 0) ? "0.0.0" : version; //$NON-NLS-1$ } + @Override public boolean includeLaunchers() { return includeLaunchers; } public Map<String, BundleInfo> getConfigurationInfo() { - Map<String, BundleInfo> result = new HashMap<String, BundleInfo>(); + Map<String, BundleInfo> result = new HashMap<>(); for (BundleInfo info : getBundleInfos()) { result.put(info.getSymbolicName(), info); } @@ -541,6 +562,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * If the empty string is used for the OS, this returns * the default VM arguments */ + @Override public String getVMArguments(String os) { return getVMArguments(os, null); } @@ -551,6 +573,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * returns the default arguments for the platform. If the empty string is * used for the OS, this returns the default VM arguments. */ + @Override public String getVMArguments(String os, String arch) { os = os == null ? "" : os; //$NON-NLS-1$ String key = null; @@ -621,6 +644,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * If the empty string is used for the OS, this returns * the default program arguments */ + @Override public String getProgramArguments(String os) { return getProgramArguments(os, null); } @@ -630,6 +654,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { * If the empty string is used for the OS, this returns * the default program arguments */ + @Override public String getProgramArguments(String os, String arch) { os = os == null ? "" : os; //$NON-NLS-1$ String key = null; @@ -695,14 +720,17 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { return normalize(args); } + @Override public String getLicenseText() { return licenseText; } + @Override public String getLicenseURL() { return licenseURL; } + @Override public List<IRepositoryReference> getRepositoryEntries() { return repositories; } @@ -916,15 +944,15 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { if (propOSArchKey.length() <= 1) { // this is a generic property for all platforms and arch if (properties == null) - properties = new HashMap<String, String>(); + properties = new HashMap<>(); properties.put(name, value); } else { // store the property in the filtered map, keyed by "os.arch" if (filteredProperties == null) - filteredProperties = new HashMap<String, HashMap<String, String>>(); + filteredProperties = new HashMap<>(); HashMap<String, String> filteredMap = filteredProperties.get(propOSArchKey); if (filteredMap == null) { - filteredMap = new HashMap<String, String>(); + filteredMap = new HashMap<>(); filteredProperties.put(propOSArchKey, filteredMap); } filteredMap.put(name, value); @@ -945,7 +973,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { if (value != null) info.setMarkedAsStarted(Boolean.parseBoolean(value)); if (bundleInfos == null) - bundleInfos = new ArrayList<BundleInfo>(); + bundleInfos = new ArrayList<>(); bundleInfos.add(info); } @@ -1211,7 +1239,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { Collection<String> list = icons.get(os); if (list == null) { - list = new ArrayList<String>(6); + list = new ArrayList<>(6); icons.put(os, list); } list.add(iconFile.getAbsolutePath()); @@ -1251,6 +1279,7 @@ public class ProductFile extends DefaultHandler implements IProductDescriptor { addIcon(OS_MACOSX, attributes.getValue(ATTRIBUTE_ICON)); } + @Override public ProductContentType getProductContentType() { return productContentType; } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/AccumulateConfigDataAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/AccumulateConfigDataAction.java index d63f6eab1..68fe79d04 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/AccumulateConfigDataAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/AccumulateConfigDataAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -19,14 +19,15 @@ import org.eclipse.equinox.p2.publisher.*; public class AccumulateConfigDataAction extends AbstractPublisherAction { - private String configSpec; - private DataLoader loader; + private final String configSpec; + private final DataLoader loader; public AccumulateConfigDataAction(IPublisherInfo info, String configSpec, File configurationLocation, File executableLocation) { this.configSpec = configSpec; loader = new DataLoader(configurationLocation, executableLocation); } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { storeConfigData(publisherInfo, configSpec, results); return Status.OK_STATUS; diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java index 9ee9acf7f..4ed55747e 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ApplicationLauncherAction.java @@ -103,7 +103,7 @@ public class ApplicationLauncherAction extends AbstractPublisherAction { } private Collection<IInstallableUnit> getIUs(Collection<IInstallableUnit> ius, String prefix) { - Set<IInstallableUnit> result = new HashSet<IInstallableUnit>(); + Set<IInstallableUnit> result = new HashSet<>(); for (IInstallableUnit tmp : ius) { if (tmp.getId().startsWith(prefix)) result.add(tmp); @@ -121,14 +121,14 @@ public class ApplicationLauncherAction extends AbstractPublisherAction { } private Collection<IPublisherAction> createActions(IPublisherInfo publisherInfo) { - Collection<IPublisherAction> actions = new ArrayList<IPublisherAction>(); + Collection<IPublisherAction> actions = new ArrayList<>(); actions.add(new EquinoxLauncherCUAction(flavor, configSpecs)); actions.addAll(createExecutablesActions(configSpecs)); return actions; } protected Collection<IPublisherAction> createExecutablesActions(String[] configs) { - Collection<IPublisherAction> actions = new ArrayList<IPublisherAction>(configs.length); + Collection<IPublisherAction> actions = new ArrayList<>(configs.length); for (int i = 0; i < configs.length; i++) { ExecutablesDescriptor executables = computeExecutables(configs[i]); IPublisherAction action = new EquinoxExecutableAction(executables, configs[i], id, version, flavor); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundleShapeAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundleShapeAdvice.java index 3b30f8e55..c33cac1b6 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundleShapeAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundleShapeAdvice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -14,9 +14,9 @@ import org.eclipse.equinox.p2.publisher.AbstractAdvice; public class BundleShapeAdvice extends AbstractAdvice implements IBundleShapeAdvice { - private String shape; - private Version version; - private String id; + private final String shape; + private final Version version; + private final String id; public BundleShapeAdvice(String id, Version version, String shape) { this.id = id; @@ -24,14 +24,17 @@ public class BundleShapeAdvice extends AbstractAdvice implements IBundleShapeAdv this.shape = shape; } + @Override protected String getId() { return id; } + @Override protected Version getVersion() { return version; } + @Override public String getShape() { return shape; } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java index d8b419a02..578f88961 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/BundlesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 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 @@ -140,7 +140,7 @@ public class BundlesAction extends AbstractPublisherAction { cu.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); cu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(configUnitId, cuVersion), MetadataFactory.createProvidedCapability(PublisherHelper.NAMESPACE_FLAVOR, configurationFlavor, Version.createOSGi(1, 0, 0))}); - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("uninstall", "uninstallBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("configure", createConfigScript(configInfo, isBundleFragment)); //$NON-NLS-1$ @@ -174,7 +174,7 @@ public class BundlesAction extends AbstractPublisherAction { // Process the required bundles BundleSpecification requiredBundles[] = bd.getRequiredBundles(); - ArrayList<IRequirement> reqsDeps = new ArrayList<IRequirement>(); + ArrayList<IRequirement> reqsDeps = new ArrayList<>(); // if (requiresAFragment) // reqsDeps.add(MetadataFactory.createRequiredCapability(CAPABILITY_TYPE_OSGI_FRAGMENTS, bd.getSymbolicName(), VersionRange.emptyRange, null, false, false)); if (isFragment) @@ -198,7 +198,7 @@ public class BundlesAction extends AbstractPublisherAction { iu.setRequirements(reqsDeps.toArray(new IRequirement[reqsDeps.size()])); // Create set of provided capabilities - ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(); + ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(); providedCapabilities.add(PublisherHelper.createSelfCapability(bd.getSymbolicName(), PublisherHelper.fromOSGiVersion(bd.getVersion()))); providedCapabilities.add(MetadataFactory.createProvidedCapability(CAPABILITY_NS_OSGI_BUNDLE, bd.getSymbolicName(), PublisherHelper.fromOSGiVersion(bd.getVersion()))); @@ -249,7 +249,7 @@ public class BundlesAction extends AbstractPublisherAction { // Define the immutable metadata for this IU. In this case immutable means // that this is something that will not impact the configuration. - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("manifest", toManifestString(manifest)); //$NON-NLS-1$ if (isDir(bd, info)) touchpointData.put("zipped", "true"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -319,7 +319,7 @@ public class BundlesAction extends AbstractPublisherAction { fragment.setProperty(InstallableUnitDescription.PROP_TYPE_FRAGMENT, Boolean.TRUE.toString()); // Create a provided capability for each locale and add the translated properties. - ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(hostLocalizations.keySet().size()); + ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(hostLocalizations.keySet().size()); providedCapabilities.add(PublisherHelper.createSelfCapability(fragmentId, fragment.getVersion())); for (Entry<Locale, Map<String, String>> localeEntry : hostLocalizations.entrySet()) { Locale locale = localeEntry.getKey(); @@ -380,7 +380,7 @@ public class BundlesAction extends AbstractPublisherAction { // Create a required capability on bundles IRequirement[] reqs = new IRequirement[] {MetadataFactory.createRequirement(PublisherHelper.NAMESPACE_ECLIPSE_TYPE, TYPE_ECLIPSE_BUNDLE, VersionRange.emptyRange, null, false, true, false)}; cu.setHost(reqs); - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("install", "installBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("uninstall", "uninstallBundle(bundle:${artifact})"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -765,7 +765,7 @@ public class BundlesAction extends AbstractPublisherAction { } private File[] expandLocations(File[] list) { - ArrayList<File> result = new ArrayList<File>(); + ArrayList<File> result = new ArrayList<>(); expandLocations(list, result); return result.toArray(new File[result.size()]); } @@ -892,7 +892,7 @@ public class BundlesAction extends AbstractPublisherAction { protected BundleDescription[] getBundleDescriptions(File[] bundleLocations, IProgressMonitor monitor) { if (bundleLocations == null) return new BundleDescription[0]; - List<BundleDescription> result = new ArrayList<BundleDescription>(bundleLocations.length); + List<BundleDescription> result = new ArrayList<>(bundleLocations.length); for (int i = 0; i < bundleLocations.length; i++) { if (monitor.isCanceled()) throw new OperationCanceledException(); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java index 446d70d0c..4e154a5d1 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigAdvice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 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 @@ -26,6 +26,7 @@ public class ConfigAdvice extends AbstractAdvice implements IConfigAdvice { this.configSpec = configSpec; } + @Override public BundleInfo[] getBundles() { return data.getBundles(); } @@ -35,6 +36,7 @@ public class ConfigAdvice extends AbstractAdvice implements IConfigAdvice { return configSpec; } + @Override public Map<String, String> getProperties() { return CollectionUtils.toMap(data.getProperties()); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java index c1ca73001..12e3abd6a 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java @@ -48,7 +48,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { // TODO consider moving this filtering to the LaunchingAdvice and ConfigAdvice so // it is not hardcoded in the action. static { - PROPERTIES_TO_SKIP = new HashSet<String>(); + PROPERTIES_TO_SKIP = new HashSet<>(); PROPERTIES_TO_SKIP.add("osgi.frameworkClassPath"); //$NON-NLS-1$ PROPERTIES_TO_SKIP.add("osgi.framework"); //$NON-NLS-1$ PROPERTIES_TO_SKIP.add("osgi.bundles"); //$NON-NLS-1$ @@ -58,7 +58,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { PROPERTIES_TO_SKIP.add("org.eclipse.update.reconcile"); //$NON-NLS-1$ PROPERTIES_TO_SKIP.add("org.eclipse.equinox.simpleconfigurator.configUrl"); //$NON-NLS-1$ - PROGRAM_ARGS_TO_SKIP = new HashSet<String>(); + PROGRAM_ARGS_TO_SKIP = new HashSet<>(); PROGRAM_ARGS_TO_SKIP.add("--launcher.library"); //$NON-NLS-1$ PROGRAM_ARGS_TO_SKIP.add("-startup"); //$NON-NLS-1$ PROGRAM_ARGS_TO_SKIP.add("-configuration"); //$NON-NLS-1$ @@ -125,7 +125,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { // there seem to be cases where the bundle infos are not filled in with symbolic name and version. // fill in the missing data. private BundleInfo[] fillInBundles(Collection<IConfigAdvice> configAdvice, IPublisherResult results) { - ArrayList<BundleInfo> result = new ArrayList<BundleInfo>(); + ArrayList<BundleInfo> result = new ArrayList<>(); for (IConfigAdvice advice : configAdvice) { int defaultStart = BundleInfo.NO_LEVEL; @@ -188,7 +188,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { if (configureData.length() == 0 && unconfigureData.length() == 0) return; - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("configure", configureData); //$NON-NLS-1$ touchpointData.put("unconfigure", unconfigureData); //$NON-NLS-1$ IInstallableUnit cu = createCU(id, version, "ini", flavor, configSpec, touchpointData); //$NON-NLS-1$ @@ -213,7 +213,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { if (configureData.length() == 0 && unconfigureData.length() == 0) return; - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("configure", configureData); //$NON-NLS-1$ touchpointData.put("unconfigure", unconfigureData); //$NON-NLS-1$ IInstallableUnit cu = createCU(id, version, "config", flavor, configSpec, touchpointData); //$NON-NLS-1$ @@ -245,13 +245,13 @@ public class ConfigCUsAction extends AbstractPublisherAction { protected String[] getConfigurationStrings(Collection<IConfigAdvice> configAdvice) { String configurationData = ""; //$NON-NLS-1$ String unconfigurationData = ""; //$NON-NLS-1$ - Set<String> properties = new HashSet<String>(); + Set<String> properties = new HashSet<>(); for (IConfigAdvice advice : configAdvice) { for (Entry<String, String> aProperty : advice.getProperties().entrySet()) { String key = aProperty.getKey(); if (shouldPublishProperty(key) && !properties.contains(key)) { properties.add(key); - Map<String, String> parameters = new LinkedHashMap<String, String>(); + Map<String, String> parameters = new LinkedHashMap<>(); parameters.put("propName", key); //$NON-NLS-1$ parameters.put("propValue", aProperty.getValue()); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("setProgramProperty", parameters); //$NON-NLS-1$ @@ -261,7 +261,7 @@ public class ConfigCUsAction extends AbstractPublisherAction { } if (advice instanceof ProductFileAdvice) { for (IRepositoryReference repo : ((ProductFileAdvice) advice).getUpdateRepositories()) { - Map<String, String> parameters = new LinkedHashMap<String, String>(); + Map<String, String> parameters = new LinkedHashMap<>(); parameters.put("type", Integer.toString(repo.getType())); //$NON-NLS-1$ parameters.put("location", repo.getLocation().toString()); //$NON-NLS-1$ parameters.put("enabled", Boolean.toString((repo.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); //$NON-NLS-1$ @@ -290,9 +290,9 @@ public class ConfigCUsAction extends AbstractPublisherAction { String configurationData = ""; //$NON-NLS-1$ String unconfigurationData = ""; //$NON-NLS-1$ - Map<String, String> touchpointParameters = new LinkedHashMap<String, String>(); - Set<String> jvmSet = new HashSet<String>(); - Set<String> programSet = new HashSet<String>(); + Map<String, String> touchpointParameters = new LinkedHashMap<>(); + Set<String> jvmSet = new HashSet<>(); + Set<String> programSet = new HashSet<>(); for (IExecutableAdvice advice : launchingAdvice) { String[] jvmArgs = advice.getVMArguments(); for (int i = 0; i < jvmArgs.length; i++) diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/DefaultCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/DefaultCUsAction.java index d850315c4..6e380acd3 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/DefaultCUsAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/DefaultCUsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -20,9 +20,9 @@ import org.eclipse.equinox.spi.p2.publisher.PublisherHelper; */ public class DefaultCUsAction extends AbstractPublisherAction { - private String flavor; - private int startLevel; - private boolean start; + private final String flavor; + private final int startLevel; + private final boolean start; public DefaultCUsAction(IPublisherInfo info, String flavor, int startLevel, boolean start) { this.flavor = flavor; @@ -30,6 +30,7 @@ public class DefaultCUsAction extends AbstractPublisherAction { this.start = start; } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { setPublisherInfo(publisherInfo); generateDefaultConfigIU(results); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java index 97cb5c184..63b92426f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipseInstallAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -46,6 +46,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { this.start = start; } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { monitor = SubMonitor.convert(monitor); this.info = publisherInfo; @@ -63,7 +64,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { protected IPublisherAction[] createActions() { createAdvice(); - ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> actions = new ArrayList<>(); // create an action that just publishes the raw bundles and features IPublisherAction action = new MergeResultsAction(new IPublisherAction[] {createFeaturesAction(), createBundlesAction()}, IPublisherResult.MERGE_ALL_ROOT); actions.add(action); @@ -113,7 +114,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { if (!configuration.exists()) configuration = null; - Collection<IPublisherAction> result = new ArrayList<IPublisherAction>(configs.length); + Collection<IPublisherAction> result = new ArrayList<>(configs.length); for (int i = 0; i < configs.length; i++) { String configSpec = configs[i]; String os = AbstractPublisherAction.parseConfigSpec(configSpec)[1]; @@ -136,7 +137,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { } protected Collection<IPublisherAction> createExecutablesActions(String[] configSpecs) { - Collection<IPublisherAction> result = new ArrayList<IPublisherAction>(configSpecs.length); + Collection<IPublisherAction> result = new ArrayList<>(configSpecs.length); for (int i = 0; i < configSpecs.length; i++) { ExecutablesDescriptor executables = computeExecutables(configSpecs[i]); IPublisherAction action = new EquinoxExecutableAction(executables, configSpecs[i], id, version, flavor); @@ -177,7 +178,7 @@ public class EclipseInstallAction extends AbstractPublisherAction { protected File[] computeRootFileExclusions() { if (nonRootFiles == null || nonRootFiles.length == 0) return null; - ArrayList<File> result = new ArrayList<File>(); + ArrayList<File> result = new ArrayList<>(); for (int i = 0; i < nonRootFiles.length; i++) { String filename = nonRootFiles[i]; File file = new File(filename); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipsePublisherHelper.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipsePublisherHelper.java index 07eeaf056..53f0fb3b3 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipsePublisherHelper.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EclipsePublisherHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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 @@ -26,7 +26,7 @@ import org.eclipse.osgi.service.resolver.BundleDescription; public class EclipsePublisherHelper { public static IInstallableUnit[] createEclipseIU(BundleDescription bd, boolean isFolderPlugin, IArtifactKey key, Map<String, String> extraProperties) { - ArrayList<IInstallableUnit> iusCreated = new ArrayList<IInstallableUnit>(1); + ArrayList<IInstallableUnit> iusCreated = new ArrayList<>(1); IPublisherInfo info = new PublisherInfo(); String shape = isFolderPlugin ? IBundleShapeAdvice.DIR : IBundleShapeAdvice.JAR; info.addAdvice(new BundleShapeAdvice(bd.getSymbolicName(), PublisherHelper.fromOSGiVersion(bd.getVersion()), shape)); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java index fdd0fbd44..1e13f049c 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxExecutableAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 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,7 +88,7 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { iud.setTouchpointType(PublisherHelper.TOUCHPOINT_OSGI); iud.setCapabilities(new IProvidedCapability[] {createSelfCapability(id, version)}); iud.setFilter(createFilterSpec(configSpec)); - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("configure", "setLauncherName(name:" + executableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ touchpointData.put("unconfigure", "setLauncherName()"); //$NON-NLS-1$ //$NON-NLS-2$ iud.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); @@ -181,7 +181,7 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { if (Constants.OS_MACOSX.equals(os)) return computeMacInstallActions(execDescriptor); - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ if (!Constants.OS_WIN32.equals(os)) { // We are on linux/unix. by default set all of the files to be executable. @@ -196,10 +196,10 @@ public class EquinoxExecutableAction extends AbstractPublisherAction { } private Map<String, String> computeMacInstallActions(ExecutablesDescriptor execDescriptor) { - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); String configurationData = "unzip(source:@artifact, target:${installFolder}/../);"; //$NON-NLS-1$ String execName = execDescriptor.getExecutableName(); - configurationData += " chmod(targetDir:${installFolder}/../MacOS/, targetFile:" + execName + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + configurationData += " chmod(targetDir:${installFolder}/../MacOS/, targetFile:" + execName + ", permissions:755);"; //$NON-NLS-1$ //$NON-NLS-2$ touchpointData.put("install", configurationData); //$NON-NLS-1$ String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder}/../);"; //$NON-NLS-1$ touchpointData.put("uninstall", unConfigurationData); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java index 9e41724de..a75beb663 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/EquinoxLauncherCUAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -31,17 +31,17 @@ import org.eclipse.osgi.service.environment.Constants; * </p> */ public class EquinoxLauncherCUAction extends AbstractPublisherAction { - public static final String ORG_ECLIPSE_EQUINOX_LAUNCHER = "org.eclipse.equinox.launcher"; //$NON-NLS-1$ - private String flavor; - private String[] configSpecs; + private final String flavor; + private final String[] configSpecs; public EquinoxLauncherCUAction(String flavor, String[] configSpecs) { this.flavor = flavor; this.configSpecs = configSpecs; } + @Override public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) { setPublisherInfo(publisherInfo); publishCU(ORG_ECLIPSE_EQUINOX_LAUNCHER, null, results); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java index 441b89bec..e065b8759 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/Feature.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 @@ -11,9 +11,7 @@ *******************************************************************************/ package org.eclipse.equinox.p2.publisher.eclipse; -import java.util.ArrayList; -import java.util.Locale; -import java.util.Map; +import java.util.*; /** * @@ -67,7 +65,7 @@ public class Feature implements IPlatformEntry { return; if (this.discoverySites == null) - this.discoverySites = new ArrayList<URLEntry>(); + this.discoverySites = new ArrayList<>(); URLEntry entry = new URLEntry(url, siteLabel); this.discoverySites.add(entry); @@ -75,7 +73,7 @@ public class Feature implements IPlatformEntry { public void addEntry(FeatureEntry plugin) { if (entries == null) - entries = new ArrayList<FeatureEntry>(); + entries = new ArrayList<>(); entries.add(plugin); } @@ -83,6 +81,7 @@ public class Feature implements IPlatformEntry { return application; } + @Override public String getArch() { return arch; } @@ -183,10 +182,12 @@ public class Feature implements IPlatformEntry { return this.location; } + @Override public String getNL() { return nl; } + @Override public String getOS() { return os; } @@ -215,6 +216,7 @@ public class Feature implements IPlatformEntry { return version; } + @Override public String getWS() { return ws; } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java index 2c4736443..ea80cc301 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeatureEntry.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 @@ -97,6 +97,7 @@ public class FeatureEntry implements IPlatformEntry { return true; } + @Override public String getArch() { return arch; } @@ -116,10 +117,12 @@ public class FeatureEntry implements IPlatformEntry { return match; } + @Override public String getNL() { return nl; } + @Override public String getOS() { return os; } @@ -132,6 +135,7 @@ public class FeatureEntry implements IPlatformEntry { return versionOrRange; } + @Override public String getWS() { return ws; } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java index dc6572d18..68a5a3b73 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -102,7 +102,7 @@ public class FeaturesAction extends AbstractPublisherAction { iu.setProperty(PublisherHelper.ECLIPSE_INSTALL_HANDLER_PROP, installHandlerProperty); } - ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(); + ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(); providedCapabilities.add(PublisherHelper.createSelfCapability(id, version)); providedCapabilities.add(PublisherHelper.FEATURE_CAPABILITY); providedCapabilities.add(MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_UPDATE_FEATURE, feature.getId(), version)); @@ -110,7 +110,7 @@ public class FeaturesAction extends AbstractPublisherAction { iu.setCapabilities(new IProvidedCapability[] {PublisherHelper.createSelfCapability(id, version), PublisherHelper.FEATURE_CAPABILITY, MetadataFactory.createProvidedCapability(PublisherHelper.CAPABILITY_NS_UPDATE_FEATURE, feature.getId(), version)}); iu.setArtifacts(new IArtifactKey[] {createFeatureArtifactKey(feature.getId(), version.toString())}); - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); touchpointData.put("zipped", "true"); //$NON-NLS-1$ //$NON-NLS-2$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); @@ -199,7 +199,7 @@ public class FeaturesAction extends AbstractPublisherAction { if (configSpec != null && configSpec.length() > 0) iu.setFilter(createFilterSpec(configSpec)); - Map<String, String> touchpointData = new HashMap<String, String>(2); + Map<String, String> touchpointData = new HashMap<>(2); String configurationData = "unzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ touchpointData.put("install", configurationData); //$NON-NLS-1$ String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});"; //$NON-NLS-1$ @@ -240,7 +240,7 @@ public class FeaturesAction extends AbstractPublisherAction { iu.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, BundlesAction.computeUpdateRange(new org.osgi.framework.Version(feature.getVersion())), IUpdateDescriptor.NORMAL, null)); FeatureEntry entries[] = feature.getEntries(); - List<IRequirement> required = new ArrayList<IRequirement>(entries.length + (childIUs == null ? 0 : childIUs.size())); + List<IRequirement> required = new ArrayList<>(entries.length + (childIUs == null ? 0 : childIUs.size())); for (int i = 0; i < entries.length; i++) { VersionRange range = getVersionRange(entries[i]); String requiredId = getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true); @@ -268,7 +268,7 @@ public class FeaturesAction extends AbstractPublisherAction { iu.setFilter(getFilter(entry)); // Create set of provided capabilities - ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(); + ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(); providedCapabilities.add(createSelfCapability(id, version)); Map<Locale, Map<String, String>> localizations = feature.getLocalizations(); @@ -313,9 +313,9 @@ public class FeaturesAction extends AbstractPublisherAction { iu.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(id, BundlesAction.computeUpdateRange(new org.osgi.framework.Version(feature.getVersion())), IUpdateDescriptor.NORMAL, null)); FeatureEntry entries[] = feature.getEntries(); - ArrayList<IRequirement> applicabilityScope = new ArrayList<IRequirement>(); - ArrayList<IRequirement> patchRequirements = new ArrayList<IRequirement>(); - ArrayList<IRequirementChange> requirementChanges = new ArrayList<IRequirementChange>(); + ArrayList<IRequirement> applicabilityScope = new ArrayList<>(); + ArrayList<IRequirement> patchRequirements = new ArrayList<>(); + ArrayList<IRequirementChange> requirementChanges = new ArrayList<>(); for (int i = 0; i < entries.length; i++) { VersionRange range = getVersionRange(entries[i]); IRequirement req = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, getTransformedId(entries[i].getId(), entries[i].isPlugin(), /*isGroup*/true), range, getFilter(entries[i]), entries[i].isOptional(), false); @@ -355,7 +355,7 @@ public class FeaturesAction extends AbstractPublisherAction { // iu.setFilter(filter); // Create set of provided capabilities - ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<IProvidedCapability>(); + ArrayList<IProvidedCapability> providedCapabilities = new ArrayList<>(); providedCapabilities.add(createSelfCapability(id, version)); Map<Locale, Map<String, String>> localizations = feature.getLocalizations(); @@ -377,7 +377,7 @@ public class FeaturesAction extends AbstractPublisherAction { } private File[] expandLocations(File[] list) { - ArrayList<File> result = new ArrayList<File>(); + ArrayList<File> result = new ArrayList<>(); expandLocations(list, result); return result.toArray(new File[result.size()]); } @@ -407,7 +407,7 @@ public class FeaturesAction extends AbstractPublisherAction { createBundleShapeAdvice(feature, info); createAdviceFileAdvice(feature, info); - ArrayList<IInstallableUnit> childIUs = new ArrayList<IInstallableUnit>(); + ArrayList<IInstallableUnit> childIUs = new ArrayList<>(); IInstallableUnit featureJarIU = queryForIU(result, getTransformedId(feature.getId(), false, false), Version.parseVersion(feature.getVersion())); if (featureJarIU == null) @@ -440,7 +440,7 @@ public class FeaturesAction extends AbstractPublisherAction { } protected ArrayList<IInstallableUnit> generateRootFileIUs(Feature feature, IPublisherResult result, IPublisherInfo publisherInfo) { - ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(); + ArrayList<IInstallableUnit> ius = new ArrayList<>(); Collection<IFeatureRootAdvice> collection = publisherInfo.getAdvice(null, false, feature.getId(), Version.parseVersion(feature.getVersion()), IFeatureRootAdvice.class); if (collection.size() == 0) @@ -503,7 +503,7 @@ public class FeaturesAction extends AbstractPublisherAction { URLEntry updateURL = feature.getUpdateSite(); //don't enable feature update sites by default since this results in too many //extra sites being loaded and searched (Bug 234177) - List<IRepositoryReference> collector = new ArrayList<IRepositoryReference>(); + List<IRepositoryReference> collector = new ArrayList<>(); if (updateURL != null) generateSiteReference(updateURL.getURL(), updateURL.getAnnotation(), feature.getId(), collector); URLEntry[] discoverySites = feature.getDiscoverySites(); @@ -514,7 +514,7 @@ public class FeaturesAction extends AbstractPublisherAction { } protected Feature[] getFeatures(File[] featureLocations) { - ArrayList<Feature> result = new ArrayList<Feature>(featureLocations.length); + ArrayList<Feature> result = new ArrayList<>(featureLocations.length); for (int i = 0; i < featureLocations.length; i++) { Feature feature = new FeatureParser().parse(featureLocations[i]); if (feature != null) { @@ -644,7 +644,7 @@ public class FeaturesAction extends AbstractPublisherAction { } if (linkActions.length() > 0) { - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); //we do ln during configure to avoid complicating branding which uses the install phase touchpointData.put("configure", linkActions.toString()); //$NON-NLS-1$ iu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData)); @@ -652,7 +652,7 @@ public class FeaturesAction extends AbstractPublisherAction { } private void setupPermissions(InstallableUnitDescription iu, FileSetDescriptor descriptor) { - Map<String, String> touchpointData = new HashMap<String, String>(); + Map<String, String> touchpointData = new HashMap<>(); String[][] permsList = descriptor.getPermissions(); for (int i = 0; i < permsList.length; i++) { String[] permSpec = permsList[i]; diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java index bba02c075..2f84558a3 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/FeaturesAndBundlesPublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -39,6 +39,7 @@ public class FeaturesAndBundlesPublisherApplication extends AbstractPublisherApp // nothing to do } + @Override protected void processParameter(String arg, String parameter, PublisherInfo pinfo) throws URISyntaxException { super.processParameter(arg, parameter, pinfo); @@ -63,8 +64,9 @@ public class FeaturesAndBundlesPublisherApplication extends AbstractPublisherApp return result; } + @Override protected IPublisherAction[] createActions() { - ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> result = new ArrayList<>(); if (features == null) features = new File[] {new File(source, "features")}; //$NON-NLS-1$ result.add(new FeaturesAction(features)); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java index 383c7649a..033789dd7 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/InstallPublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -31,6 +31,7 @@ public class InstallPublisherApplication extends AbstractPublisherApplication { //hidden } + @Override protected void processFlag(String arg, PublisherInfo publisherInfo) { super.processFlag(arg, publisherInfo); @@ -38,6 +39,7 @@ public class InstallPublisherApplication extends AbstractPublisherApplication { start = true; } + @Override protected void initialize(PublisherInfo publisherInfo) throws ProvisionException { super.initialize(publisherInfo); @@ -45,6 +47,7 @@ public class InstallPublisherApplication extends AbstractPublisherApplication { publisherInfo.setConfigurations(new String[] {""}); //$NON-NLS-1$ } + @Override protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo) throws URISyntaxException { super.processParameter(arg, parameter, publisherInfo); @@ -78,8 +81,9 @@ public class InstallPublisherApplication extends AbstractPublisherApplication { return result; } + @Override protected IPublisherAction[] createActions() { - ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> result = new ArrayList<>(); result.add(createEclipseInstallAction()); return result.toArray(new IPublisherAction[result.size()]); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/LaunchingAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/LaunchingAdvice.java index 414a81154..219e0d5ed 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/LaunchingAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/LaunchingAdvice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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,32 +10,35 @@ ******************************************************************************/ package org.eclipse.equinox.p2.publisher.eclipse; - import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData; import org.eclipse.equinox.p2.publisher.AbstractAdvice; public class LaunchingAdvice extends AbstractAdvice implements IExecutableAdvice { - private LauncherData data; - private String configSpec; + private final LauncherData data; + private final String configSpec; public LaunchingAdvice(LauncherData data, String configSpec) { this.data = data; this.configSpec = configSpec; } + @Override protected String getConfigSpec() { return configSpec; } + @Override public String[] getProgramArguments() { return data.getProgramArgs(); } + @Override public String[] getVMArguments() { return data.getJvmArgs(); } + @Override public String getExecutableName() { return data.getLauncherName(); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java index edaa26842..bca948e49 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 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 @@ -55,7 +55,7 @@ public class ProductAction extends AbstractPublisherAction { createAdvice(); // create all the actions needed to publish a product - ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> actions = new ArrayList<>(); // products include the executable so add actions to publish them if (getExecutablesLocation() != null && this.product.includeLaunchers()) actions.add(createApplicationExecutableAction(info.getConfigurations())); @@ -168,7 +168,7 @@ public class ProductAction extends AbstractPublisherAction { private Collection<IVersionedId> versionElements(Collection<IVersionedId> elements, String namespace) { Collection<IVersionAdvice> versionAdvice = info.getAdvice(null, true, null, null, IVersionAdvice.class); - List<IVersionedId> result = new ArrayList<IVersionedId>(); + List<IVersionedId> result = new ArrayList<>(); for (IVersionedId element : elements) { Version elementVersion = element.getVersion(); if (elementVersion == null || Version.emptyVersion.equals(elementVersion)) { @@ -200,7 +200,7 @@ public class ProductAction extends AbstractPublisherAction { private Collection<IVersionedId> listElements(List<IVersionedId> elements, String suffix) { if (suffix == null || suffix.length() == 0) return elements; - ArrayList<IVersionedId> result = new ArrayList<IVersionedId>(elements.size()); + ArrayList<IVersionedId> result = new ArrayList<>(elements.size()); for (IVersionedId elementName : elements) { result.add(new VersionedId(elementName.getId() + suffix, elementName.getVersion())); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java index 3f87efa7f..db3e3ffe4 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductFileAdvice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 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 @@ -79,6 +79,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, /** * Returns the program arguments for this product. */ + @Override public String[] getProgramArguments() { String line = product.getProgramArguments(os, arch); return AbstractPublisherAction.getArrayFromString(line, " "); //$NON-NLS-1$ @@ -87,6 +88,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, /** * Returns the VM arguments for this product. */ + @Override public String[] getVMArguments() { String line = product.getVMArguments(os, arch); return AbstractPublisherAction.getArrayFromString(line, " "); //$NON-NLS-1$ @@ -97,6 +99,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, * bundles may be specified in the .product file, .product file configuration * area, config.ini file, or a combination of these three places. */ + @Override public BundleInfo[] getBundles() { return configData.getBundles(); } @@ -106,8 +109,9 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, * properties may be defined in the .product file, the config.ini * file, or both. */ + @Override public Map<String, String> getProperties() { - Map<String, String> result = new HashMap<String, String>(); + Map<String, String> result = new HashMap<>(); CollectionUtils.putAll(configData.getProperties(), result); result.putAll(product.getConfigurationProperties(os, arch)); return result; @@ -119,6 +123,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, * * @return the name of the branded launcher or <code>null</code> if none. */ + @Override public String getExecutableName() { return product.getLauncherName(); } @@ -133,6 +138,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, /** * Returns the icons defined for this product */ + @Override public String[] getIcons() { return product.getIcons(os); } @@ -140,6 +146,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, /** * Returns the operating system that this advice is configured to work with. */ + @Override public String getOS() { return this.os; } @@ -147,6 +154,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, /** * Returns the license text for this product */ + @Override public String getLicenseURL() { return product.getLicenseURL(); } @@ -154,6 +162,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, /** * Returns the license URL for this product */ + @Override public String getLicenseText() { return product.getLicenseText(); } @@ -186,8 +195,8 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, } private void addProductFileConfigBundles(ConfigData data) { - Set<BundleInfo> versionBoundBundles = new HashSet<BundleInfo>(); - Map<String, List<BundleInfo>> unboundedBundles = new HashMap<String, List<BundleInfo>>(); + Set<BundleInfo> versionBoundBundles = new HashSet<>(); + Map<String, List<BundleInfo>> unboundedBundles = new HashMap<>(); BundleInfo[] bundles = data.getBundles(); for (int i = 0; i < bundles.length; i++) { @@ -238,7 +247,7 @@ public class ProductFileAdvice extends AbstractAdvice implements ILicenseAdvice, private void addProductFileBundles(ConfigData data) { List<IVersionedId> bundles = product.getBundles(true); - Set<BundleInfo> set = new HashSet<BundleInfo>(); + Set<BundleInfo> set = new HashSet<>(); set.addAll(Arrays.asList(data.getBundles())); for (IVersionedId vid : bundles) { diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java index 44f39b0d2..283626246 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductPublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -33,8 +33,9 @@ public class ProductPublisherApplication extends AbstractPublisherApplication { //hidden } + @Override protected IPublisherAction[] createActions() { - ArrayList<IPublisherAction> result = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> result = new ArrayList<>(); result.add(createProductAction()); return result.toArray(new IPublisherAction[result.size()]); } @@ -51,6 +52,7 @@ public class ProductPublisherApplication extends AbstractPublisherApplication { return new ProductAction(source, productDescriptor, flavor, executablesFeature, jreLocationFile); } + @Override protected void processParameter(String arg, String parameter, PublisherInfo publisherInfo) throws URISyntaxException { super.processParameter(arg, parameter, publisherInfo); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/BuildPublisherApplication.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/BuildPublisherApplication.java index a2e3c6c0a..020f3e38f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/BuildPublisherApplication.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/BuildPublisherApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -20,7 +20,7 @@ public class BuildPublisherApplication extends AbstractPublisherApplication { public void addAction(IPublisherAction action) { if (actions == null) - actions = new ArrayList<IPublisherAction>(1); + actions = new ArrayList<>(1); actions.add(action); } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/FeatureRootAdvice.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/FeatureRootAdvice.java index bd2220689..a8f5d16bf 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/FeatureRootAdvice.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/FeatureRootAdvice.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 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 @@ -10,9 +10,7 @@ *******************************************************************************/ package org.eclipse.pde.internal.build.publisher; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; +import java.util.*; import org.eclipse.equinox.internal.p2.core.helpers.FileUtils.IPathComputer; import org.eclipse.equinox.internal.p2.publisher.FileSetDescriptor; import org.eclipse.equinox.p2.metadata.Version; @@ -24,7 +22,7 @@ public class FeatureRootAdvice extends AbstractAdvice implements IFeatureRootAdv private static final int IDX_DESCRIPTOR = 1; // String config -> Object[] { GatheringComputer, Map: permission -> Set, String } - private final Map<String, Object[]> advice = new HashMap<String, Object[]>(); + private final Map<String, Object[]> advice = new HashMap<>(); private String featureId; private Version featureVersion; @@ -55,6 +53,7 @@ public class FeatureRootAdvice extends AbstractAdvice implements IFeatureRootAdv * @param config * @return GatheringComputer */ + @Override public IPathComputer getRootFileComputer(String config) { if (advice.containsKey(config)) return (GatheringComputer) advice.get(config)[IDX_COMPUTER]; @@ -95,6 +94,7 @@ public class FeatureRootAdvice extends AbstractAdvice implements IFeatureRootAdv return configAdvice; } + @Override public FileSetDescriptor getDescriptor(String config) { Object[] configAdvice = getConfigAdvice(config); FileSetDescriptor descriptor = null; @@ -119,6 +119,7 @@ public class FeatureRootAdvice extends AbstractAdvice implements IFeatureRootAdv this.featureVersion = featureVersion; } + @Override public String[] getConfigurations() { Set<String> keys = advice.keySet(); return keys.toArray(new String[keys.size()]); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatheringComputer.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatheringComputer.java index 3df09db1e..e9ee2edd5 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatheringComputer.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/build/publisher/GatheringComputer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 IBM Corporation and others. All rights reserved. This + * 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 http://www.eclipse.org/legal/epl-v10.html @@ -17,8 +17,9 @@ import org.eclipse.equinox.internal.p2.core.helpers.FileUtils.IPathComputer; public class GatheringComputer implements IPathComputer { private static final String PROVIDED_PATH = ":PROVIDED:"; //$NON-NLS-1$ - private final LinkedHashMap<File, String> filesMap = new LinkedHashMap<File, String>(); + private final LinkedHashMap<File, String> filesMap = new LinkedHashMap<>(); + @Override public IPath computePath(File source) { String prefix = filesMap.get(source); @@ -35,6 +36,7 @@ public class GatheringComputer implements IPathComputer { return result.setDevice(null); } + @Override public void reset() { // nothing diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/publishing/Activator.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/publishing/Activator.java index f50a5588f..776421d21 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/publishing/Activator.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/publishing/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 SAP AG and others. + * Copyright (c) 2011, 2017 SAP AG 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,10 +21,12 @@ public class Activator implements BundleActivator { return context; } + @Override public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; } + @Override public void stop(BundleContext bundleContext) throws Exception { Activator.context = null; } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java index 2caadb3c7..3b76cb8b1 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/pde/internal/swt/tools/IconExe.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 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,7 +69,7 @@ public class IconExe { } ImageLoader loader = new ImageLoader(); - List<ImageData> images = new ArrayList<ImageData>(); + List<ImageData> images = new ArrayList<>(); for (int i = 1; i < args.length; i++) { try { //An ICO should contain 7 images, a BMP will contain 1 @@ -175,7 +175,7 @@ public class IconExe { static List<IconResInfo> unloadIcons(String program, ImageData[] icons) throws FileNotFoundException, IOException { RandomAccessFile raf = new RandomAccessFile(program, "rw"); //$NON-NLS-1$ IconExe iconExe = new IconExe(); - List<IconResInfo> iconInfo = new ArrayList<IconExe.IconResInfo>(Arrays.asList(iconExe.getIcons(raf))); + List<IconResInfo> iconInfo = new ArrayList<>(Arrays.asList(iconExe.getIcons(raf))); // Display an error if no icons found in target executable. if (iconInfo.isEmpty()) { System.err.println("Warning - no icons detected in \"" + program + "\"."); //$NON-NLS-1$ //$NON-NLS-2$ @@ -1515,7 +1515,7 @@ public class IconExe { /** * Scaled 8x8 Bayer dither matrix. */ - static final int[][] DITHER_MATRIX = { {0xfc0000, 0x7c0000, 0xdc0000, 0x5c0000, 0xf40000, 0x740000, 0xd40000, 0x540000}, {0x3c0000, 0xbc0000, 0x1c0000, 0x9c0000, 0x340000, 0xb40000, 0x140000, 0x940000}, {0xcc0000, 0x4c0000, 0xec0000, 0x6c0000, 0xc40000, 0x440000, 0xe40000, 0x640000}, {0x0c0000, 0x8c0000, 0x2c0000, 0xac0000, 0x040000, 0x840000, 0x240000, 0xa40000}, {0xf00000, 0x700000, 0xd00000, 0x500000, 0xf80000, 0x780000, 0xd80000, 0x580000}, {0x300000, 0xb00000, 0x100000, 0x900000, 0x380000, 0xb80000, 0x180000, 0x980000}, {0xc00000, 0x400000, 0xe00000, 0x600000, 0xc80000, 0x480000, 0xe80000, 0x680000}, {0x000000, 0x800000, 0x200000, 0xa00000, 0x080000, 0x880000, 0x280000, 0xa80000}}; + static final int[][] DITHER_MATRIX = {{0xfc0000, 0x7c0000, 0xdc0000, 0x5c0000, 0xf40000, 0x740000, 0xd40000, 0x540000}, {0x3c0000, 0xbc0000, 0x1c0000, 0x9c0000, 0x340000, 0xb40000, 0x140000, 0x940000}, {0xcc0000, 0x4c0000, 0xec0000, 0x6c0000, 0xc40000, 0x440000, 0xe40000, 0x640000}, {0x0c0000, 0x8c0000, 0x2c0000, 0xac0000, 0x040000, 0x840000, 0x240000, 0xa40000}, {0xf00000, 0x700000, 0xd00000, 0x500000, 0xf80000, 0x780000, 0xd80000, 0x580000}, {0x300000, 0xb00000, 0x100000, 0x900000, 0x380000, 0xb80000, 0x180000, 0x980000}, {0xc00000, 0x400000, 0xe00000, 0x600000, 0xc80000, 0x480000, 0xe80000, 0x680000}, {0x000000, 0x800000, 0x200000, 0xa00000, 0x080000, 0x880000, 0x280000, 0xa80000}}; /** * Constructs a new, empty ImageData with the given width, height, diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java index 42a1f53dc..927406874 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/AbstractPublishTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 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 @@ -96,7 +96,7 @@ public abstract class AbstractPublishTask extends Task { protected URI artifactLocation; protected String artifactRepoName; protected PublisherInfo provider = null; - protected List<RepoEntry> contextRepositories = new ArrayList<RepoEntry>(); + protected List<RepoEntry> contextRepositories = new ArrayList<>(); protected IProvisioningAgent getProvisioningAgent() { return ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.class); diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java index b293fa249..edb6f5522 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/FeaturesAndBundlesPublisherTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 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 @@ -22,9 +22,10 @@ import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.publisher.eclipse.FeaturesAction; public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask { - private ArrayList<Object> features = new ArrayList<Object>(); - private ArrayList<Object> bundles = new ArrayList<Object>(); + private final ArrayList<Object> features = new ArrayList<>(); + private final ArrayList<Object> bundles = new ArrayList<>(); + @Override public void execute() throws BuildException { try { initializeRepositories(getInfo()); @@ -35,7 +36,7 @@ public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask { File[] f = getLocations(features); File[] b = getLocations(bundles); - ArrayList<IPublisherAction> actions = new ArrayList<IPublisherAction>(); + ArrayList<IPublisherAction> actions = new ArrayList<>(); if (f.length > 0) actions.add(new FeaturesAction(f)); if (b.length > 0) @@ -46,7 +47,7 @@ public class FeaturesAndBundlesPublisherTask extends AbstractPublishTask { } private File[] getLocations(List<Object> collection) { - ArrayList<Object> results = new ArrayList<Object>(); + ArrayList<Object> results = new ArrayList<>(); for (Object obj : collection) { if (obj instanceof FileSet) { FileSet set = (FileSet) obj; diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java index 49b79f82d..bbd993feb 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/ProductPublisherTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. All rights reserved. + * Copyright (c) 2009, 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 @@ -40,6 +40,7 @@ public class ProductPublisherTask extends AbstractPublishTask { this.arch = arch; } + @Override public String toString() { return ws + '.' + os + '.' + arch; } @@ -62,9 +63,10 @@ public class ProductPublisherTask extends AbstractPublishTask { private String productFile; private String executables; private String jreLocation; - private final List<ConfigElement> configurations = new ArrayList<ConfigElement>(3); - private final List<AdviceElement> advice = new ArrayList<AdviceElement>(3); + private final List<ConfigElement> configurations = new ArrayList<>(3); + private final List<AdviceElement> advice = new ArrayList<>(3); + @Override public void execute() throws BuildException { try { initializeRepositories(getInfo()); @@ -87,6 +89,7 @@ public class ProductPublisherTask extends AbstractPublishTask { new Publisher(getInfo()).publish(new IPublisherAction[] {action}, new NullProgressMonitor()); } + @Override protected PublisherInfo getInfo() { String[] configStrings = new String[configurations.size()]; for (int i = 0; i < configurations.size(); i++) { diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/PublisherTask.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/PublisherTask.java index b0671efc3..dadcfdf3d 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/PublisherTask.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src_ant/org/eclipse/equinox/internal/p2/publisher/ant/PublisherTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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 @@ -44,6 +44,7 @@ public class PublisherTask extends AbstractPublishTask { /* (non-Javadoc) * @see org.apache.tools.ant.Task#execute() */ + @Override public void execute() throws BuildException { try { initialize(getInfo()); @@ -122,6 +123,7 @@ public class PublisherTask extends AbstractPublishTask { /** * @deprecated */ + @Deprecated public void setExe(String value) { executableName = value; } @@ -137,6 +139,7 @@ public class PublisherTask extends AbstractPublishTask { /** * @deprecated */ + @Deprecated public void setLauncherConfig(String value) { //TODO Remove - currently exists for compatibility with generator task } @@ -148,6 +151,7 @@ public class PublisherTask extends AbstractPublishTask { /** * @deprecated */ + @Deprecated public void setP2OS(String value) { //TODO Remove - currently exists for compatibility with generator task } @@ -160,6 +164,7 @@ public class PublisherTask extends AbstractPublishTask { getInfo().setArtifactOptions(getInfo().getArtifactOptions() | IPublisherInfo.A_INDEX); } + @Override public void setPublishArtifacts(String value) { getInfo().setArtifactOptions(getInfo().getArtifactOptions() | IPublisherInfo.A_PUBLISH); } |