diff options
author | Alexander Kurtakov | 2015-02-23 19:30:43 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-02-24 17:02:51 +0000 |
commit | f92c74ac081d929a7ce96a85b26bf60b5364a101 (patch) | |
tree | 5a1aa1399e9457f34e46d10ae3eaadeeadc3e662 /bundles/org.eclipse.equinox.p2.ui | |
parent | 35349322363fd8fd75eb82abba9cb6ee0a86bb1a (diff) | |
download | rt.equinox.p2-f92c74ac081d929a7ce96a85b26bf60b5364a101.tar.gz rt.equinox.p2-f92c74ac081d929a7ce96a85b26bf60b5364a101.tar.xz rt.equinox.p2-f92c74ac081d929a7ce96a85b26bf60b5364a101.zip |
Bug 460627 - Fix compiler problems from generified IAdaptable#getAdapter
Generify where needed and bump the min version requirement for
o.e.core.runtime and o.e.equinox.common to ensure that generified
dependency will be used.
Change-Id: I3e177a3c8384b5aaabe4c77c949e9802e53923b1
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui')
12 files changed, 58 insertions, 69 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF index 68309f83d..ad83d22be 100644 --- a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF @@ -32,7 +32,7 @@ Export-Package: org.eclipse.equinox.internal.p2.ui; org.eclipse.equinox.internal.p2.ui.viewers;x-friends:="org.eclipse.equinox.p2.ui.admin,org.eclipse.equinox.p2.ui.sdk.scheduler,org.eclipse.equinox.p2.ui.importexport", org.eclipse.equinox.p2.ui;version="2.0.0" Require-Bundle: org.eclipse.ui;bundle-version="3.107.0", - org.eclipse.core.runtime, + org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)", org.eclipse.core.expressions, org.eclipse.equinox.security.ui;bundle-version="[1.0.0,2.0.0)" Import-Package: com.ibm.icu.text, diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java index c194b8c94..bd7ad9026 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java @@ -142,7 +142,7 @@ public class ProvUI { return (T) object; if (object instanceof IAdaptable) // Ideally, we would use Class.cast here but it was introduced in Java 1.5 - return (T) ((IAdaptable) object).getAdapter(adapterType); + return ((IAdaptable) object).getAdapter(adapterType); return null; } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java index 97fd136ba..8fb518397 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui; @@ -27,11 +28,7 @@ import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository; public class ProvUIAdapterFactory implements IAdapterFactory { private static final Class<?>[] CLASSES = new Class[] {IInstallableUnit.class, IProfile.class, IRepository.class, IMetadataRepository.class, IArtifactRepository.class}; - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - @SuppressWarnings("unchecked") - public Object getAdapter(Object adaptableObject, Class adapterType) { + public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { return ProvUI.getAdapter(adaptableObject, adapterType); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java index 28d5a4c6e..28596ad10 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -46,14 +47,12 @@ public class ArtifactElement extends ProvElement { return repo.getArtifactDescriptors(key); } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IArtifactRepository.class) - return getArtifactRepository(); + return (T) getArtifactRepository(); if (adapter == IArtifactKey.class) - return getArtifactKey(); + return (T) getArtifactKey(); return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java index 75396a3c1..83f88d89e 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -42,14 +43,12 @@ public class ArtifactRepositoryElement extends RemoteQueriedElement implements I this.isEnabled = isEnabled; } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IArtifactRepository.class) - return getRepository(null); + return (T) getRepository(null); if (adapter == IRepository.class) - return getRepository(null); + return (T) getRepository(null); return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java index 079ae21a9..a840b8694 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.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 @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Sonatype, Inc. - ongoing development - * Red Hat, Inc. - support for remediation page + * Red Hat, Inc. - support for remediation page, generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -19,7 +19,8 @@ import org.eclipse.core.runtime.SubMonitor; import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.p2.ui.*; import org.eclipse.equinox.p2.engine.*; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IRequirement; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.p2.planner.IPlanner; import org.eclipse.equinox.p2.planner.IProfileChangeRequest; @@ -98,12 +99,10 @@ public class AvailableIUElement extends QueriedElement implements IIUElement { return iu.getId(); } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IInstallableUnit.class) - return iu; + return (T) iu; return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java index 9cfa06562..7d90524de 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -49,12 +50,10 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement return null; } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IInstallableUnit.class) - return getIU(); + return (T) getIU(); return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java index 940d84a73..fbc81c3ed 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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,13 +7,15 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat Inc. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; import java.util.Collection; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.equinox.internal.p2.ui.*; -import org.eclipse.equinox.p2.metadata.*; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.IRequirement; import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription; /** @@ -48,12 +50,10 @@ public class InstalledIUElement extends QueriedElement implements IIUElement { return iu.getId(); } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IInstallableUnit.class) - return iu; + return (T) iu; return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java index b4e2173bc..78c543c81 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -53,14 +54,12 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor this.isEnabled = isEnabled; } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IMetadataRepository.class) - return getQueryable(); + return (T) getQueryable(); if (adapter == IRepository.class) - return getQueryable(); + return (T) getQueryable(); return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java index 83d6b8cc1..b4af9bfbe 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -28,12 +29,10 @@ public class ProfileElement extends RemoteQueriedElement { this.profileId = profileId; } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IProfile.class) - return getQueryable(); + return (T) getQueryable(); return super.getAdapter(adapter); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java index 91dd328a6..3b48e50e6 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -36,14 +37,12 @@ public abstract class ProvElement implements IWorkbenchAdapter, IAdaptable { this.parent = parent; } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IWorkbenchAdapter.class) - return this; + return (T) this; if ((adapter == IDeferredWorkbenchAdapter.class) && this instanceof IDeferredWorkbenchAdapter) - return this; + return (T) this; return null; } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java index efe0ac131..15da99a69 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 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. - Fix compiler problems from generified IAdaptable#getAdapter *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.model; @@ -57,12 +58,10 @@ public class RollbackProfileElement extends RemoteQueriedElement { return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG).format(new Date(timestamp)); } - // don't suppress this warning as it will cause build-time warning - // see bug 423628. This should be possible to fix once - // the entire hierarchy adopts generics - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + public <T> T getAdapter(Class<T> adapter) { if (adapter == IProfile.class) - return getProfileSnapshot(new NullProgressMonitor()); + return (T) getProfileSnapshot(new NullProgressMonitor()); return super.getAdapter(adapter); } |