Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2015-02-23 19:30:43 +0000
committerAlexander Kurtakov2015-02-24 17:02:51 +0000
commitf92c74ac081d929a7ce96a85b26bf60b5364a101 (patch)
tree5a1aa1399e9457f34e46d10ae3eaadeeadc3e662
parent35349322363fd8fd75eb82abba9cb6ee0a86bb1a (diff)
downloadrt.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>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java7
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java8
21 files changed, 79 insertions, 98 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
index 54771a068..1ec3b397a 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
@@ -31,7 +31,7 @@ Export-Package: org.eclipse.equinox.internal.p2.artifact.processing;x-friends:="
org.eclipse.equinox.p2.ui,
org.eclipse.equinox.p2.publisher,
org.eclipse.equinox.p2.updatesite"
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.5.0,4.0.0)",
+Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0.0)",
org.eclipse.equinox.registry,
org.eclipse.equinox.p2.metadata
Import-Package: javax.xml.parsers,
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 359b5c47e..fd012d359 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.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
@@ -11,6 +11,7 @@
* Cloudsmith Inc. - query indexes
* Sonatype Inc - ongoing development
* EclipseSource - file locking and ongoing development
+ * Red Hat Inc. - Fix compiler problems from generified IAdaptable#getAdapter
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository.simple;
@@ -220,13 +221,13 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
private static final String ARTIFACT_FOLDER = "artifact.folder"; //$NON-NLS-1$
private static final String ARTIFACT_UUID = "artifact.uuid"; //$NON-NLS-1$
static final private String BLOBSTORE = ".blobstore/"; //$NON-NLS-1$
- static final private String[][] PACKED_MAPPING_RULES = { {"(& (classifier=osgi.bundle) (format=packed))", "${repoUrl}/plugins/${id}_${version}.jar.pack.gz"}, //$NON-NLS-1$//$NON-NLS-2$
+ static final private String[][] PACKED_MAPPING_RULES = {{"(& (classifier=osgi.bundle) (format=packed))", "${repoUrl}/plugins/${id}_${version}.jar.pack.gz"}, //$NON-NLS-1$//$NON-NLS-2$
{"(& (classifier=osgi.bundle))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
{"(& (classifier=binary))", "${repoUrl}/binary/${id}_${version}"}, //$NON-NLS-1$ //$NON-NLS-2$
{"(& (classifier=org.eclipse.update.feature) (format=packed))", "${repoUrl}/features/${id}_${version}.jar.pack.gz"}, //$NON-NLS-1$//$NON-NLS-2$
{"(& (classifier=org.eclipse.update.feature))", "${repoUrl}/features/${id}_${version}.jar"}}; //$NON-NLS-1$//$NON-NLS-2$
- static final private String[][] DEFAULT_MAPPING_RULES = { {"(& (classifier=osgi.bundle))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
+ static final private String[][] DEFAULT_MAPPING_RULES = {{"(& (classifier=osgi.bundle))", "${repoUrl}/plugins/${id}_${version}.jar"}, //$NON-NLS-1$//$NON-NLS-2$
{"(& (classifier=binary))", "${repoUrl}/binary/${id}_${version}"}, //$NON-NLS-1$ //$NON-NLS-2$
{"(& (classifier=org.eclipse.update.feature))", "${repoUrl}/features/${id}_${version}.jar"}}; //$NON-NLS-1$//$NON-NLS-2$
private static final String JAR_EXTENSION = ".jar"; //$NON-NLS-1$
@@ -694,9 +695,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return mirrors.getMirrorLocation(baseLocation, monitor);
}
- // don't suppress the warning as it will cause warnings in the official build
- // see bug 423628. Entire hierarchy should be refactored to use generics.
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
// if we are adapting to file or writable repositories then make sure we have a file location
if (adapter == IFileArtifactRepository.class)
if (!isLocal())
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
index e0f8a77df..587b0df3e 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
@@ -7,7 +7,7 @@ Bundle-Activator: org.eclipse.equinox.internal.provisional.p2.directorywatcher.A
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.equinox.internal.provisional.p2.directorywatcher;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation"
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0)"
+Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.equinox.internal.p2.artifact.repository.simple,
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
index d7f4cf9f6..96400552d 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
@@ -1,11 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Code 9 and others. All rights reserved. This
+ * Copyright (c) 2008, 2015 Code 9 and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Code 9 - initial API and implementation
+ * Red Hat Inc. - Fix compiler problems from generified IAdaptable#getAdapter
******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
@@ -324,9 +325,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
return setProperty(key, value, new NullProgressMonitor());
}
- // don't suppress the warning as it will cause warnings in the official build
- // see bug 423628. Entire hierarchy should be refactored to use generics.
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return innerRepo.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
index 9a1bd9024..2c75f37ef 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
@@ -5,7 +5,7 @@ Bundle-SymbolicName: org.eclipse.equinox.p2.ui.importexport;singleton:=true
Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
+ org.eclipse.core.runtime;bundle-version="[3.11.0,4.0.0)",
org.eclipse.equinox.p2.ui,
org.eclipse.equinox.p2.extensionlocation,
org.eclipse.equinox.p2.metadata;bundle-version="2.1.0",
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java
index d53653568..8c1a17377 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/IUDetail.java
@@ -33,12 +33,10 @@ public class IUDetail implements IAdaptable {
return referredRepo;
}
- // 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 starts using generics
- public Object getAdapter(Class adapter) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Class<T> adapter) {
if (IInstallableUnit.class.equals(adapter))
- return iu;
+ return (T) iu;
return null;
}
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);
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF
index 6aea12f30..f969c9508 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.updatesite/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Bundle-Localization: plugin
Export-Package: org.eclipse.equinox.internal.p2.updatesite;x-friends:="org.eclipse.pde.build",
org.eclipse.equinox.internal.p2.updatesite.artifact;x-internal:=true,
org.eclipse.equinox.internal.p2.updatesite.metadata;x-internal:=true
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0.0)",
+Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0.0)",
org.eclipse.equinox.p2.metadata.repository;bundle-version="0.1.0",
org.eclipse.equinox.p2.artifact.repository;bundle-version="0.1.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
index dc2944be6..31d2cea5e 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/artifact/UpdateSiteArtifactRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 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.updatesite.artifact;
@@ -188,10 +189,7 @@ public class UpdateSiteArtifactRepository implements IArtifactRepository {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
- // don't disable this warning because it will cause build-time warning.
- // see bug 423628.
- // fix once the entire hierarchy adopts generics.
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return delegate.getAdapter(adapter);
}
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
index 49239eb5c..e4bcb0130 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/metadata/UpdateSiteMetadataRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 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.updatesite.metadata;
@@ -184,10 +185,7 @@ public class UpdateSiteMetadataRepository implements IMetadataRepository {
throw new UnsupportedOperationException("Repository not modifiable: " + location); //$NON-NLS-1$
}
- // don't disable this warning because it will cause build-time warning.
- // see bug 423628.
- // fix once the entire hierarchy adopts generics.
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> adapter) {
return delegate.getAdapter(adapter);
}

Back to the top