Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Daniel2013-12-10 05:27:39 -0500
committerKrzysztof Daniel2013-12-10 05:27:39 -0500
commitac04b8c07dd5eab87eeb337bdbea929d6e1dd247 (patch)
tree52f588b1eba9b9203b9bf539b6d52ed861810723 /bundles/org.eclipse.equinox.p2.ui.discovery
parenta2344e5ad39e041ee5e822d8bddc4a71bdcd3c03 (diff)
downloadrt.equinox.p2-ac04b8c07dd5eab87eeb337bdbea929d6e1dd247.tar.gz
rt.equinox.p2-ac04b8c07dd5eab87eeb337bdbea929d6e1dd247.tar.xz
rt.equinox.p2-ac04b8c07dd5eab87eeb337bdbea929d6e1dd247.zip
bug 423628 - False positives warnings in the official build.I20131211-0800I20131210-2000I20131210-0800
False positives are caused by projects settings being different than build settings. Typical example is that project is configured to warn about local variable hiding a field, and suppression is added, but the regular releng build is not configured to warn, and it finds unnecessary suppression. I have did following things: * fixed warnings that I was able to fix (renamed variables, added generics, comments, etc, etc). * reduced the number of warnings in tests * commented warnings that must not be suppresed in the workspace unless we want "Unnecessary @SuppressWarnings" at build time. Change-Id: Iab2c962e5c331eab170b5f6e08d9bb29d05f0cc4
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.discovery')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java18
2 files changed, 23 insertions, 21 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java
index 677cb2e73..c68ac0ede 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/util/ControlListViewer.java
@@ -214,13 +214,13 @@ public abstract class ControlListViewer extends StructuredViewer {
doUpdateContent();
}
- private void updateSize(@SuppressWarnings("hiding") Control control) {
- if (control == null) {
+ private void updateSize(Control c) {
+ if (c == null) {
return;
}
// XXX need a small offset in case the list has a scroll bar
- Point size = control.computeSize(scrolled.getClientArea().width - 20, SWT.DEFAULT, true);
- control.setSize(size);
+ Point size = c.computeSize(scrolled.getClientArea().width - 20, SWT.DEFAULT, true);
+ c.setSize(size);
scrolled.setMinSize(size);
}
@@ -341,9 +341,8 @@ public abstract class ControlListViewer extends StructuredViewer {
}
protected void handleOpen() {
- @SuppressWarnings("hiding")
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
+ Control c = getControl();
+ if (c != null && !c.isDisposed()) {
ISelection selection = getSelection();
fireOpen(new OpenEvent(this, selection));
}
@@ -415,14 +414,17 @@ public abstract class ControlListViewer extends StructuredViewer {
}
}
- @SuppressWarnings({"unchecked", "rawtypes"})
+ @SuppressWarnings({"rawtypes"})
@Override
protected void setSelectionToWidget(List list, boolean reveal) {
if (list != null) {
+ //see bug 423628. This should be suppressed as:
+ //1. it will cause warning at build time.
+ //2. should be possible to fix once swt/jface enables generics for good.
HashSet<Object> elements = new HashSet<Object>(list);
Control[] children = control.getChildren();
- for (Control control : children) {
- ControlListItem child = (ControlListItem) control;
+ for (Control c : children) {
+ ControlListItem child = (ControlListItem) c;
boolean selected = elements.contains(child.getData());
if (selected != child.isSelected()) {
child.setSelected(selected);
@@ -434,8 +436,8 @@ public abstract class ControlListViewer extends StructuredViewer {
}
} else {
Control[] children = control.getChildren();
- for (Control control : children) {
- ControlListItem child = (ControlListItem) control;
+ for (Control c : children) {
+ ControlListItem child = (ControlListItem) c;
if (child.isSelected()) {
child.setSelected(false);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java
index b096f8372..b9ad40662 100644
--- a/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java
+++ b/bundles/org.eclipse.equinox.p2.ui.discovery/src/org/eclipse/equinox/internal/p2/ui/discovery/wizards/CatalogViewer.java
@@ -325,8 +325,8 @@ public class CatalogViewer extends FilteredViewer {
@Override
protected StructuredViewer doCreateViewer(Composite container) {
- @SuppressWarnings("hiding")
- StructuredViewer viewer = new ControlListViewer(container, SWT.BORDER) {
+
+ StructuredViewer _viewer = new ControlListViewer(container, SWT.BORDER) {
@Override
protected ControlListItem<?> doCreateItem(Composite parent, Object element) {
return doCreateViewerItem(parent, element);
@@ -334,14 +334,14 @@ public class CatalogViewer extends FilteredViewer {
};
contentProvider = doCreateContentProvider();
contentProvider.setHasCategories(isShowCategories());
- viewer.setContentProvider(contentProvider);
- viewer.setSorter(new ViewerSorter() {
+ _viewer.setContentProvider(contentProvider);
+ _viewer.setSorter(new ViewerSorter() {
CatalogCategoryComparator categoryComparator = new CatalogCategoryComparator();
CatalogItemComparator itemComparator = new CatalogItemComparator();
@Override
- public int compare(@SuppressWarnings("hiding") Viewer viewer, Object o1, Object o2) {
+ public int compare(Viewer v, Object o1, Object o2) {
CatalogCategory cat1 = getCategory(o1);
CatalogCategory cat2 = getCategory(o2);
@@ -363,7 +363,7 @@ public class CatalogViewer extends FilteredViewer {
if (cat1 == cat2 && o1 instanceof CatalogItem && o2 instanceof CatalogItem) {
return itemComparator.compare((CatalogItem) o1, (CatalogItem) o2);
}
- return super.compare(viewer, o1, o2);
+ return super.compare(v, o1, o2);
}
return i;
}
@@ -388,15 +388,15 @@ public class CatalogViewer extends FilteredViewer {
});
resources = new DiscoveryResources(container.getDisplay());
- viewer.getControl().addDisposeListener(new DisposeListener() {
+ _viewer.getControl().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
resources.dispose();
if (catalog != null)
catalog.dispose();
}
});
- viewer.addFilter(new Filter());
- return viewer;
+ _viewer.addFilter(new Filter());
+ return _viewer;
}
protected CatalogContentProvider doCreateContentProvider() {

Back to the top