diff options
author | Alexander Kurtakov | 2017-08-18 12:38:02 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-08-18 12:52:31 +0000 |
commit | 5185e9c4d05feb8efb02f1a178640ccae3b33d6a (patch) | |
tree | 09e5d59976009a0bc84a3c0d16e17d9e13b1da36 /bundles/org.eclipse.equinox.p2.metadata.repository | |
parent | 191fe70301dcd993856a1869c08ecb22a4bafa84 (diff) | |
download | rt.equinox.p2-5185e9c4d05feb8efb02f1a178640ccae3b33d6a.tar.gz rt.equinox.p2-5185e9c4d05feb8efb02f1a178640ccae3b33d6a.tar.xz rt.equinox.p2-5185e9c4d05feb8efb02f1a178640ccae3b33d6a.zip |
Bug 521115 - Move p2 metadata.repository to Java 8
Bump minor version, add missing @Override's, remove duplicate type
declarations.
Change-Id: If8b9098f28662a2a65acead6f8befa56b1524a9a
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.metadata.repository')
20 files changed, 191 insertions, 141 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath b/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath index 834ea833e..030607499 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/.classpath +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.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.metadata.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs index 449cf187f..7a1bda565 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/.settings/org.eclipse.jdt.core.prefs @@ -6,10 +6,19 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -18,17 +27,23 @@ org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning @@ -36,41 +51,78 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error 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.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled 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 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=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled 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 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 +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled 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.metadata.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF index 06c6ee6f8..baaeee82b 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.metadata.repository;singleton:=true -Bundle-Version: 1.2.400.qualifier +Bundle-Version: 1.3.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.metadata.repository.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -45,4 +45,4 @@ Import-Package: javax.xml.parsers, org.xml.sax Service-Component: OSGI-INF/repositoryManager.xml Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml b/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml index 1d3f58e87..ba309d9e8 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/pom.xml @@ -19,6 +19,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.metadata.repository</artifactId> - <version>1.2.400-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java index e8d35ea1d..be071b28a 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/Activator.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 @@ -25,10 +25,12 @@ public class Activator implements BundleActivator { return bundleContext; } + @Override public void start(BundleContext aContext) throws Exception { bundleContext = aContext; } + @Override public void stop(BundleContext aContext) throws Exception { bundleContext = null; } diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java index 21b0eab46..5df56d35d 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepository.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2016 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 @@ -46,11 +46,11 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl // keep a list of the child URIs. they can be absolute or relative. they may or may not point // to a valid reachable repo - private List<URI> childrenURIs = new ArrayList<URI>(); + private List<URI> childrenURIs = new ArrayList<>(); // keep a list of the repositories that we have successfully loaded - private List<IMetadataRepository> loadedRepos = new ArrayList<IMetadataRepository>(); + private List<IMetadataRepository> loadedRepos = new ArrayList<>(); private IMetadataRepositoryManager manager; - private IPool<IInstallableUnit> iuPool = new WeakPool<IInstallableUnit>(); + private IPool<IInstallableUnit> iuPool = new WeakPool<>(); /** * Create a Composite repository in memory. @@ -89,6 +89,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl return "file".equalsIgnoreCase(getLocation().getScheme()); //$NON-NLS-1$ } + @Override public boolean isModifiable() { return isLocal(); } @@ -100,7 +101,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl super(manager.getAgent(), state.getName(), state.getType(), state.getVersion(), state.getLocation(), state.getDescription(), state.getProvider(), state.getProperties()); this.manager = manager; SubMonitor sub = SubMonitor.convert(monitor, 100 * state.getChildren().length); - List<URI> repositoriesToBeRemovedOnFailure = new ArrayList<URI>(); + List<URI> repositoriesToBeRemovedOnFailure = new ArrayList<>(); boolean failOnChildFailure = shouldFailOnChildFailure(state); for (URI child : state.getChildren()) addChild(child, false, sub.newChild(100), failOnChildFailure, repositoriesToBeRemovedOnFailure); @@ -132,9 +133,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl return result; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { if (monitor == null) monitor = new NullProgressMonitor(); @@ -187,9 +186,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl } } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.ICompositeRepository#addChild(java.net.URI) - */ + @Override public void addChild(URI childURI) { try { addChild(childURI, true, null, false, null); @@ -198,9 +195,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl } } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.ICompositeRepository#removeChild(java.net.URI) - */ + @Override public void removeChild(URI childURI) { boolean removed = childrenURIs.remove(childURI); // if the child wasn't there make sure and try the other permutation @@ -225,34 +220,23 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl } } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.ICompositeRepository#removeAllChildren() - */ + @Override public void removeAllChildren() { childrenURIs.clear(); loadedRepos.clear(); save(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addInstallableUnits(java.util.Collection) - */ @Override public void addInstallableUnits(Collection<IInstallableUnit> installableUnits) { throw new UnsupportedOperationException("Cannot add IUs to a composite repository"); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll() - */ @Override public synchronized void removeAll() { throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection) - */ @Override public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) { throw new UnsupportedOperationException("Cannot remove IUs from a composite repository"); //$NON-NLS-1$ @@ -277,18 +261,14 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl return getActualLocation(location, XML_EXTENSION); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addReferences(java.util.Collection) - */ + @Override public synchronized void addReferences(Collection<? extends IRepositoryReference> references) { throw new UnsupportedOperationException("Cannot add References to a composite repository"); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#getReferences() - */ + @Override public Collection<IRepositoryReference> getReferences() { - HashSet<IRepositoryReference> allRefs = new HashSet<IRepositoryReference>(); + HashSet<IRepositoryReference> allRefs = new HashSet<>(); for (IMetadataRepository child : loadedRepos) allRefs.addAll(child.getReferences()); return allRefs; @@ -333,11 +313,9 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl } } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.ICompositeRepository#getChildren() - */ + @Override public List<URI> getChildren() { - List<URI> result = new ArrayList<URI>(); + List<URI> result = new ArrayList<>(); for (URI childURI : childrenURIs) result.add(URIUtil.makeAbsolute(childURI, getLocation())); return result; @@ -350,6 +328,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl } //TODO this should never be called. What do we do? + @Override public void initialize(RepositoryState state) { setName(state.Name); setType(state.Type); @@ -360,9 +339,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl setProperties(state.Properties); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#getIndex(java.lang.String) - */ + @Override @SuppressWarnings("unchecked") public IIndex<IInstallableUnit> getIndex(String memberName) { IQueryable<IInstallableUnit> queryable = QueryUtil.compoundQueryable(loadedRepos); @@ -372,9 +349,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl return null; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#everything() - */ + @Override @SuppressWarnings("unchecked") public Iterator<IInstallableUnit> everything() { IQueryable<IInstallableUnit> queryable = QueryUtil.compoundQueryable(loadedRepos); @@ -384,9 +359,7 @@ public class CompositeMetadataRepository extends AbstractMetadataRepository impl return Collections.EMPTY_LIST.iterator(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#getManagedProperty(java.lang.Object, java.lang.String, java.lang.Object) - */ + @Override @SuppressWarnings("unchecked") public Object getManagedProperty(Object client, String memberName, Object key) { IQueryable<IInstallableUnit> queryable = QueryUtil.compoundQueryable(loadedRepos); diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java index ea0c05376..f860d880f 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/CompositeMetadataRepositoryFactory.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 @@ -35,6 +35,7 @@ public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactor private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$ public static final String CONTENT_FILENAME = "compositeContent"; //$NON-NLS-1$ + @Override public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) { return new CompositeMetadataRepository(getManager(), location, name, properties); } @@ -79,9 +80,7 @@ public class CompositeMetadataRepositoryFactory extends MetadataRepositoryFactor return localFile; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#load(java.net.URL, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException { long time = 0; final String debugMsg = "Validating and loading metadata repository "; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java index 3b3e02728..22a4dab6a 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/LocalMetadataRepository.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 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 @@ -47,7 +47,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen static final private String XML_EXTENSION = ".xml"; //$NON-NLS-1$ protected IUMap units = new IUMap(); - protected HashSet<IRepositoryReference> repositories = new HashSet<IRepositoryReference>(); + protected HashSet<IRepositoryReference> repositories = new HashSet<>(); private IIndex<IInstallableUnit> idIndex; private IIndex<IInstallableUnit> capabilityIndex; private TranslationSupport translationSupport; @@ -110,9 +110,6 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen save(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#addReferences(java.util.Collection) - */ @Override public void addReferences(Collection<? extends IRepositoryReference> references) { assertModifiable(); @@ -121,16 +118,12 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen save(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#getReferences() - */ + @Override public Collection<IRepositoryReference> getReferences() { return Collections.unmodifiableCollection(repositories); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#getIndex(java.lang.String) - */ + @Override public synchronized IIndex<IInstallableUnit> getIndex(String memberName) { if (InstallableUnit.MEMBER_ID.equals(memberName)) { snapshotNeeded = true; @@ -148,6 +141,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen return null; } + @Override public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; @@ -160,9 +154,6 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen return null; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#initialize(org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository.RepositoryState) - */ @Override public void initialize(RepositoryState state) { synchronized (this) { @@ -197,7 +188,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen private synchronized List<IRepositoryReference> createRepositoriesSnapshot() { if (repositories.isEmpty()) return Collections.<IRepositoryReference> emptyList(); - return new ArrayList<IRepositoryReference>(repositories); + return new ArrayList<>(repositories); } // use this method to setup any transient fields etc after the object has been restored from a stream @@ -205,32 +196,22 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen setLocation(aLocation); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#isModifiable() - */ @Override public boolean isModifiable() { return true; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.query.IQueryable#query(org.eclipse.equinox.p2.query.IQuery, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { return IndexProvider.query(this, query, monitor); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.metadata.index.IIndexProvider#everything() - */ + @Override public synchronized Iterator<IInstallableUnit> everything() { snapshotNeeded = true; return units.iterator(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeAll() - */ @Override public synchronized void removeAll() { if (snapshotNeeded) { @@ -243,9 +224,6 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen save(); } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository#removeInstallableUnits(java.util.Collection) - */ @Override public synchronized boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) { boolean changed = false; @@ -308,9 +286,6 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen } } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#setProperty(java.lang.String, java.lang.String) - */ @Override public String setProperty(String key, String newValue, IProgressMonitor monitor) { try { @@ -332,6 +307,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen } } + @Override public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) { IStatus result = null; synchronized (this) { @@ -359,9 +335,7 @@ public class LocalMetadataRepository extends AbstractMetadataRepository implemen return result; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.IMetadataRepository#compress(IPool<IInstallableUnit> iuPool) - */ + @Override public void compress(IPool<IInstallableUnit> iuPool) { units.compress(iuPool); } diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java index 0098f2552..f69e7eaff 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryComponent.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 @@ -20,6 +20,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; */ public class MetadataRepositoryComponent implements IAgentServiceFactory { + @Override public Object createService(IProvisioningAgent agent) { return new MetadataRepositoryManager(agent); } diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java index 485594bab..ed67c081a 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryIO.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 @@ -230,6 +230,7 @@ public class MetadataRepositoryIO { return theRepository; } + @Override protected Object getRootObject() { return theRepository; } @@ -240,6 +241,7 @@ public class MetadataRepositoryIO { super(rootName, rootHandler); } + @Override public void processingInstruction(String target, String data) throws SAXException { if (PI_REPOSITORY_TARGET.equals(target)) { Version repositoryVersion = extractPIVersion(target, data); @@ -272,6 +274,7 @@ public class MetadataRepositoryIO { return repository; } + @Override protected void handleRootAttributes(Attributes attributes) { String[] values = parseAttributes(attributes, required, optional); Version version = checkVersion(this.elementHandled, VERSION_ATTRIBUTE, values[2]); @@ -283,6 +286,7 @@ public class MetadataRepositoryIO { state.Location = null; } + @Override public void startElement(String name, Attributes attributes) { checkCancel(); if (PROPERTIES_ELEMENT.equals(name)) { @@ -308,6 +312,7 @@ public class MetadataRepositoryIO { } } + @Override protected void finished() { if (isValidXML()) { state.Properties = (propertiesHandler == null ? new OrderedProperties(0) // @@ -335,10 +340,12 @@ public class MetadataRepositoryIO { } } + @Override protected String getErrorMessage() { return Messages.io_parseError; } + @Override public String toString() { // TODO: return null; diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java index b58f4bb5a..174b562b6 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/MetadataRepositoryManager.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 @@ -37,10 +37,12 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager<IInstal super.addRepository(repository, true, null); } + @Override public IMetadataRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException { return (IMetadataRepository) doCreateRepository(location, name, type, properties); } + @Override protected IRepository<IInstallableUnit> factoryCreate(URI location, String name, String type, Map<String, String> properties, IExtension extension) throws ProvisionException { MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY); if (factory == null) @@ -49,6 +51,7 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager<IInstal return factory.create(location, name, type, properties); } + @Override protected IRepository<IInstallableUnit> factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException { MetadataRepositoryFactory factory = (MetadataRepositoryFactory) createExecutableExtension(extension, EL_FACTORY); if (factory == null) @@ -57,10 +60,12 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager<IInstal return factory.load(location, flags, monitor); } + @Override protected String getBundleId() { return Activator.ID; } + @Override protected String getDefaultSuffix() { return "content.xml"; //$NON-NLS-1$ } @@ -69,10 +74,12 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager<IInstal return (IMetadataRepository) basicGetRepository(location); } + @Override protected String getRepositoryProviderExtensionPointId() { return Activator.REPO_PROVIDER_XPT; } + @Override protected String[] getPreferredRepositorySearchOrder(LocationProperties properties) { return properties.getMetadataFactorySearchOrder(); } @@ -80,22 +87,27 @@ public class MetadataRepositoryManager extends AbstractRepositoryManager<IInstal /** * Restores metadata repositories specified as system properties. */ + @Override protected String getRepositorySystemProperty() { return "eclipse.p2.metadataRepository"; //$NON-NLS-1$ } + @Override protected int getRepositoryType() { return IRepository.TYPE_METADATA; } + @Override public IMetadataRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException { return loadRepository(location, 0, monitor); } + @Override public IMetadataRepository loadRepository(URI location, int flags, IProgressMonitor monitor) throws ProvisionException { return (IMetadataRepository) loadRepository(location, monitor, null, flags); } + @Override public IMetadataRepository refreshRepository(URI location, IProgressMonitor monitor) throws ProvisionException { return (IMetadataRepository) basicRefreshRepository(location, monitor); } diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/SimpleMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/SimpleMetadataRepositoryFactory.java index a0aff3e54..ed85110a7 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/SimpleMetadataRepositoryFactory.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/SimpleMetadataRepositoryFactory.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 @@ -11,8 +11,6 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.metadata.repository; -import org.eclipse.equinox.internal.p2.repository.CacheManager; - import java.io.*; import java.net.URI; import java.util.Map; @@ -20,6 +18,7 @@ import java.util.jar.JarEntry; import java.util.jar.JarInputStream; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.core.helpers.Tracing; +import org.eclipse.equinox.internal.p2.repository.CacheManager; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.repository.IRepositoryManager; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; @@ -32,6 +31,7 @@ public class SimpleMetadataRepositoryFactory extends MetadataRepositoryFactory { private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$ private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$ + @Override public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) { if (location.getScheme().equals("file")) //$NON-NLS-1$ return new LocalMetadataRepository(getAgent(), location, name, properties); @@ -73,9 +73,7 @@ public class SimpleMetadataRepositoryFactory extends MetadataRepositoryFactory { return localFile; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#load(java.net.URL, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException { long time = 0; final String debugMsg = "Validating and loading metadata repository "; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java index 6a2c4285c..fd5d67f69 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/URLMetadataRepository.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 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 @@ -70,6 +70,7 @@ public class URLMetadataRepository extends AbstractMetadataRepository implements return content; } + @Override public synchronized void initialize(RepositoryState state) { setName(state.Name); setType(state.Type); @@ -88,18 +89,22 @@ public class URLMetadataRepository extends AbstractMetadataRepository implements content = getActualLocation(repoLocation); } + @Override public Collection<IRepositoryReference> getReferences() { return references; } + @Override public boolean isModifiable() { return false; } + @Override public synchronized IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { return IndexProvider.query(this, query, monitor); } + @Override public synchronized IIndex<IInstallableUnit> getIndex(String memberName) { if (InstallableUnit.MEMBER_ID.equals(memberName)) { if (idIndex == null) @@ -115,6 +120,7 @@ public class URLMetadataRepository extends AbstractMetadataRepository implements return null; } + @Override public synchronized Object getManagedProperty(Object client, String memberName, Object key) { if (!(client instanceof IInstallableUnit)) return null; @@ -127,6 +133,7 @@ public class URLMetadataRepository extends AbstractMetadataRepository implements return null; } + @Override public Iterator<IInstallableUnit> everything() { return units.iterator(); } diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/XZedSimpleMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/XZedSimpleMetadataRepositoryFactory.java index 490ff3288..da4fed2f9 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/XZedSimpleMetadataRepositoryFactory.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/XZedSimpleMetadataRepositoryFactory.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 @@ -27,6 +27,7 @@ public class XZedSimpleMetadataRepositoryFactory extends MetadataRepositoryFacto private static final String REPOSITORY_FILENAME = "content.xml.xz"; //$NON-NLS-1$ private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$ + @Override public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) { if (location.getScheme().equals("file")) //$NON-NLS-1$ return new LocalMetadataRepository(getAgent(), location, name, properties); @@ -63,9 +64,7 @@ public class XZedSimpleMetadataRepositoryFactory extends MetadataRepositoryFacto return localFile; } - /* (non-Javadoc) - * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#load(java.net.URL, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException { long time = 0; final String debugMsg = "Validating and loading metadata repository "; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java index e761144e8..05b7f9b48 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 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 @@ -52,9 +52,10 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public RepositoryReferencesHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, REPOSITORY_REFERENCES_ELEMENT); - references = new HashSet<IRepositoryReference>(getOptionalSize(attributes, 4)); + references = new HashSet<>(getOptionalSize(attributes, 4)); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(REPOSITORY_REFERENCE_ELEMENT)) { new RepositoryReferenceHandler(this, attributes, references); @@ -83,6 +84,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { references.add(new RepositoryReference(location, name, type, options)); } + @Override public void startElement(String name, Attributes attributes) { invalidElement(name, attributes); } @@ -93,7 +95,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public InstallableUnitsHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, INSTALLABLE_UNITS_ELEMENT); - units = new ArrayList<InstallableUnitDescription>(getOptionalSize(attributes, 4)); + units = new ArrayList<>(getOptionalSize(attributes, 4)); } public IInstallableUnit[] getUnits() { @@ -105,6 +107,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { return result; } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(INSTALLABLE_UNIT_ELEMENT)) { new InstallableUnitHandler(this, attributes, units); @@ -157,6 +160,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { return MetadataFactory.createInstallableUnit(currentUnit); } + @Override public void startElement(String name, Attributes attributes) { checkCancel(); if (PROPERTIES_ELEMENT.equals(name)) { @@ -254,6 +258,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { } } + @Override protected void finished() { if (isValidXML()) { if (requirementChangesHandler != null) { @@ -335,9 +340,10 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public ApplicabilityScopesHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, APPLICABILITY_SCOPE); - scopes = new ArrayList<IRequirement[]>(getOptionalSize(attributes, 4)); + scopes = new ArrayList<>(getOptionalSize(attributes, 4)); } + @Override public void startElement(String name, Attributes attributes) { if (APPLY_ON.equals(name)) { new ApplicabilityScopeHandler(this, attributes, scopes); @@ -360,6 +366,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { this.scopes = scopes; } + @Override public void startElement(String name, Attributes attributes) { if (REQUIREMENTS_ELEMENT.equals(name)) { children = new RequiredCapabilitiesHandler(this, attributes); @@ -368,6 +375,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { } } + @Override protected void finished() { if (children != null) { scopes.add(children.getRequiredCapabilities()); @@ -380,9 +388,10 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public RequirementsChangeHandler(InstallableUnitHandler parentHandler, Attributes attributes) { super(parentHandler, REQUIREMENT_CHANGES); - requirementChanges = new ArrayList<IRequirementChange>(getOptionalSize(attributes, 4)); + requirementChanges = new ArrayList<>(getOptionalSize(attributes, 4)); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(REQUIREMENT_CHANGE)) { new RequirementChangeHandler(this, attributes, requirementChanges); @@ -403,11 +412,12 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public RequirementChangeHandler(AbstractHandler parentHandler, Attributes attributes, List<IRequirementChange> requirementChanges) { super(parentHandler, REQUIREMENT_CHANGE); - from = new ArrayList<IRequirement>(1); - to = new ArrayList<IRequirement>(1); + from = new ArrayList<>(1); + to = new ArrayList<>(1); this.requirementChanges = requirementChanges; } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(REQUIREMENT_FROM)) { new RequirementChangeEltHandler(this, REQUIREMENT_FROM, attributes, from); @@ -421,6 +431,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { invalidElement(name, attributes); } + @Override protected void finished() { requirementChanges.add(MetadataFactory.createRequirementChange(from.size() == 0 ? null : (IRequirement) from.get(0), to.size() == 0 ? null : (IRequirement) to.get(0))); } @@ -434,6 +445,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { requirement = from; } + @Override public void startElement(String name, Attributes attributes) { if (REQUIREMENT_ELEMENT.equals(name)) new RequirementHandler(this, attributes, requirement); @@ -449,7 +461,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public LifeCycleHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, LIFECYCLE); - lifeCycleRequirement = new ArrayList<IRequirement>(1); + lifeCycleRequirement = new ArrayList<>(1); } public IRequirement getLifeCycleRequirement() { @@ -458,6 +470,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { return lifeCycleRequirement.get(0); } + @Override public void startElement(String name, Attributes attributes) { if (REQUIREMENT_ELEMENT.equals(name)) { new RequirementHandler(this, attributes, lifeCycleRequirement); @@ -472,13 +485,14 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public ProvidedCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, PROVIDED_CAPABILITIES_ELEMENT); - providedCapabilities = new ArrayList<IProvidedCapability>(getOptionalSize(attributes, 4)); + providedCapabilities = new ArrayList<>(getOptionalSize(attributes, 4)); } public IProvidedCapability[] getProvidedCapabilities() { return providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(PROVIDED_CAPABILITY_ELEMENT)) { new ProvidedCapabilityHandler(this, attributes, providedCapabilities); @@ -497,6 +511,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { capabilities.add(MetadataFactory.createProvidedCapability(values[0], values[1], version)); } + @Override public void startElement(String name, Attributes attributes) { invalidElement(name, attributes); } @@ -507,13 +522,14 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public HostRequiredCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, HOST_REQUIREMENTS_ELEMENT); - requiredCapabilities = new ArrayList<IRequirement>(getOptionalSize(attributes, 4)); + requiredCapabilities = new ArrayList<>(getOptionalSize(attributes, 4)); } public IRequirement[] getHostRequiredCapabilities() { return requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(REQUIREMENT_ELEMENT)) { new RequirementHandler(this, attributes, requiredCapabilities); @@ -528,13 +544,14 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public MetaRequiredCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, META_REQUIREMENTS_ELEMENT); - requiredCapabilities = new ArrayList<IRequirement>(getOptionalSize(attributes, 4)); + requiredCapabilities = new ArrayList<>(getOptionalSize(attributes, 4)); } public IRequirement[] getMetaRequiredCapabilities() { return requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(REQUIREMENT_ELEMENT)) { new RequirementHandler(this, attributes, requiredCapabilities); @@ -549,13 +566,14 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public RequiredCapabilitiesHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, REQUIREMENTS_ELEMENT); - requiredCapabilities = new ArrayList<IRequirement>(getOptionalSize(attributes, 4)); + requiredCapabilities = new ArrayList<>(getOptionalSize(attributes, 4)); } public IRequirement[] getRequiredCapabilities() { return requiredCapabilities.toArray(new IRequirement[requiredCapabilities.size()]); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(REQUIREMENT_ELEMENT)) { new RequirementHandler(this, attributes, requiredCapabilities); @@ -604,6 +622,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { } } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(CAPABILITY_FILTER_ELEMENT)) { filterHandler = new TextHandler(this, CAPABILITY_FILTER_ELEMENT, attributes); @@ -614,6 +633,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { } } + @Override protected void finished() { if (!isValidXML()) return; @@ -658,13 +678,14 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public ArtifactsHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, ARTIFACT_KEYS_ELEMENT); String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE); - artifacts = (size != null ? new ArrayList<IArtifactKey>(Integer.parseInt(size)) : new ArrayList<IArtifactKey>(4)); + artifacts = (size != null ? new ArrayList<>(Integer.parseInt(size)) : new ArrayList<>(4)); } public IArtifactKey[] getArtifactKeys() { return artifacts.toArray(new IArtifactKey[artifacts.size()]); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(ARTIFACT_KEY_ELEMENT)) { new ArtifactHandler(this, attributes, artifacts); @@ -685,6 +706,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { artifacts.add(new ArtifactKey(values[0], values[1], version)); } + @Override public void startElement(String name, Attributes attributes) { invalidElement(name, attributes); } @@ -707,6 +729,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { return touchpointType; } + @Override public void startElement(String name, Attributes attributes) { invalidElement(name, attributes); } @@ -721,7 +744,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public TouchpointDataHandler(AbstractHandler parentHandler, Attributes attributes) { super(parentHandler, TOUCHPOINT_DATA_ELEMENT); String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE); - data = (size != null ? new ArrayList<TouchpointInstructionsHandler>(Integer.parseInt(size)) : new ArrayList<TouchpointInstructionsHandler>(4)); + data = (size != null ? new ArrayList<>(Integer.parseInt(size)) : new ArrayList<>(4)); } public ITouchpointData[] getTouchpointData() { @@ -731,6 +754,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { return result; } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT)) { data.add(new TouchpointInstructionsHandler(this, attributes, data)); @@ -747,13 +771,14 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public TouchpointInstructionsHandler(AbstractHandler parentHandler, Attributes attributes, List<TouchpointInstructionsHandler> data) { super(parentHandler, TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT); String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE); - instructions = (size != null ? new LinkedHashMap<String, ITouchpointInstruction>(Integer.parseInt(size)) : new LinkedHashMap<String, ITouchpointInstruction>(4)); + instructions = (size != null ? new LinkedHashMap<>(Integer.parseInt(size)) : new LinkedHashMap<>(4)); } public ITouchpointData getTouchpointData() { return MetadataFactory.createTouchpointData(instructions); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(TOUCHPOINT_DATA_INSTRUCTION_ELEMENT)) { new TouchpointInstructionHandler(this, attributes, instructions); @@ -780,6 +805,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { this.instructions = instructions; } + @Override protected void finished() { if (isValidXML()) { if (key != null) { @@ -850,7 +876,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { public LicensesHandler(ContentHandler parentHandler, Attributes attributes) { super(parentHandler, LICENSES_ELEMENT); String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE); - licenses = (size != null ? new ArrayList<ILicense>(Integer.parseInt(size)) : new ArrayList<ILicense>(2)); + licenses = (size != null ? new ArrayList<>(Integer.parseInt(size)) : new ArrayList<>(2)); } public ILicense[] getLicenses() { @@ -859,6 +885,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { return licenses.toArray(new ILicense[licenses.size()]); } + @Override public void startElement(String name, Attributes attributes) { if (name.equals(LICENSE_ELEMENT)) { new LicenseHandler(this, attributes, licenses); @@ -884,6 +911,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { this.licenses = licenses; } + @Override protected void finished() { if (isValidXML()) { licenses.add(MetadataFactory.createLicense(location, getText())); @@ -904,6 +932,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants { location = parseURIAttribute(attributes, false); } + @Override protected void finished() { if (isValidXML()) { copyright = MetadataFactory.createCopyright(location, getText()); diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java index c4d3d8aa0..89785d3c3 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataWriter.java @@ -75,7 +75,7 @@ public class MetadataWriter extends XMLWriter implements XMLConstants { writeMetaRequirements(iu.getMetaRequirements()); writeProvidedCapabilities(iu.getProvidedCapabilities()); if (simpleRequirements && iu instanceof IInstallableUnitFragment) { - Collection<IRequirement> mergedRequirementsAndFragmentHostForPre36Compatibility = new LinkedHashSet<IRequirement>(iu.getRequirements()); + Collection<IRequirement> mergedRequirementsAndFragmentHostForPre36Compatibility = new LinkedHashSet<>(iu.getRequirements()); mergedRequirementsAndFragmentHostForPre36Compatibility.addAll(((IInstallableUnitFragment) iu).getHost()); writeRequirements(mergedRequirementsAndFragmentHostForPre36Compatibility); } else { diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/p2/metadata/io/IUDeserializer.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/p2/metadata/io/IUDeserializer.java index 63ace1841..07c5baa7b 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/p2/metadata/io/IUDeserializer.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/p2/metadata/io/IUDeserializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 Sonatype, Inc. and others. + * Copyright (c) 2011, 2017 Sonatype, 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 @@ -76,6 +76,7 @@ public class IUDeserializer { } } + @Override protected SAXParser getParser() throws ParserConfigurationException, SAXException { if (parserFactory == null) { throw new SAXException(Messages.XMLParser_No_SAX_Parser); @@ -103,10 +104,12 @@ public class IUDeserializer { // default } + @Override protected void handleRootAttributes(Attributes attributes) { //Nothing to do } + @Override public void startElement(String name, Attributes attributes) { if (INSTALLABLE_UNITS_ELEMENT.equals(name)) { if (unitsHandler == null) { diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java index 790f7d0a5..418f80532 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/AddChildTask.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 AddChildTask extends AbstractMDRTask { URI location; // location of the composite repository URI child; // address of the child to add - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() { validate(); IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java index a900396ca..0a16f9dbe 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/CreateCompositeMetadataRepositoryTask.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 @@ -33,11 +33,9 @@ public class CreateCompositeMetadataRepositoryTask extends AbstractMDRTask { boolean atomic = false; boolean compressed = true; // compress by default boolean failOnExists = false; // should we fail if one 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() { IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); if (manager == null) diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java index 00f4c193c..12554ada8 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java +++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src_ant/org/eclipse/equinox/internal/p2/metadata/repository/ant/RemoveChildTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 IBM Corporation and others. + * Copyright (c) 2008, 2017 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,9 +28,7 @@ public class RemoveChildTask extends AbstractMDRTask { URI child; // address of the child to be removed boolean allChildren; // should we remove all the children? - /* (non-Javadoc) - * @see org.apache.tools.ant.Task#execute() - */ + @Override public void execute() { IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME); if (manager == null) |