diff options
author | Thomas Hallgren | 2009-12-29 18:13:38 +0000 |
---|---|---|
committer | Thomas Hallgren | 2009-12-29 18:13:38 +0000 |
commit | 4a2fb1a7b3cb71832fc296955ab780c614ed7290 (patch) | |
tree | 5904e851f9a1d7493a7f73b0d8435f518c4cf69f | |
parent | 2c4704d140f7190038153ee78f168c89102804e8 (diff) | |
download | rt.equinox.p2-4a2fb1a7b3cb71832fc296955ab780c614ed7290.tar.gz rt.equinox.p2-4a2fb1a7b3cb71832fc296955ab780c614ed7290.tar.xz rt.equinox.p2-4a2fb1a7b3cb71832fc296955ab780c614ed7290.zip |
298458: Add Java 5 Generics to the p2 code base
16 files changed, 89 insertions, 86 deletions
diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath b/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath index 7cdeb7319..64c5e31b7 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/> + <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.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs index 78523cd05..ce1585350 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Thu Aug 16 11:00:59 EDT 2007 +#Tue Dec 29 18:58:34 CET 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning @@ -7,24 +7,24 @@ 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.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore 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=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning @@ -62,7 +62,6 @@ org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning 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.unsafeTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedImport=error @@ -72,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.5 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 @@ -144,7 +143,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF index 85b737656..193c83264 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/META-INF/MANIFEST.MF @@ -26,5 +26,6 @@ Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.equinox.p2.engine, org.eclipse.osgi;bundle-version="[3.4.0,4.0.0)", org.eclipse.equinox.registry;bundle-version="[3.4.0,4.0.0)" -Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1, - J2SE-1.4 +Bundle-RequiredExecutionEnvironment: J2SE-1.5, + J2SE-1.4, + CDC-1.1/Foundation-1.1 diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/build.properties b/bundles/org.eclipse.equinox.p2.garbagecollector/build.properties index f84c26ec6..a8ad90604 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/build.properties +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/build.properties @@ -17,3 +17,5 @@ bin.includes = META-INF/,\ about.html,\ plugin.properties src.includes = about.html +javacTarget=jsr14 +javacSource=1.5 diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/Application.java b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/Application.java index 4bc239944..4927b4513 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/Application.java +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/Application.java @@ -38,7 +38,7 @@ public class Application implements IApplication { */ public Object start(IApplicationContext context) throws Exception { // TODO - do we have to start exemplarySetup here? - Map allArgs = context.getArguments(); + Map<?, ?> allArgs = context.getArguments(); String[] args = (String[]) allArgs.get(IApplicationContext.APPLICATION_ARGS); processArguments(args); // if the user didn't give us a profile id, then use the default SDK one diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java index 8a99c6a5d..1c8d615e7 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/CoreGarbageCollector.java @@ -33,15 +33,15 @@ public class CoreGarbageCollector { * in aRepository that are not mapped to by an IArtifactKey in markSet */ public synchronized void clean(IArtifactKey[] markSet, IArtifactRepository aRepository) { - final Set set = new HashSet(Arrays.asList(markSet)); + final Set<IArtifactKey> set = new HashSet<IArtifactKey>(Arrays.asList(markSet)); ArtifactKeyQuery query = new ArtifactKeyQuery() { - public boolean isMatch(Object candidate) { + public boolean isMatch(IArtifactKey candidate) { return !set.contains(candidate); } }; - IQueryResult inactive = aRepository.query(query, null); - for (Iterator iterator = inactive.iterator(); iterator.hasNext();) { - IArtifactKey key = (IArtifactKey) iterator.next(); + IQueryResult<IArtifactKey> inactive = aRepository.query(query, null); + for (Iterator<IArtifactKey> iterator = inactive.iteratorX(); iterator.hasNext();) { + IArtifactKey key = iterator.next(); aRepository.removeDescriptor(key); if (debugMode) { Tracing.debug("Key removed:" + key); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GCActivator.java b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GCActivator.java index 25916ec6b..ce225b593 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GCActivator.java +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GCActivator.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.garbagecollector; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; + import java.util.*; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -86,11 +88,11 @@ public class GCActivator implements BundleActivator { IPreferencesService prefService = (IPreferencesService) getService(context, IPreferencesService.class.getName()); if (prefService == null) return defaultValue; - List nodes = new ArrayList(); + List<IEclipsePreferences> nodes = new ArrayList<IEclipsePreferences>(); // todo we should look in the instance scope as well but have to be careful that the instance location has been set nodes.add(new ConfigurationScope().getNode(ID)); nodes.add(new DefaultScope().getNode(ID)); - return Boolean.valueOf(prefService.get(key, Boolean.toString(defaultValue), (Preferences[]) nodes.toArray(new Preferences[nodes.size()]))).booleanValue(); + return Boolean.valueOf(prefService.get(key, Boolean.toString(defaultValue), nodes.toArray(new Preferences[nodes.size()]))).booleanValue(); } private void unregisterGCTrigger() { diff --git a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java index 30fe1e1f6..99daefb2b 100644 --- a/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java +++ b/bundles/org.eclipse.equinox.p2.garbagecollector/src/org/eclipse/equinox/internal/p2/garbagecollector/GarbageCollector.java @@ -37,7 +37,7 @@ public class GarbageCollector { /** * Maps IArtifactRepository objects to their respective "marked set" of IArtifactKeys */ - private Map markSet; + private Map<IArtifactRepository, Collection<IArtifactKey>> markSet; final IProvisioningAgent agent; public GarbageCollector() { @@ -46,7 +46,7 @@ public class GarbageCollector { } public void runGC(IProfile profile) { - markSet = new HashMap(); + markSet = new HashMap<IArtifactRepository, Collection<IArtifactKey>>(); if (!traverseMainProfile(profile)) return; @@ -77,10 +77,10 @@ public class GarbageCollector { } private void invokeCoreGC() { - Iterator keyIterator = markSet.keySet().iterator(); + Iterator<IArtifactRepository> keyIterator = markSet.keySet().iterator(); while (keyIterator.hasNext()) { - IArtifactRepository nextRepo = (IArtifactRepository) keyIterator.next(); - IArtifactKey[] keys = (IArtifactKey[]) ((Collection) markSet.get(nextRepo)).toArray(new IArtifactKey[0]); + IArtifactRepository nextRepo = keyIterator.next(); + IArtifactKey[] keys = markSet.get(nextRepo).toArray(new IArtifactKey[0]); MarkSet aMarkSet = new MarkSet(keys, nextRepo); new CoreGarbageCollector().clean(aMarkSet.getKeys(), aMarkSet.getRepo()); } @@ -148,10 +148,10 @@ public class GarbageCollector { if (aProfileMarkSets[i] == null) { continue; } - Collection keys = (Collection) markSet.get(aProfileMarkSets[i].getRepo()); + Collection<IArtifactKey> keys = markSet.get(aProfileMarkSets[i].getRepo()); if (keys == null) { if (addRepositories) { - keys = new HashSet(); + keys = new HashSet<IArtifactKey>(); markSet.put(aProfileMarkSets[i].getRepo(), keys); addKeys(keys, aProfileMarkSets[i].getKeys()); } @@ -161,7 +161,7 @@ public class GarbageCollector { } } - private void addKeys(Collection keyList, IArtifactKey[] keyArray) { + private void addKeys(Collection<IArtifactKey> keyList, IArtifactKey[] keyArray) { for (int i = 0; i < keyArray.length; i++) keyList.add(keyArray[i]); } diff --git a/bundles/org.eclipse.equinox.p2.installer/.classpath b/bundles/org.eclipse.equinox.p2.installer/.classpath index 7cdeb7319..64c5e31b7 100644 --- a/bundles/org.eclipse.equinox.p2.installer/.classpath +++ b/bundles/org.eclipse.equinox.p2.installer/.classpath @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/> + <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.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs index 99a0b3dc6..79ab40b28 100644 --- a/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.installer/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Thu Oct 11 16:46:31 EDT 2007 +#Tue Dec 29 19:06:38 CET 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning @@ -7,24 +7,24 @@ 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.codegen.inlineJsrBytecode=disabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore 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=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning @@ -69,7 +69,6 @@ org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning 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.unsafeTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled @@ -82,7 +81,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.5 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 @@ -154,7 +153,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert diff --git a/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF index 75cf0ac5d..5d60c8b4b 100644 --- a/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.installer/META-INF/MANIFEST.MF @@ -19,8 +19,9 @@ Require-Bundle: org.eclipse.osgi, org.eclipse.swt, org.eclipse.core.net;bundle-version="1.1.0", org.eclipse.equinox.p2.repository;bundle-version="1.0.0" -Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1, - J2SE-1.4 +Bundle-RequiredExecutionEnvironment: J2SE-1.5, + J2SE-1.4, + CDC-1.1/Foundation-1.1 Export-Package: org.eclipse.equinox.internal.p2.installer;x-internal:=true, org.eclipse.equinox.internal.p2.installer.ui;x-internal:=true, org.eclipse.equinox.internal.provisional.p2.installer;x-internal:=true diff --git a/bundles/org.eclipse.equinox.p2.installer/build.properties b/bundles/org.eclipse.equinox.p2.installer/build.properties index 973e370b6..f85c9d6ef 100644 --- a/bundles/org.eclipse.equinox.p2.installer/build.properties +++ b/bundles/org.eclipse.equinox.p2.installer/build.properties @@ -17,3 +17,5 @@ bin.includes = plugin.xml,\ about.html,\ plugin.properties src.includes = about.html +javacTarget=jsr14 +javacSource=1.5 diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java index ff8f828b8..cff24b9ff 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallDescriptionParser.java @@ -16,6 +16,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.*; import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; import org.eclipse.equinox.internal.provisional.p2.installer.InstallDescription; import org.eclipse.equinox.internal.provisional.p2.metadata.VersionedId; @@ -60,12 +61,10 @@ public class InstallDescriptionParser { throw new IllegalStateException("Can't find install description file: " + installerDescription); } } - in = propsURI.toURL().openStream(); - - Properties properties = new Properties(); + Map<String, String> properties; try { - if (in != null) - properties.load(in); + in = propsURI.toURL().openStream(); + properties = CollectionUtils.loadProperties(in); } finally { safeClose(in); } @@ -76,7 +75,7 @@ public class InstallDescriptionParser { initializeProfileProperties(result, properties); // now override the properties from anything interesting in system properties - result = initialize(result, System.getProperties(), base); + result = initialize(result, CollectionUtils.toMap(System.getProperties()), base); return result; } @@ -92,43 +91,43 @@ public class InstallDescriptionParser { return URI.create(uriString.substring(0, slashIndex + 1)); } - private static InstallDescription initialize(InstallDescription description, Properties properties, URI base) { - String property = properties.getProperty(PROP_ARTIFACT_REPOSITORY); + private static InstallDescription initialize(InstallDescription description, Map<String, String> properties, URI base) { + String property = properties.get(PROP_ARTIFACT_REPOSITORY); if (property != null) description.setArtifactRepositories(getURIs(property, base)); - property = properties.getProperty(PROP_METADATA_REPOSITORY); + property = properties.get(PROP_METADATA_REPOSITORY); if (property != null) description.setMetadataRepositories(getURIs(property, base)); - property = properties.getProperty(PROP_IS_AUTO_START); + property = properties.get(PROP_IS_AUTO_START); if (property != null) description.setAutoStart(Boolean.TRUE.toString().equalsIgnoreCase(property)); - property = properties.getProperty(PROP_LAUNCHER_NAME); + property = properties.get(PROP_LAUNCHER_NAME); if (property != null) description.setLauncherName(property); - property = properties.getProperty(PROP_INSTALL_LOCATION); + property = properties.get(PROP_INSTALL_LOCATION); if (property != null) description.setInstallLocation(new Path(property)); - property = properties.getProperty(PROP_AGENT_LOCATION); + property = properties.get(PROP_AGENT_LOCATION); if (property != null) description.setAgentLocation(new Path(property)); - property = properties.getProperty(PROP_BUNDLE_LOCATION); + property = properties.get(PROP_BUNDLE_LOCATION); if (property != null) description.setBundleLocation(new Path(property)); - property = properties.getProperty(PROP_PROFILE_NAME); + property = properties.get(PROP_PROFILE_NAME); if (property != null) description.setProductName(property); // Process the retro root id and rootVersion properties - String id = properties.getProperty(PROP_ROOT_ID); + String id = properties.get(PROP_ROOT_ID); if (id != null) { - String version = properties.getProperty(PROP_ROOT_VERSION); + String version = properties.get(PROP_ROOT_VERSION); try { description.setRoots(new IVersionedId[] {new VersionedId(id, version)}); } catch (IllegalArgumentException e) { @@ -136,10 +135,10 @@ public class InstallDescriptionParser { } } - String rootSpec = properties.getProperty(PROP_ROOTS); + String rootSpec = properties.get(PROP_ROOTS); if (rootSpec != null) { String[] rootList = getArrayFromString(rootSpec, ","); //$NON-NLS-1$ - ArrayList roots = new ArrayList(rootList.length); + ArrayList<IVersionedId> roots = new ArrayList<IVersionedId>(rootList.length); for (int i = 0; i < rootList.length; i++) { try { roots.add(VersionedId.parse(rootList[i])); @@ -148,7 +147,7 @@ public class InstallDescriptionParser { } } if (!roots.isEmpty()) - description.setRoots((IVersionedId[]) roots.toArray(new IVersionedId[roots.size()])); + description.setRoots(roots.toArray(new IVersionedId[roots.size()])); } return description; } @@ -160,9 +159,9 @@ public class InstallDescriptionParser { * @param description * @param properties */ - private static void initializeProfileProperties(InstallDescription description, Properties properties) { + private static void initializeProfileProperties(InstallDescription description, Map<String, String> properties) { //any remaining properties are profile properties - Map profileProperties = new HashMap(properties); + Map<String, String> profileProperties = new HashMap<String, String>(properties); profileProperties.remove(PROP_PROFILE_NAME); profileProperties.remove(PROP_ARTIFACT_REPOSITORY); profileProperties.remove(PROP_METADATA_REPOSITORY); @@ -184,7 +183,7 @@ public class InstallDescriptionParser { */ private static URI[] getURIs(String spec, URI base) { String[] urlSpecs = getArrayFromString(spec, ","); //$NON-NLS-1$ - ArrayList result = new ArrayList(urlSpecs.length); + ArrayList<URI> result = new ArrayList<URI>(urlSpecs.length); for (int i = 0; i < urlSpecs.length; i++) { try { URI uri = URIUtil.fromString(urlSpecs[i]); @@ -196,7 +195,7 @@ public class InstallDescriptionParser { } if (result.isEmpty()) return null; - return (URI[]) result.toArray(new URI[result.size()]); + return result.toArray(new URI[result.size()]); } private static void safeClose(InputStream in) { @@ -215,13 +214,13 @@ public class InstallDescriptionParser { public static String[] getArrayFromString(String list, String separator) { if (list == null || list.trim().equals("")) //$NON-NLS-1$ return new String[0]; - List result = new ArrayList(); + List<String> result = new ArrayList<String>(); for (StringTokenizer tokens = new StringTokenizer(list, separator); tokens.hasMoreTokens();) { String token = tokens.nextToken().trim(); if (!token.equals("")) //$NON-NLS-1$ result.add(token); } - return (String[]) result.toArray(new String[result.size()]); + return result.toArray(new String[result.size()]); } } diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java index cd55840cd..654355ded 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/InstallUpdateProductOperation.java @@ -50,7 +50,7 @@ public class InstallUpdateProductOperation implements IInstallOperation { private IProfileRegistry profileRegistry; private IStatus result; - private ArrayList serviceReferences = new ArrayList(); + private ArrayList<ServiceReference> serviceReferences = new ArrayList<ServiceReference>(); public InstallUpdateProductOperation(BundleContext context, InstallDescription description) { this.bundleContext = context; @@ -61,21 +61,21 @@ public class InstallUpdateProductOperation implements IInstallOperation { * Determine what top level installable units should be installed by the director */ private IInstallableUnit[] computeUnitsToInstall() throws CoreException { - ArrayList result = new ArrayList(); + ArrayList<IInstallableUnit> units = new ArrayList<IInstallableUnit>(); IVersionedId roots[] = installDescription.getRoots(); for (int i = 0; i < roots.length; i++) { IVersionedId root = roots[i]; IInstallableUnit iu = findUnit(root); if (iu != null) - result.add(iu); + units.add(iu); } - return (IInstallableUnit[]) result.toArray(new IInstallableUnit[result.size()]); + return units.toArray(new IInstallableUnit[units.size()]); } /** * This profile is being updated; return the units to uninstall from the profile. */ - private IQueryResult computeUnitsToUninstall(IProfile p) { + private IQueryResult<IInstallableUnit> computeUnitsToUninstall(IProfile p) { return p.query(InstallableUnitQuery.ANY, null); } @@ -85,7 +85,7 @@ public class InstallUpdateProductOperation implements IInstallOperation { private IProfile createProfile() throws ProvisionException { IProfile profile = getProfile(); if (profile == null) { - Map properties = new HashMap(); + Map<String, String> properties = new HashMap<String, String>(); properties.put(IProfile.PROP_INSTALL_FOLDER, installDescription.getInstallLocation().toString()); EnvironmentInfo info = (EnvironmentInfo) ServiceHelper.getService(InstallerActivator.getDefault().getContext(), EnvironmentInfo.class.getName()); String env = "osgi.os=" + info.getOS() + ",osgi.ws=" + info.getWS() + ",osgi.arch=" + info.getOSArch(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ @@ -118,7 +118,7 @@ public class InstallUpdateProductOperation implements IInstallOperation { s = director.provision(request, null, monitor.newChild(90)); } else { monitor.setTaskName(NLS.bind(Messages.Op_Updating, installDescription.getProductName())); - IQueryResult toUninstall = computeUnitsToUninstall(p); + IQueryResult<IInstallableUnit> toUninstall = computeUnitsToUninstall(p); request.removeInstallableUnits(toUninstall); request.addInstallableUnits(toInstall); s = director.provision(request, null, monitor.newChild(90)); @@ -153,12 +153,12 @@ public class InstallUpdateProductOperation implements IInstallOperation { VersionRange range = VersionRange.emptyRange; if (version != null && !version.equals(Version.emptyVersion)) range = new VersionRange(version, true, version, true); - IQuery query = new InstallableUnitQuery(id, range); - Iterator matches = metadataRepoMan.query(query, null).iterator(); + IQuery<IInstallableUnit> query = new InstallableUnitQuery(id, range); + Iterator<IInstallableUnit> matches = metadataRepoMan.query(query, null).iteratorX(); // pick the newest match IInstallableUnit newest = null; while (matches.hasNext()) { - IInstallableUnit candidate = (IInstallableUnit) matches.next(); + IInstallableUnit candidate = matches.next(); if (newest == null || (newest.getVersion().compareTo(candidate.getVersion()) < 0)) newest = candidate; } @@ -235,8 +235,8 @@ public class InstallUpdateProductOperation implements IInstallOperation { } private void postInstall() { - for (Iterator it = serviceReferences.iterator(); it.hasNext();) { - ServiceReference sr = (ServiceReference) it.next(); + for (Iterator<ServiceReference> it = serviceReferences.iterator(); it.hasNext();) { + ServiceReference sr = it.next(); bundleContext.ungetService(sr); } serviceReferences.clear(); diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java index 00212bcee..91dc773c4 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/p2/installer/ui/ProxiesDialog.java @@ -46,7 +46,7 @@ public final class ProxiesDialog { private Button cancelButton; private final IProxyService service; private Shell shell; - private List types; + private List<String> types; private Label statuslabel; public ProxiesDialog(IProxyService service) { @@ -103,7 +103,7 @@ public final class ProxiesDialog { typeCombo.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 3, 1)); //Currently only these three proxy types are supported. for (int i = 0; i < types.size(); i++) { - typeCombo.add((String) types.get(i)); + typeCombo.add(types.get(i)); } typeCombo.addSelectionListener(new SelectionAdapter() { @@ -304,7 +304,7 @@ public final class ProxiesDialog { } private void initTypes() { - types = new ArrayList(); + types = new ArrayList<String>(); types.add(IProxyData.HTTP_PROXY_TYPE); types.add(IProxyData.HTTPS_PROXY_TYPE); types.add(IProxyData.SOCKS_PROXY_TYPE); diff --git a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java index a4bb423c3..b8adcccc7 100644 --- a/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java +++ b/bundles/org.eclipse.equinox.p2.installer/src/org/eclipse/equinox/internal/provisional/p2/installer/InstallDescription.java @@ -32,7 +32,7 @@ public class InstallDescription { private URI[] metadataRepos; private String productName; private IVersionedId[] roots; - private final Map profileProperties = new HashMap(); + private final Map<String, String> profileProperties = new HashMap<String, String>(); /** * Returns the p2 agent location, or <code>null</code> to indicate @@ -85,7 +85,7 @@ public class InstallDescription { /** * Returns the profile properties for this install. */ - public Map getProfileProperties() { + public Map<String, String> getProfileProperties() { return profileProperties; } @@ -139,7 +139,7 @@ public class InstallDescription { * Supplies a set of profile properties to be added when the profile is created. * @param properties the profile properties to be added */ - public void setProfileProperties(Map properties) { + public void setProfileProperties(Map<String, String> properties) { profileProperties.putAll(properties); } |