diff options
author | Alexander Kurtakov | 2017-08-19 07:11:49 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-08-19 07:11:49 +0000 |
commit | 3bf7cf1ff4a2b8d9a448e3f3bfc99f0caa1c37f1 (patch) | |
tree | b52ae2e527bf38dbc64a816bf09e06ab336afb15 | |
parent | 56284608e960d37831deab796372604aa40b7771 (diff) | |
download | rt.equinox.p2-3bf7cf1ff4a2b8d9a448e3f3bfc99f0caa1c37f1.tar.gz rt.equinox.p2-3bf7cf1ff4a2b8d9a448e3f3bfc99f0caa1c37f1.tar.xz rt.equinox.p2-3bf7cf1ff4a2b8d9a448e3f3bfc99f0caa1c37f1.zip |
Bug 521145 - Move p2 repository.tools to Java 8
Bump minor version, remove redundant type declarations, add missing
Override annotations and some lambda conversions.
Change-Id: Ibb59354ee15f179eb40e71db1ee800c3c8522557
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
43 files changed, 186 insertions, 194 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/.classpath b/bundles/org.eclipse.equinox.p2.repository.tools/.classpath index 834ea833e..030607499 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/.classpath +++ b/bundles/org.eclipse.equinox.p2.repository.tools/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" output="bin_ant" path="src_ant"/> diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs index 41023360f..e955d9e6c 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.repository.tools/.settings/org.eclipse.jdt.core.prefs @@ -9,13 +9,17 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -49,7 +53,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=error org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore @@ -58,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore @@ -66,19 +70,21 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore @@ -94,6 +100,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 @@ -101,6 +110,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=error @@ -113,7 +123,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF index 916be9c64..f4aadc4f7 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %bundleName Bundle-SymbolicName: org.eclipse.equinox.p2.repository.tools;singleton:=true -Bundle-Version: 2.1.400.qualifier +Bundle-Version: 2.2.0.qualifier Bundle-Activator: org.eclipse.equinox.p2.internal.repository.tools.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -15,7 +15,7 @@ Export-Package: org.eclipse.equinox.p2.internal.repository.comparator;x-internal Require-Bundle: org.eclipse.equinox.common;bundle-version="3.3.0", org.eclipse.equinox.registry, org.tukaani.xz;bundle-version="1.3.0" -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.app;version="1.0.0", org.eclipse.equinox.frameworkadmin;version="2.0.0", diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml b/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml index 1b55bd1d8..6ba580419 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml +++ b/bundles/org.eclipse.equinox.p2.repository.tools/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.repository.tools</artifactId> - <version>2.1.400-SNAPSHOT</version> + <version>2.2.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java index 8ebea0c89..b8a669e3a 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * 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 @@ -96,6 +96,7 @@ public class JarComparator implements IArtifactComparator { private String sourceLocation, destinationLocation, descriptorString; + @Override public IStatus compare(IArtifactRepository source, IArtifactDescriptor sourceDescriptor, IArtifactRepository destination, IArtifactDescriptor destinationDescriptor) { // Cache information for potential error messages sourceLocation = URIUtil.toUnencodedString(sourceDescriptor.getRepository().getLocation()); @@ -140,7 +141,7 @@ public class JarComparator implements IArtifactComparator { if (!feature1.getVersion().equals(feature2.getVersion())) parent.add(newErrorStatus(NLS.bind(Messages.featureVersionsDontMatch, feature1.getVersion(), feature2.getVersion()))); - Map<FeatureEntryWrapper, FeatureEntry> entryMap = new HashMap<FeatureEntryWrapper, FeatureEntry>(); + Map<FeatureEntryWrapper, FeatureEntry> entryMap = new HashMap<>(); FeatureEntry[] entries1 = feature1.getEntries(); FeatureEntry[] entries2 = feature2.getEntries(); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/MD5ArtifactComparator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/MD5ArtifactComparator.java index 86d5ddf54..a83e931f3 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/MD5ArtifactComparator.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/MD5ArtifactComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,6 +28,7 @@ public class MD5ArtifactComparator implements IArtifactComparator { public static String MD5_COMPARATOR_ID = "org.eclipse.equinox.artifact.md5.comparator"; //$NON-NLS-1$ + @Override public IStatus compare(IArtifactRepository source, IArtifactDescriptor sourceDescriptor, IArtifactRepository destination, IArtifactDescriptor destDescriptor) { String sourceMD5 = sourceDescriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5); String destMD5 = destDescriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Disassembler.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Disassembler.java index 2077d8af6..14c4c234b 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Disassembler.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Disassembler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -11,7 +11,6 @@ package org.eclipse.equinox.p2.internal.repository.comparator.java; import java.util.Arrays; -import java.util.Comparator; import org.eclipse.osgi.util.NLS; /** @@ -821,24 +820,22 @@ public class Disassembler { InnerClassesAttributeEntry innerClassesAttributeEntry; if (length > 1) { final char[] EMPTY_CHAR_ARRAY = Utility.EMPTY_STRING.toCharArray(); - Arrays.sort(innerClassesAttributeEntries, new Comparator<InnerClassesAttributeEntry>() { - public int compare(InnerClassesAttributeEntry o1, InnerClassesAttributeEntry o2) { - final char[] innerClassName1 = o1.getInnerClassName(); - final char[] innerClassName2 = o2.getInnerClassName(); - final char[] innerName1 = o1.getInnerName(); - final char[] innerName2 = o2.getInnerName(); - final char[] outerClassName1 = o1.getOuterClassName(); - final char[] outerClassName2 = o2.getOuterClassName(); - StringBuffer buffer1 = new StringBuffer(); - buffer1.append(innerClassName1 == null ? EMPTY_CHAR_ARRAY : innerClassName1); - buffer1.append(innerName1 == null ? EMPTY_CHAR_ARRAY : innerName1); - buffer1.append(outerClassName1 == null ? EMPTY_CHAR_ARRAY : outerClassName1); - StringBuffer buffer2 = new StringBuffer(); - buffer2.append(innerClassName2 == null ? EMPTY_CHAR_ARRAY : innerClassName2); - buffer2.append(innerName2 == null ? EMPTY_CHAR_ARRAY : innerName2); - buffer2.append(outerClassName2 == null ? EMPTY_CHAR_ARRAY : outerClassName2); - return buffer1.toString().compareTo(buffer2.toString()); - } + Arrays.sort(innerClassesAttributeEntries, (o1, o2) -> { + final char[] innerClassName1 = o1.getInnerClassName(); + final char[] innerClassName2 = o2.getInnerClassName(); + final char[] innerName1 = o1.getInnerName(); + final char[] innerName2 = o2.getInnerName(); + final char[] outerClassName1 = o1.getOuterClassName(); + final char[] outerClassName2 = o2.getOuterClassName(); + StringBuffer buffer1 = new StringBuffer(); + buffer1.append(innerClassName1 == null ? EMPTY_CHAR_ARRAY : innerClassName1); + buffer1.append(innerName1 == null ? EMPTY_CHAR_ARRAY : innerName1); + buffer1.append(outerClassName1 == null ? EMPTY_CHAR_ARRAY : outerClassName1); + StringBuffer buffer2 = new StringBuffer(); + buffer2.append(innerClassName2 == null ? EMPTY_CHAR_ARRAY : innerClassName2); + buffer2.append(innerName2 == null ? EMPTY_CHAR_ARRAY : innerName2); + buffer2.append(outerClassName2 == null ? EMPTY_CHAR_ARRAY : outerClassName2); + return buffer1.toString().compareTo(buffer2.toString()); }); } for (int i = 0; i < length; i++) { @@ -1062,14 +1059,12 @@ public class Disassembler { private void disassembleTypeMembers(ClassFileReader classFileReader, char[] className, StringBuffer buffer, String lineSeparator, int tabNumber, int mode, boolean isEnum) { FieldInfo[] fields = classFileReader.getFieldInfos(); // sort fields - Arrays.sort(fields, new Comparator<FieldInfo>() { - public int compare(FieldInfo fieldInfo1, FieldInfo fieldInfo2) { - int compare = new String(fieldInfo1.getName()).compareTo(new String(fieldInfo2.getName())); - if (compare == 0) { - return new String(fieldInfo1.getDescriptor()).compareTo(new String(fieldInfo2.getDescriptor())); - } - return compare; + Arrays.sort(fields, (fieldInfo1, fieldInfo2) -> { + int compare = new String(fieldInfo1.getName()).compareTo(new String(fieldInfo2.getName())); + if (compare == 0) { + return new String(fieldInfo1.getDescriptor()).compareTo(new String(fieldInfo2.getDescriptor())); } + return compare; }); for (int i = 0, max = fields.length; i < max; i++) { writeNewLine(buffer, lineSeparator, tabNumber); @@ -1077,14 +1072,12 @@ public class Disassembler { } MethodInfo[] methods = classFileReader.getMethodInfos(); // sort methods - Arrays.sort(methods, new Comparator<MethodInfo>() { - public int compare(MethodInfo methodInfo1, MethodInfo methodInfo2) { - int compare = new String(methodInfo1.getName()).compareTo(new String(methodInfo2.getName())); - if (compare == 0) { - return new String(methodInfo1.getDescriptor()).compareTo(new String(methodInfo2.getDescriptor())); - } - return compare; + Arrays.sort(methods, (methodInfo1, methodInfo2) -> { + int compare = new String(methodInfo1.getName()).compareTo(new String(methodInfo2.getName())); + if (compare == 0) { + return new String(methodInfo1.getDescriptor()).compareTo(new String(methodInfo2.getDescriptor())); } + return compare; }); for (int i = 0, max = methods.length; i < max; i++) { writeNewLine(buffer, lineSeparator, tabNumber); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Signature.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Signature.java index e1aa31599..c86132eee 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Signature.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/java/Signature.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -577,7 +577,7 @@ public final class Signature { if (methodOrTypeSignature[0] != C_GENERIC_START) return CharOperation.NO_CHAR_CHAR; - ArrayList<char[]> paramList = new ArrayList<char[]>(1); + ArrayList<char[]> paramList = new ArrayList<>(1); int paramStart = 1, i = 1; // start after leading '<' while (i < length) { if (methodOrTypeSignature[i] == C_GENERIC_END) { diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java index 90995f9e9..d4a604516 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -42,10 +42,7 @@ public class FileMirrorLog implements IArtifactMirrorLog { } } - /* - * (non-Javadoc) - * @see org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog#log(org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor, org.eclipse.core.runtime.IStatus) - */ + @Override public void log(IArtifactDescriptor descriptor, IStatus status) { if (status.getSeverity() >= minSeverity) { log(descriptor.toString()); @@ -53,10 +50,7 @@ public class FileMirrorLog implements IArtifactMirrorLog { } } - /* - * (non-Javadoc) - * @see org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog#log(org.eclipse.core.runtime.IStatus) - */ + @Override public void log(IStatus status) { log(status, ""); //$NON-NLS-1$ } @@ -96,10 +90,7 @@ public class FileMirrorLog implements IArtifactMirrorLog { } } - /* - * (non-Javadoc) - * @see org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog#close() - */ + @Override public void close() { try { if (out != null) diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java index ab37668b5..21127075e 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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 @@ -321,6 +321,7 @@ public class Mirroring { // Simple comparator for ArtifactDescriptors protected class ArtifactDescriptorComparator implements Comparator<IArtifactDescriptor> { + @Override public int compare(IArtifactDescriptor arg0, IArtifactDescriptor arg1) { if (arg0 != null && arg1 != null) return arg0.toString().compareTo(arg1.toString()); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java index c0a192313..d25537891 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java @@ -52,10 +52,7 @@ public class XMLMirrorLog implements IArtifactMirrorLog { } } - /* - * (non-Javadoc) - * @see org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog#log(org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor, org.eclipse.core.runtime.IStatus) - */ + @Override public void log(IArtifactDescriptor descriptor, IStatus status) { if (status.getSeverity() < minStatus) return; @@ -80,10 +77,7 @@ public class XMLMirrorLog implements IArtifactMirrorLog { writer.end(); } - /* - * (non-Javadoc) - * @see org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog#log(org.eclipse.core.runtime.IStatus) - */ + @Override public void log(IStatus status) { if (status.getSeverity() < minStatus) return; @@ -128,10 +122,7 @@ public class XMLMirrorLog implements IArtifactMirrorLog { writer.end(); } - /* - * (non-Javadoc) - * @see org.eclipse.equinox.internal.p2.artifact.mirror.IArtifactMirrorLog#close() - */ + @Override public void close() { try { if (writer != null) { diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java index 6b3ee5d36..ce93b9c36 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/AbstractApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -32,11 +32,11 @@ import org.osgi.framework.ServiceReference; public abstract class AbstractApplication { protected boolean removeAddedRepositories = true; - protected List<RepositoryDescriptor> sourceRepositories = new ArrayList<RepositoryDescriptor>(); //List of repository descriptors - protected List<URI> artifactReposToRemove = new ArrayList<URI>(); - protected List<URI> metadataReposToRemove = new ArrayList<URI>(); - protected List<IInstallableUnit> sourceIUs = new ArrayList<IInstallableUnit>(); - private List<RepositoryDescriptor> destinationRepos = new ArrayList<RepositoryDescriptor>(); + protected List<RepositoryDescriptor> sourceRepositories = new ArrayList<>(); //List of repository descriptors + protected List<URI> artifactReposToRemove = new ArrayList<>(); + protected List<URI> metadataReposToRemove = new ArrayList<>(); + protected List<IInstallableUnit> sourceIUs = new ArrayList<>(); + private List<RepositoryDescriptor> destinationRepos = new ArrayList<>(); protected IArtifactRepository destinationArtifactRepository = null; protected IMetadataRepository destinationMetadataRepository = null; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Activator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Activator.java index 19f027a65..5a5b22932 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Activator.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Activator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * 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 @@ -37,16 +37,12 @@ public class Activator implements BundleActivator { return bundleContext; } - /* (non-Javadoc) - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ + @Override public void start(BundleContext context) throws Exception { bundleContext = context; } - /* (non-Javadoc) - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ + @Override public void stop(BundleContext context) throws Exception { bundleContext = null; } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java index 7ae1a455a..36ab7d081 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/CompositeRepositoryApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -28,12 +28,13 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; import org.eclipse.osgi.util.NLS; public class CompositeRepositoryApplication extends AbstractApplication { - private List<RepositoryDescriptor> childrenToAdd = new ArrayList<RepositoryDescriptor>(); - private List<RepositoryDescriptor> childrenToRemove = new ArrayList<RepositoryDescriptor>(); + private List<RepositoryDescriptor> childrenToAdd = new ArrayList<>(); + private List<RepositoryDescriptor> childrenToRemove = new ArrayList<>(); private boolean removeAllChildren = false; private boolean failOnExists = false; private String comparatorID = null; + @Override @SuppressWarnings("unchecked") public IStatus run(IProgressMonitor monitor) throws ProvisionException { try { @@ -91,6 +92,7 @@ public class CompositeRepositoryApplication extends AbstractApplication { failOnExists = value; } + @Override protected IArtifactRepository initializeDestination(RepositoryDescriptor toInit, IArtifactRepositoryManager mgr) throws ProvisionException { // remove the repo first. mgr.removeRepository(toInit.getRepoLocation()); @@ -129,6 +131,7 @@ public class CompositeRepositoryApplication extends AbstractApplication { } } + @Override protected IMetadataRepository initializeDestination(RepositoryDescriptor toInit, IMetadataRepositoryManager mgr) throws ProvisionException { // remove the repo first. mgr.removeRepository(toInit.getRepoLocation()); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java index bb40705ad..0afad43ca 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * 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 @@ -66,7 +66,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati public static String[] getArrayArgsFromString(String list, String separator) { if (list == null || list.trim().equals("")) //$NON-NLS-1$ return new String[0]; - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); for (StringTokenizer tokens = new StringTokenizer(list, separator); tokens.hasMoreTokens();) { String token = tokens.nextToken().trim(); if (!token.equals("")) { //$NON-NLS-1$ @@ -79,6 +79,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati return result.toArray(new String[result.size()]); } + @Override public Object start(IApplicationContext context) throws Exception { Map<?, ?> args = context.getArguments(); initializeFromArguments((String[]) args.get(IApplicationContext.APPLICATION_ARGS)); @@ -86,6 +87,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati return IApplication.EXIT_OK; } + @Override public void stop() { // TODO Auto-generated method stub @@ -95,6 +97,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati * The old "org.eclipse.equinox.p2.artifact.repository.mirrorApplication" application only does artifacts * Similary, "org.eclipse.equinox.p2.metadata.repository.mirrorApplication" only does metadata */ + @Override public void setInitializationData(IConfigurationElement config, String propertyName, Object data) { if (data instanceof Map<?, ?> && ((Map<?, ?>) data).containsKey(MIRROR_MODE)) { metadataOrArtifacts = (String) ((Map<?, ?>) data).get(MIRROR_MODE); @@ -183,6 +186,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati comparatorLog = getLog(comparatorLogLocation, comparatorID); } + @Override public IStatus run(IProgressMonitor monitor) throws ProvisionException { IStatus mirrorStatus = Status.OK_STATUS; try { @@ -223,7 +227,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati // Obtain ArtifactKeys from IUs IQueryResult<IInstallableUnit> ius = slice.query(QueryUtil.createIUAnyQuery(), monitor); boolean iusSpecified = !ius.isEmpty(); // call before ius.iterator() to avoid bug 420318 - ArrayList<IArtifactKey> keys = new ArrayList<IArtifactKey>(); + ArrayList<IArtifactKey> keys = new ArrayList<>(); for (Iterator<IInstallableUnit> iterator = ius.iterator(); iterator.hasNext();) { IInstallableUnit iu = iterator.next(); keys.addAll(iu.getArtifacts()); @@ -289,7 +293,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati IMetadataRepository metadataRepo = getCompositeMetadataRepository(); if (rootIUs != null) { - sourceIUs = new ArrayList<IInstallableUnit>(); + sourceIUs = new ArrayList<>(); for (int i = 0; i < rootIUs.length; i++) { String[] segments = getArrayArgsFromString(rootIUs[i], "/"); //$NON-NLS-1$ VersionRange range = segments.length > 1 ? VersionRange.create(segments[1]) : null; @@ -298,7 +302,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati sourceIUs.add(queryResult.next()); } } else if (sourceIUs == null || sourceIUs.isEmpty()) { - sourceIUs = new ArrayList<IInstallableUnit>(); + sourceIUs = new ArrayList<>(); Iterator<IInstallableUnit> queryResult = metadataRepo.query(QueryUtil.createIUAnyQuery(), null).iterator(); while (queryResult.hasNext()) sourceIUs.add(queryResult.next()); @@ -354,7 +358,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati arr[0] = plan.getAdditions(); if (plan.getInstallerPlan() != null) arr[1] = plan.getInstallerPlan().getAdditions(); - return new CompoundQueryable<IInstallableUnit>(arr); + return new CompoundQueryable<>(arr); } private IQueryable<IInstallableUnit> slice(IProgressMonitor monitor) throws ProvisionException { diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java index 01df3ce23..0c56617b9 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RecreateRepositoryApplication.java @@ -38,6 +38,7 @@ public class RecreateRepositoryApplication extends AbstractApplication { private Map<String, String> repoProperties = null; private Map<IArtifactKey, IArtifactDescriptor[]> repoMap = null; + @Override public IStatus run(IProgressMonitor monitor) throws ProvisionException { try { IArtifactRepository repository = initialize(monitor); @@ -71,7 +72,7 @@ public class RecreateRepositoryApplication extends AbstractApplication { repoName = repository.getName(); repoProperties = repository.getProperties(); - repoMap = new HashMap<IArtifactKey, IArtifactDescriptor[]>(); + repoMap = new HashMap<>(); IQueryResult<IArtifactKey> keys = repository.query(ArtifactKeyQuery.ALL_KEYS, null); for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) { IArtifactKey key = iterator.next(); @@ -97,7 +98,7 @@ public class RecreateRepositoryApplication extends AbstractApplication { IArtifactRepositoryManager manager = getArtifactRepositoryManager(); //add pack200 mappings, the existing repoProperties is not modifiable - Map<String, String> newProperties = new HashMap<String, String>(repoProperties); + Map<String, String> newProperties = new HashMap<>(repoProperties); newProperties.put(PUBLISH_PACK_FILES_AS_SIBLINGS, "true"); //$NON-NLS-1$ IArtifactRepository repository = manager.createRepository(repoLocation, repoName, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, newProperties); if (!(repository instanceof IFileArtifactRepository)) @@ -109,7 +110,7 @@ public class RecreateRepositoryApplication extends AbstractApplication { String unpackedSize = null; File packFile = null; - Set<File> files = new HashSet<File>(); + Set<File> files = new HashSet<>(); for (IArtifactDescriptor descriptor : descriptors) { File artifactFile = simple.getArtifactFile(descriptor); files.add(artifactFile); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java index 07dfbd394..d1e524a12 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * 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 @@ -52,6 +52,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { private boolean flagAsRunnable = false; protected class CollectNativesAction extends ProvisioningAction { + @Override public IStatus execute(Map<String, Object> parameters) { InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); IInstallableUnit installableUnit = operand.second(); @@ -76,6 +77,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { return Status.OK_STATUS; } + @Override public IStatus undo(Map<String, Object> parameters) { // nothing to do for now return Status.OK_STATUS; @@ -87,6 +89,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { super(NATIVE_ARTIFACTS, weight); } + @Override protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { IInstallableUnit unit = operand.second(); if (unit.getTouchpointType().getId().equals(NATIVE_TYPE)) { @@ -95,11 +98,13 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { return null; } + @Override protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) { - parameters.put(NATIVE_ARTIFACTS, new ArrayList<Object>()); + parameters.put(NATIVE_ARTIFACTS, new ArrayList<>()); return null; } + @Override protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) { @SuppressWarnings("unchecked") List<IArtifactRequest> artifactRequests = (List<IArtifactRequest>) parameters.get(NATIVE_ARTIFACTS); @@ -115,11 +120,12 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { // the list of IUs that we actually transformed... could have come from the repo // or have been user-specified. - private Collection<IInstallableUnit> processedIUs = new ArrayList<IInstallableUnit>(); + private Collection<IInstallableUnit> processedIUs = new ArrayList<>(); /* * Perform the transformation. */ + @Override public IStatus run(IProgressMonitor monitor) throws ProvisionException { SubMonitor progress = SubMonitor.convert(monitor, 5); @@ -159,7 +165,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { File parentDir = new File(destinationArtifactRepository.getLocation().toString().substring(5)); File pluginsDir = new File(parentDir, "plugins"); File fragmentInfo = new File(parentDir, "fragment.info"); - HashSet<BundleInfo> bundles = new HashSet<BundleInfo>(); + HashSet<BundleInfo> bundles = new HashSet<>(); try { for (Iterator<IInstallableUnit> iterator = processedIUs.iterator(); iterator.hasNext();) { IInstallableUnit unit = iterator.next(); @@ -213,7 +219,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { } protected URI[] getRepositories(boolean metadata) { - List<URI> repos = new ArrayList<URI>(); + List<URI> repos = new ArrayList<>(); for (RepositoryDescriptor repo : sourceRepositories) { if (metadata ? repo.isMetadata() : repo.isArtifact()) repos.add(repo.getRepoLocation()); @@ -285,16 +291,14 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { * Create and return a new profile. */ private IProfile createProfile() throws ProvisionException { - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(IProfile.PROP_CACHE, URIUtil.toFile(destinationArtifactRepository.getLocation()).getAbsolutePath()); properties.put(IProfile.PROP_INSTALL_FOLDER, URIUtil.toFile(destinationArtifactRepository.getLocation()).getAbsolutePath()); IProfileRegistry registry = Activator.getProfileRegistry(); return registry.addProfile(System.currentTimeMillis() + "-" + Math.random(), properties); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) - */ + @Override public Object start(IApplicationContext context) throws Exception { String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS); processCommandLineArgs(args); @@ -355,9 +359,7 @@ public class Repo2Runnable extends AbstractApplication implements IApplication { throw new ProvisionException(Messages.exception_needDestinationRepo); } - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#stop() - */ + @Override public void stop() { // nothing to do } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java index 703406388..57b3cd5f9 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2015 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -20,16 +20,11 @@ import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; -/** - * - */ public class RepositoryAnalyzerApplication implements IApplication { private URI uri = null; - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) - */ + @Override public Object start(IApplicationContext context) throws Exception { long start = System.currentTimeMillis(); @@ -76,9 +71,7 @@ public class RepositoryAnalyzerApplication implements IApplication { throw new CoreException(new Status(IStatus.ERROR, Activator.ID, "-metadataRepository <metadataURI> must be specified")); } - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#stop() - */ + @Override public void stop() { // TODO Auto-generated method stub diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java index b38d811ee..ff7081083 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/SlicingOptions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 IBM Corporation and others. + * 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 @@ -58,7 +58,7 @@ public class SlicingOptions { public Map<String, String> getFilter() { if (filter == null) - filter = new Hashtable<String, String>(); + filter = new Hashtable<>(); return filter; } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/XZCompressor.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/XZCompressor.java index 429b145f9..e77b45e91 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/XZCompressor.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/XZCompressor.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 @@ -38,7 +38,7 @@ public class XZCompressor { private String repoFolder; private boolean preserveOriginalFile = true; - private ArrayList<File> filesToDelete = new ArrayList<File>(); + private ArrayList<File> filesToDelete = new ArrayList<>(); public String getRepoFolder() { return repoFolder; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/CopyrightAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/CopyrightAnalyzer.java index a1379346e..d9c1e199b 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/CopyrightAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/CopyrightAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2015 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -19,6 +19,7 @@ import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer; */ public class CopyrightAnalyzer extends IUAnalyzer { + @Override public void analyzeIU(IInstallableUnit iu) { if (Boolean.parseBoolean(iu.getProperty(InstallableUnitDescription.PROP_TYPE_GROUP))) { if (iu.getCopyright() == null || iu.getCopyright().getBody().length() == 0) { @@ -36,6 +37,7 @@ public class CopyrightAnalyzer extends IUAnalyzer { } } + @Override public void preAnalysis(IMetadataRepository repository) { // do nothing } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java index 51c264009..fbfcb7ef8 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/HostCheckAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2011 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -28,6 +28,7 @@ public class HostCheckAnalyzer extends IUAnalyzer { private IMetadataRepository repository; + @Override public void analyzeIU(IInstallableUnit iu) { if (iu instanceof IInstallableUnitFragment) { IInstallableUnitFragment fragment = (IInstallableUnitFragment) iu; @@ -49,6 +50,7 @@ public class HostCheckAnalyzer extends IUAnalyzer { } + @Override public void preAnalysis(IMetadataRepository repository) { this.repository = repository; } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/IUCounting.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/IUCounting.java index ab9ff512f..2b91c3e6c 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/IUCounting.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/IUCounting.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2015 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -29,6 +29,7 @@ public class IUCounting implements IIUAnalyzer { return Boolean.parseBoolean(iu.getProperty(property)); } + @Override public void analyzeIU(IInstallableUnit iu) { totalIUs++; if (hasProperty(iu, InstallableUnitDescription.PROP_TYPE_FRAGMENT)) @@ -39,6 +40,7 @@ public class IUCounting implements IIUAnalyzer { totalCategories++; } + @Override public IStatus postAnalysis() { System.out.println("Total IUs: " + totalIUs); System.out.println(" Total Groups: " + totalGroups); @@ -47,6 +49,7 @@ public class IUCounting implements IIUAnalyzer { return null; } + @Override public void preAnalysis(IMetadataRepository repo) { totalIUs = 0; totalGroups = 0; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java index c87089f8d..f98511899 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/LicenseAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 EclipseSource and others. All rights reserved. This + * Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -21,6 +21,7 @@ import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer; */ public class LicenseAnalyzer extends IUAnalyzer { + @Override public void analyzeIU(IInstallableUnit iu) { if (Boolean.parseBoolean(iu.getProperty(InstallableUnitDescription.PROP_TYPE_GROUP))) { Collection<ILicense> licenses = iu.getLicenses(); @@ -43,6 +44,7 @@ public class LicenseAnalyzer extends IUAnalyzer { } } + @Override public void preAnalysis(IMetadataRepository repository) { // Do nothing } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java index a81f8bdb4..9d436d467 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UniqueIUAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -22,6 +22,7 @@ public class UniqueIUAnalyzer extends IUAnalyzer { Set<String> versionedNames = null; + @Override public void analyzeIU(IInstallableUnit iu) { // Create a unique name / version pair and cache it String uniqueID = iu.getId() + ":" + iu.getVersion().toString(); @@ -32,7 +33,8 @@ public class UniqueIUAnalyzer extends IUAnalyzer { versionedNames.add(uniqueID); } + @Override public void preAnalysis(IMetadataRepository repo) { - versionedNames = new HashSet<String>(); + versionedNames = new HashSet<>(); } } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java index 3a3467508..bb9b62a0b 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/UnzipFeatureJarAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -19,6 +19,7 @@ import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer; */ public class UnzipFeatureJarAnalyzer extends IUAnalyzer { + @Override public void analyzeIU(IInstallableUnit iu) { if (iu.getId().indexOf("feature.jar") > -1) { Collection<ITouchpointData> touchpointData = iu.getTouchpointData(); @@ -39,6 +40,7 @@ public class UnzipFeatureJarAnalyzer extends IUAnalyzer { } + @Override public void preAnalysis(IMetadataRepository repository) { // Do nothing } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/VersionAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/VersionAnalyzer.java index 4c3ac9559..3c650293d 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/VersionAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/analyzer/VersionAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -21,6 +21,7 @@ import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer; */ public class VersionAnalyzer extends IUAnalyzer { + @Override public void analyzeIU(IInstallableUnit iu) { if (iu.getVersion().equals(Version.emptyVersion)) { error(iu, "[ERROR] IU: " + iu.getId() + " has not replaced its qualifiier"); @@ -46,6 +47,7 @@ public class VersionAnalyzer extends IUAnalyzer { return new org.osgi.framework.Version(version.toString()); } + @Override public void preAnalysis(IMetadataRepository repo) { // Do nothing } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java index 3da91b55a..7c75d885d 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/repository/tools/analyzer/IUAnalyzer.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009,2010 EclipseSource and others. All rights reserved. This +* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -32,13 +32,11 @@ public abstract class IUAnalyzer implements IIUAnalyzer { protected void error(IInstallableUnit iu, String error) { if (errors == null) - errors = new ArrayList<IStatus>(); + errors = new ArrayList<>(); errors.add(new Status(IStatus.ERROR, Activator.ID, error)); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.tools.verifier.IIUAnalysis#postAnalysis() - */ + @Override public IStatus postAnalysis() { if (errors == null || errors.size() == 0) return Status.OK_STATUS; diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java index 9c14eaebd..77397c118 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * 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 @@ -31,9 +31,9 @@ import org.eclipse.osgi.util.NLS; public abstract class AbstractRepositoryTask extends Task { protected static final String ANT_PREFIX = "${"; //$NON-NLS-1$ protected AbstractApplication application; - protected List<IUDescription> iuTasks = new ArrayList<IUDescription>(); - protected List<FileSet> sourceRepos = new ArrayList<FileSet>(); - protected List<DestinationRepository> destinations = new ArrayList<DestinationRepository>(); + protected List<IUDescription> iuTasks = new ArrayList<>(); + protected List<FileSet> sourceRepos = new ArrayList<>(); + protected List<DestinationRepository> destinations = new ArrayList<>(); protected void addMetadataSourceRepository(URI repoLocation, boolean optional) { RepositoryDescriptor source = new RepositoryDescriptor(); @@ -177,7 +177,7 @@ public abstract class AbstractRepositoryTask extends Task { return null; IMetadataRepository repository = application.getCompositeMetadataRepository(); - List<IInstallableUnit> result = new ArrayList<IInstallableUnit>(); + List<IInstallableUnit> result = new ArrayList<>(); for (IUDescription iu : iuTasks) { IQuery<IInstallableUnit> iuQuery = iu.createQuery(); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java index 819b12b25..a1a9a5e1d 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 IBM Corporation and others. + * 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 @@ -10,12 +10,11 @@ *******************************************************************************/ package org.eclipse.equinox.p2.internal.repository.tools.tasks; -import org.eclipse.equinox.p2.internal.repository.mirroring.IArtifactMirrorLog; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.eclipse.core.runtime.IStatus; import org.eclipse.equinox.internal.p2.artifact.repository.Messages; +import org.eclipse.equinox.p2.internal.repository.mirroring.IArtifactMirrorLog; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; public class AntMirrorLog implements IArtifactMirrorLog { @@ -33,11 +32,13 @@ public class AntMirrorLog implements IArtifactMirrorLog { } } + @Override public void log(IArtifactDescriptor descriptor, IStatus status) { log(descriptor.toString(), status.getSeverity()); log(status); } + @Override public void log(IStatus status) { int severity = status.getSeverity(); // Log the status message @@ -53,6 +54,7 @@ public class AntMirrorLog implements IArtifactMirrorLog { log(nestedStatus[i]); } + @Override public void close() { // nothing to do here } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java index a672f38e6..33e0d5a6b 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ArtifactDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. + * Copyright (c) 2011, 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,7 +44,7 @@ public class ArtifactDescription extends DataType { public void addConfiguredProperty(Parameter property) { if (properties == null) - properties = new HashMap<String, String>(); + properties = new HashMap<>(); properties.put(property.getName(), property.getValue()); } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java index 83b4df5d0..a560829c2 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CompositeRepositoryTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * 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 @@ -27,9 +27,7 @@ public class CompositeRepositoryTask extends AbstractRepositoryTask { application = new CompositeRepositoryApplication(); } - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() throws BuildException { try { IStatus result = application.run(null); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java index 000d325b2..16cc1b2b3 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/CreateCompositeArtifactRepositoryTask.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 @@ -34,11 +34,9 @@ public class CreateCompositeArtifactRepositoryTask extends Task { boolean atomic = true; // bug 356561: newly created repositories shall be atomic (by default) boolean compressed = true; boolean failOnExists = false; // should we fail if a repo already exists? - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() { validate(); IArtifactRepositoryManager manager = (IArtifactRepositoryManager) AbstractRepositoryTask.getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java index 6968e4217..2c5cf9f91 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ElementList.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,7 @@ import org.apache.tools.ant.types.DataType; public class ElementList<T> extends DataType { - private List<T> elements = new ArrayList<T>(); + private List<T> elements = new ArrayList<>(); public void addConfigured(T element) { elements.add(element); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java index b6cfec4be..73513433a 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/IUDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -84,6 +84,7 @@ public class IUDescription extends DataType { return version; } + @Override public String toString() { StringBuffer buffer = new StringBuffer("Installable Unit ["); //$NON-NLS-1$ if (id != null) { @@ -103,7 +104,7 @@ public class IUDescription extends DataType { } public IQuery<IInstallableUnit> createQuery() { - List<IQuery<IInstallableUnit>> queries = new ArrayList<IQuery<IInstallableUnit>>(); + List<IQuery<IInstallableUnit>> queries = new ArrayList<>(); if (id != null) { if (version == null || version.length() == 0) { // Get the latest version of the iu @@ -151,7 +152,7 @@ public class IUDescription extends DataType { if (attributes == null || attributes.length() == 0) return Collections.<String, String> emptyMap(); - Map<String, String> result = new HashMap<String, String>(); + Map<String, String> result = new HashMap<>(); int start = 0; int idx = 0; while ((idx = attributes.indexOf('@', start)) > -1) { diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java index 081123343..dcf51572b 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -37,9 +37,7 @@ public class MirrorArtifactsTask extends Task { boolean verbose = false; boolean references = true; - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() { // Compare against if baseline specified RepositoryDescriptor destinationRepo = new RepositoryDescriptor(); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java index 20b058a00..708ccfe3c 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,9 +30,7 @@ public class MirrorMetadataTask extends Task { String writeMode; boolean references = true; - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() { RepositoryDescriptor destinationRepo = new RepositoryDescriptor(); destinationRepo.setName(destinationName); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java index 002d53e62..2e067a149 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -33,6 +33,7 @@ public class MirrorTask extends AbstractRepositoryTask { application = new MirrorApplication(); } + @Override public void execute() throws BuildException { try { if (mirrorLog != null) @@ -75,7 +76,7 @@ public class MirrorTask extends AbstractRepositoryTask { return null; List<ArtifactDescription> artifacts = comparator.getExcluded(); - List<IQuery<IArtifactDescriptor>> queries = new ArrayList<IQuery<IArtifactDescriptor>>(); + List<IQuery<IArtifactDescriptor>> queries = new ArrayList<>(); for (ArtifactDescription artifactDescription : artifacts) queries.add(artifactDescription.createDescriptorQuery()); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java index ae4298449..d87c76284 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ProcessRepoTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * 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 @@ -61,11 +61,11 @@ public class ProcessRepoTask extends Task { private SigningOptions signing = null; private JarProcessorTask jarProcessor = null; + @Override public void execute() throws BuildException { File file = URIUtil.toFile(repository); if (file == null || !file.exists()) { - throw new BuildException(NLS.bind( - Messages.ProcessRepo_must_be_local, repository.toString())); + throw new BuildException(NLS.bind(Messages.ProcessRepo_must_be_local, repository.toString())); } if (pack | repack | signing != null) { if (jarProcessor == null) @@ -77,8 +77,7 @@ public class ProcessRepoTask extends Task { jarProcessor.setStorepass(signing.storepass); jarProcessor.setUnsign(signing.unsign); - if (signing.alias != null && signing.alias.length() > 0 - && !signing.alias.startsWith("${")) //$NON-NLS-1$ + if (signing.alias != null && signing.alias.length() > 0 && !signing.alias.startsWith("${")) //$NON-NLS-1$ jarProcessor.setSign(true); } jarProcessor.setPack(pack); @@ -106,8 +105,7 @@ public class ProcessRepoTask extends Task { try { this.repository = URIUtil.fromString(repository); } catch (URISyntaxException e) { - throw new IllegalArgumentException(NLS.bind( - Messages.ProcessRepo_location_not_url, repository)); + throw new IllegalArgumentException(NLS.bind(Messages.ProcessRepo_location_not_url, repository)); } } diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java index 447f605b0..b9b8bd9e9 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -35,6 +35,7 @@ public class RemoveIUTask extends AbstractRepositoryTask { protected static class RemoveIUApplication extends AbstractApplication { //Only need the application to reuse super's repo management. + @Override public IStatus run(IProgressMonitor monitor) { return null; } @@ -48,6 +49,7 @@ public class RemoveIUTask extends AbstractRepositoryTask { this.application = new RemoveIUApplication(); } + @Override public void execute() throws BuildException { try { if (iuTasks == null || iuTasks.isEmpty()) @@ -60,7 +62,7 @@ public class RemoveIUTask extends AbstractRepositoryTask { IMetadataRepository repository = application.getDestinationMetadataRepository(); IArtifactRepository artifacts = application.getDestinationArtifactRepository(); - final Set<IInstallableUnit> toRemove = new HashSet<IInstallableUnit>(); + final Set<IInstallableUnit> toRemove = new HashSet<>(); for (IUDescription iu : iuTasks) { IQuery<IInstallableUnit> iuQuery = iu.createQuery(); @@ -117,7 +119,7 @@ public class RemoveIUTask extends AbstractRepositoryTask { } private Dictionary<String, Object> createDictionary(IArtifactDescriptor descriptor) { - Hashtable<String, Object> result = new Hashtable<String, Object>(5); + Hashtable<String, Object> result = new Hashtable<>(5); result.putAll(descriptor.getProperties()); IArtifactKey key = descriptor.getArtifactKey(); result.put(CLASSIFIER, key.getClassifier()); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java index 492d99ee6..a414e661b 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/Repo2RunnableTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2013 IBM Corporation and others. + * 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 @@ -45,9 +45,7 @@ public class Repo2RunnableTask extends AbstractRepositoryTask { this.application = new Repo2Runnable(); } - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() throws BuildException { try { prepareSourceRepos(); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java index 7d51e9372..a2e08cbf9 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RepositoryList.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * 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 @@ -16,8 +16,8 @@ import org.apache.tools.ant.types.FileSet; public class RepositoryList extends RepositoryFileSet { // TODO this class should extend DataType, currently RepoFileSet to support <source location="xxx" /> - List<DestinationRepository> repositories = new ArrayList<DestinationRepository>(); - List<FileSet> sourceFileSets = new ArrayList<FileSet>(); + List<DestinationRepository> repositories = new ArrayList<>(); + List<FileSet> sourceFileSets = new ArrayList<>(); public DestinationRepository createRepository() { DestinationRepository repo = new DestinationRepository(); diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ValidateTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ValidateTask.java index 21407c52a..d741f8c16 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ValidateTask.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/ValidateTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,9 +26,7 @@ public class ValidateTask extends AbstractRepositoryTask { private String comparatorID; // specifies the comparator we want to use. - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() { IArtifactRepositoryManager manager = (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME); if (manager == null) |