diff options
author | Alexander Kurtakov | 2015-02-27 09:16:10 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-03-23 09:36:24 +0000 |
commit | 09155e9ddb667a364a0be35f73cb6da662154a33 (patch) | |
tree | b63bf87fc4870884cc0b0d475074915f7fc4c16c /bundles/org.eclipse.equinox.frameworkadmin.equinox | |
parent | 97cbe376383b753aa4b568950e803bef71fbdb27 (diff) | |
download | rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.tar.gz rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.tar.xz rt.equinox.p2-09155e9ddb667a364a0be35f73cb6da662154a33.zip |
Bug 460967 - Use type safe service retrieving
Instead of retrieving services based on their String class name there is
newer implementation that takes the class directly and returns the
correct class preventing casts.
Change-Id: I817c47b702001b739a07a54f4fd8dd72ae9750aa
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox')
2 files changed, 8 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java index 74df5887b..97f044a48 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Bug 460967 *******************************************************************************/ package org.eclipse.equinox.internal.frameworkadmin.equinox; @@ -165,8 +166,8 @@ public class EquinoxBundlesState implements BundlesState { Properties platformProperties = new Properties(); // set default value - ServiceReference<?> environmentRef = context.getServiceReference(EnvironmentInfo.class); - EnvironmentInfo environment = environmentRef == null ? null : (EnvironmentInfo) context.getService(environmentRef); + ServiceReference<EnvironmentInfo> environmentRef = context.getServiceReference(EnvironmentInfo.class); + EnvironmentInfo environment = environmentRef == null ? null : context.getService(environmentRef); if (environment != null) { try { String nl = Locale.getDefault().toString(); diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java index c8e646fbf..f850c7c09 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxManipulatorImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. + * Copyright (c) 2007, 2015 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 @@ -7,7 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Red Hat, Inc - bug 305712 + * Red Hat, Inc - bug 305712, bug 460967 *******************************************************************************/ package org.eclipse.equinox.internal.frameworkadmin.equinox; @@ -283,8 +283,8 @@ public class EquinoxManipulatorImpl implements Manipulator { } // 2. Create a Manipulator object fully initialized to the current running fw. - ServiceReference<?> reference = context.getServiceReference(StartLevel.class.getName()); - StartLevel startLevel = (StartLevel) context.getService(reference); + ServiceReference<StartLevel> reference = context.getServiceReference(StartLevel.class); + StartLevel startLevel = context.getService(reference); Bundle[] bundles = context.getBundles(); BundleInfo[] bInfos = new BundleInfo[bundles.length]; for (int i = 0; i < bundles.length; i++) { |