Program: 102087
Project: 102087
Buggy source:
/** 
 * @param < V >
 * @param parent
 * @param tableProvider
 * @param columnProviders
 */
public <V>Table(final Composite parent,final TableProvider<T> tableProvider,final ColumnProvider<T,V>... columnProviders){
  viewer=new TableViewer(parent);
  viewer.setContentProvider(new IStructuredContentProvider(){
    @Override public void dispose(){
    }
    @Override public Object[] getElements(    final Object inputElement){
      return tableProvider.getElements();
    }
    @Override public void inputChanged(    final Viewer viewer,    final Object oldInput,    final Object newInput){
    }
  }
);
  ColumnViewerToolTipSupport.enableFor(viewer);
  final org.eclipse.swt.widgets.Table table=viewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  this.columns=new ArrayList<TableViewerColumn>();
  for (  final ColumnProvider<T,V> columnProvider : columnProviders) {
    final TableViewerColumn viewerCol=new TableViewerColumn(viewer,columnProvider.getAlignment());
    this.columns.add(viewerCol);
    viewerCol.setLabelProvider(new ColumnLabelProvider(){
      @SuppressWarnings("String_Node_Str") @Override public Image getImage(      final Object element){
        if (columnProvider.getAlignment() != SWT.LEFT)         return null;
        return columnProvider.getImage((T)element);
      }
      @SuppressWarnings("String_Node_Str") @Override public String getText(      final Object element){
        return columnProvider.getText((T)element);
      }
      @SuppressWarnings("String_Node_Str") @Override public String getToolTipText(      final Object element){
        return columnProvider.getToolTip((T)element);
      }
    }
);
    viewerCol.setEditingSupport(new EditingSupport(viewer){
      @SuppressWarnings("String_Node_Str") @Override protected boolean canEdit(      final Object element){
        return columnProvider.isEditable((T)element);
      }
      @Override protected CellEditor getCellEditor(      final Object element){
        try {
          return columnProvider.getEditorClass().getConstructor(Composite.class).newInstance(table);
        }
 catch (        final Exception error) {
          throw new RuntimeException(error);
        }
      }
      @SuppressWarnings("String_Node_Str") @Override protected Object getValue(      final Object element){
        return columnProvider.getValue((T)element);
      }
      @SuppressWarnings("String_Node_Str") @Override protected void setValue(      final Object element,      final Object value){
        columnProvider.setValue((T)element,(V)value);
        viewer.update(element,null);
      }
    }
);
    final TableColumn col=viewerCol.getColumn();
    if (columnProvider.getName() != null) {
      col.setText(columnProvider.getName());
    }
 else     if (columnProvider.getImage() != null) {
      col.setImage(columnProvider.getImage());
    }
    col.setMoveable(false);
    col.setResizable(columnProvider.isResizable());
  }
  final Listener paintListener=new Listener(){
    @Override @SuppressWarnings("String_Node_Str") public void handleEvent(    final Event event){
      final ColumnProvider<T,V> columnProvider=columnProviders[event.index];
      final Image image=(columnProvider.getAlignment() == SWT.LEFT ? null : columnProvider.getImage((T)event.item.getData()));
      if (image == null)       return;
      final int cellWidth=table.getColumn(event.index).getWidth();
switch (event.type) {
case SWT.MeasureItem:
{
          final Rectangle rect=image.getBounds();
          event.width=cellWidth;
          event.height=Math.max(event.height,rect.height);
          break;
        }
case SWT.PaintItem:
{
        final Rectangle rect=image.getBounds();
        final int xOffset=(cellWidth - rect.width) / 2;
        final int yOffset=(event.height - rect.height) / 2;
        event.gc.drawImage(image,event.x + xOffset,event.y + yOffset);
        break;
      }
  }
}
}
;
table.addListener(SWT.MeasureItem,paintListener);
table.addListener(SWT.PaintItem,paintListener);
viewer.setSorter(new ViewerSorter(){
private final Integer[] indexes;
{
  final List<Integer> indexes=new ArrayList<Integer>();
  for (int ndx=0, len=columnProviders.length; ndx < len; ++ndx)   if (columnProviders[ndx].isSortable())   indexes.add(ndx);
  this.indexes=indexes.toArray(new Integer[indexes.size()]);
}
@SuppressWarnings("String_Node_Str") @Override public int compare(final Viewer viewer,final Object element1,final Object element2){
  for (  final Integer ndx : indexes) {
    final int result=columnProviders[ndx].compare((T)element1,(T)element2);
    if (result != 0)     return result;
  }
  return 0;
}
}
);
}

Fixed version (ground truth):
/** 
 * @param < V >
 * @param parent parent composite
 * @param tableStyle table style 
 * @param tableProvider table provider
 * @param columnProviders column providers
 */
public <V>Table(final Composite parent,final int tableStyle,final TableProvider<T> tableProvider,final ColumnProvider<T,V>... columnProviders){
  if (tableStyle == -1) {
    viewer=new TableViewer(parent);
  }
 else {
    viewer=new TableViewer(parent,tableStyle);
  }
  viewer.setContentProvider(new IStructuredContentProvider(){
    @Override public void dispose(){
    }
    @Override public Object[] getElements(    final Object inputElement){
      return tableProvider.getElements();
    }
    @Override public void inputChanged(    final Viewer viewer,    final Object oldInput,    final Object newInput){
    }
  }
);
  ColumnViewerToolTipSupport.enableFor(viewer);
  final org.eclipse.swt.widgets.Table table=viewer.getTable();
  table.setHeaderVisible(true);
  table.setLinesVisible(true);
  table.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  this.columns=new ArrayList<TableViewerColumn>();
  for (  final ColumnProvider<T,V> columnProvider : columnProviders) {
    final TableViewerColumn viewerCol=new TableViewerColumn(viewer,columnProvider.getAlignment());
    this.columns.add(viewerCol);
    viewerCol.setLabelProvider(new ColumnLabelProvider(){
      @SuppressWarnings("String_Node_Str") @Override public Image getImage(      final Object element){
        if (columnProvider.getAlignment() != SWT.LEFT)         return null;
        return columnProvider.getImage((T)element);
      }
      @SuppressWarnings("String_Node_Str") @Override public String getText(      final Object element){
        return columnProvider.getText((T)element);
      }
      @SuppressWarnings("String_Node_Str") @Override public String getToolTipText(      final Object element){
        return columnProvider.getToolTip((T)element);
      }
    }
);
    viewerCol.setEditingSupport(new EditingSupport(viewer){
      @SuppressWarnings("String_Node_Str") @Override protected boolean canEdit(      final Object element){
        return columnProvider.isEditable((T)element);
      }
      @Override protected CellEditor getCellEditor(      final Object element){
        try {
          return columnProvider.getEditorClass().getConstructor(Composite.class).newInstance(table);
        }
 catch (        final Exception error) {
          throw new RuntimeException(error);
        }
      }
      @SuppressWarnings("String_Node_Str") @Override protected Object getValue(      final Object element){
        return columnProvider.getValue((T)element);
      }
      @SuppressWarnings("String_Node_Str") @Override protected void setValue(      final Object element,      final Object value){
        columnProvider.setValue((T)element,(V)value);
        viewer.update(element,null);
      }
    }
);
    final TableColumn col=viewerCol.getColumn();
    if (columnProvider.getName() != null) {
      col.setText(columnProvider.getName());
    }
 else     if (columnProvider.getImage() != null) {
      col.setImage(columnProvider.getImage());
    }
    col.setMoveable(false);
    col.setResizable(columnProvider.isResizable());
  }
  final Listener paintListener=new Listener(){
    @Override @SuppressWarnings("String_Node_Str") public void handleEvent(    final Event event){
      final ColumnProvider<T,V> columnProvider=columnProviders[event.index];
      final Image image=(columnProvider.getAlignment() == SWT.LEFT ? null : columnProvider.getImage((T)event.item.getData()));
      if (image == null)       return;
      final int cellWidth=table.getColumn(event.index).getWidth();
switch (event.type) {
case SWT.MeasureItem:
{
          final Rectangle rect=image.getBounds();
          event.width=cellWidth;
          event.height=Math.max(event.height,rect.height);
          break;
        }
case SWT.PaintItem:
{
        final Rectangle rect=image.getBounds();
        final int xOffset=(cellWidth - rect.width) / 2;
        final int yOffset=(event.height - rect.height) / 2;
        event.gc.drawImage(image,event.x + xOffset,event.y + yOffset);
        break;
      }
  }
}
}
;
table.addListener(SWT.MeasureItem,paintListener);
table.addListener(SWT.PaintItem,paintListener);
viewer.setSorter(new ViewerSorter(){
private final Integer[] indexes;
{
  final List<Integer> indexes=new ArrayList<Integer>();
  for (int ndx=0, len=columnProviders.length; ndx < len; ++ndx)   if (columnProviders[ndx].isSortable())   indexes.add(ndx);
  this.indexes=indexes.toArray(new Integer[indexes.size()]);
}
@SuppressWarnings("String_Node_Str") @Override public int compare(final Viewer viewer,final Object element1,final Object element2){
  for (  final Integer ndx : indexes) {
    final int result=columnProviders[ndx].compare((T)element1,(T)element2);
    if (result != 0)     return result;
  }
  return 0;
}
}
);
}