Skip to content

Commit

Permalink
remove unchecked warnings
Browse files Browse the repository at this point in the history
Depending on the amount of warnings on project the warning has been
disabled, Suppressed or solved
To get a clean Problems View on ancient code
  • Loading branch information
EcljpseB0T authored and jukzi committed Dec 5, 2023
1 parent 75bd2e3 commit 6e19205
Show file tree
Hide file tree
Showing 34 changed files with 18 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void changeApplicationLocale(String localeString) {
* @param children
* The list of {@link MUIElement}s that should be checked for Locale updates.
*/
@SuppressWarnings({ "rawtypes" })
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void updateLocalization(List<? extends MUIElement> children) {
for (MUIElement element : children) {
if (element instanceof MElementContainer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ private MPart addPart(MPart providedPart, MPart localPart) {
addToLastContainer(category, providedPart);
} else {
// add the part to the container
@SuppressWarnings("unchecked")
MElementContainer<MPartSashContainerElement> container = containers.get(0);
MPlaceholder placeholder = providedPart.getCurSharedRef();
if (placeholder == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public int compare(ServiceReference<DirtyFileProvider> o1, ServiceReference<Dirt
}
}
return new DirtyFileProvider() {
@SuppressWarnings("unchecked")
@Override
public Map<IFile, IDocument> dirtyFiles() {
return Collections.EMPTY_MAP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ protected void buttonPressed(int buttonId) {
}
}

@SuppressWarnings("unchecked")
@Override
protected void updateButtonsEnableState(IStatus status) {
Button okButton = getOkButton();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ void handleNonVisibleSelection(ISelection selection) {
* columns. Takes care of various enablements.
*/
void handleVisibleSelection(ISelection selection) {
@SuppressWarnings("unchecked")
List<T> selVCols = ((IStructuredSelection) selection).toList();
List<T> allVCols = getVisible();
toNonVisibleBtt.setEnabled(selVCols.size() > 0 && allVCols.size() > selVCols.size());
Expand Down Expand Up @@ -388,7 +387,6 @@ void handleVisibleSelection(ISelection selection) {
*/
void handleDownButton(Event e) {
IStructuredSelection selection = visibleViewer.getStructuredSelection();
@SuppressWarnings("unchecked")
List<T> selVCols = selection.toList();
List<T> allVCols = getVisible();
IColumnUpdater<T> updater = doGetColumnUpdater();
Expand All @@ -412,7 +410,6 @@ void handleDownButton(Event e) {
*/
void handleUpButton(Event e) {
IStructuredSelection selection = visibleViewer.getStructuredSelection();
@SuppressWarnings("unchecked")
List<T> selVCols = selection.toList();
List<T> allVCols = getVisible();
IColumnUpdater<T> updater = doGetColumnUpdater();
Expand All @@ -435,7 +432,6 @@ void handleUpButton(Event e) {
*/
void handleToVisibleButton(Event e) {
IStructuredSelection selection = nonVisibleViewer.getStructuredSelection();
@SuppressWarnings("unchecked")
List<T> selVCols = selection.toList();
getNonVisible().removeAll(selVCols);

Expand Down Expand Up @@ -465,7 +461,6 @@ protected void handleToNonVisibleButton(Event e) {
return;
}
IStructuredSelection structuredSelection = visibleViewer.getStructuredSelection();
@SuppressWarnings("unchecked")
List<T> selVCols = structuredSelection.toList();
getVisible().removeAll(selVCols);
getNonVisible().addAll(selVCols);
Expand Down Expand Up @@ -594,7 +589,6 @@ IColumnUpdater<T> doGetColumnUpdater() {
private void updateWidth() {
try {
int width = Integer.parseInt(widthText.getText());
@SuppressWarnings("unchecked")
T data = (T) visibleViewer.getStructuredSelection().getFirstElement();
if (data != null) {
IColumnUpdater<T> updater = getColumnUpdater();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ private boolean nextChildExists(AbstractEntry originalEntry, AbstractEntry origi
/**
* Sets entry children (Prev-Next navigable) to top-level elements
*/
@SuppressWarnings("unchecked")
private void setEntryChildren() {
AbstractEntry[] children = getElements();

Expand All @@ -505,6 +506,7 @@ private void setEntryChildren() {
/**
* Sets entry children (Prev-Next navigable) to children of given entry
*/
@SuppressWarnings("unchecked")
private void setEntryChildren(AbstractEntry entry) {
Object[] children = entry.getChildren(entry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public String getCategory() {
* @param target
* the section descriptor to append.
*/
@SuppressWarnings("unchecked")
protected boolean append(ISectionDescriptor target) {
if (!target.getTargetTab().equals(id)) {
return false;
Expand All @@ -168,6 +169,7 @@ protected boolean append(ISectionDescriptor target) {
* @return <code>true</code> if the target descriptor was added to the
* descriptors list.
*/
@SuppressWarnings("unchecked")
private boolean insertSectionDescriptor(ISectionDescriptor target) {
if (target.getAfterSection().equals(TOP)) {
getSectionDescriptors().add(0, target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ protected ITabDescriptor[] filterTabDescriptors(
* Given a property tab descriptor remove all its section descriptors that
* do not apply to the given input object.
*/
@SuppressWarnings("unchecked")
protected ITabDescriptor adaptDescriptorFor(ITabDescriptor target,
IWorkbenchPart part, ISelection selection) {
List<ISectionDescriptor> filteredSectionDescriptors = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ private boolean appliesToEffectiveType(ISectionDescriptor descriptor,

ArrayList<String> classTypes = getClassTypes(inputClass);

@SuppressWarnings("unchecked")
List<String> sectionInputTypes = descriptor.getInputTypes();
for (String type : sectionInputTypes) {
if (classTypes.contains(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public TabContents createTab() {
return tab;
}

@SuppressWarnings("unchecked")
@Override
public boolean equals(Object object) {
if (object == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ public void resizeScrolledComposite() {
* @param tabs tabs to dispose
* @since 3.6
*/
@SuppressWarnings("unchecked")
protected void disposeTabs(@SuppressWarnings("rawtypes") Collection tabs) {
for (Iterator<TabContents> iter = tabs.iterator(); iter.hasNext();) {
TabContents tab = iter.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public void activityManagerChanged(ActivityManagerEvent activityManagerEvent) {
}

private class CategoryContentProvider implements IStructuredContentProvider {
@SuppressWarnings("unchecked")
@Override
public Object[] getElements(Object inputElement) {
// convert to category objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
* @noextend This class is not intended to be extended by clients.
*/
@Deprecated(forRemoval = true, since = "2024-03")
@SuppressWarnings({ "unchecked" })
public abstract class AbstractHandler extends org.eclipse.core.commands.AbstractHandler implements IHandler {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public static <S extends ISelectionService, T> IValueProperty<S, T> singleSelect
*
* @return an observable value
*/
@SuppressWarnings("unchecked")
public static <S extends ISelectionService, T> IValueProperty<S, T> singleSelection(String partId,
boolean postSelection) {
return (IValueProperty<S, T>) singleSelection(partId, postSelection, Object.class);
Expand Down Expand Up @@ -131,7 +130,6 @@ public static <S extends ISelectionService, T> IValueProperty<S, T> singleSelect
*
* @return an observable value
*/
@SuppressWarnings("unchecked")
public static <S extends ISelectionService, E> IListProperty<S, E> multipleSelection() {
return (IListProperty<S, E>) multipleSelection(Object.class);
}
Expand Down Expand Up @@ -160,7 +158,6 @@ public static <S extends ISelectionService, E> IListProperty<S, E> multipleSelec
*
* @return an observable value
*/
@SuppressWarnings("unchecked")
public static <S extends ISelectionService, E> IListProperty<S, E> multipleSelection(String partId,
boolean postSelection) {
return (IListProperty<S, E>) multipleSelection(partId, postSelection, Object.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public String getPluginId() {

}

@SuppressWarnings("unchecked")
private CommandContributionItemParameter getItem(String viewId) {
MApplication application = window.getService(MApplication.class);
List<MPartDescriptor> descriptors = application.getDescriptors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public Object getValueType() {
return adapter;
}

@SuppressWarnings("unchecked")
@Override
protected T doGetValue(S source) {
if (adapter.isInstance(source))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected void doRemoveFrom(S source) {
}
}

@SuppressWarnings("unchecked")
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
// Note that the part is not the same object as the selection service, but it is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protected T doGetValue(S source) {
selection = ((ISelectionService) source).getSelection();
}
if (selection instanceof IStructuredSelection) {
@SuppressWarnings("unchecked")
T elem = (T) ((IStructuredSelection) selection).getFirstElement();
return elem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ public void keyReleased(KeyEvent e) {

}

@SuppressWarnings("unchecked")
private void createFileAssociations(final Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout(2, false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ public String getText(Object element) {
});
}

@SuppressWarnings("unchecked")
private void selectColorsAndFontsTheme(String colorAndFontThemeId) {
if (colorAndFontThemeId == null) {
colorAndFontThemeId = currentColorsAndFontsTheme.getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ private void correctSelectedElements(MUIElement element) {
if (!(element instanceof MPartSashContainer || element instanceof MPartStack)) {
return;
}
@SuppressWarnings("unchecked")
MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) element;
List<MUIElement> children = container.getChildren();
if (container.getSelectedElement() == null && !children.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public Object compute(IEclipseContext context, String contextKey) {
HashSet<HandlerActivation> activationSet = new LinkedHashSet<>();
IEclipseContext current = context;
while (current != null) {
@SuppressWarnings("unchecked")
List<HandlerActivation> handlerActivations = (List<HandlerActivation>) current
.getLocal(LEGACY_H_ID + commandId);
if (handlerActivations != null) {
Expand Down Expand Up @@ -177,7 +176,6 @@ private static IHandlerActivation registerLegacyHandler(final IEclipseContext co
}

static void addHandlerActivation(HandlerActivation eActivation) {
@SuppressWarnings("unchecked")
List<HandlerActivation> handlerActivations = (List<HandlerActivation>) eActivation.context
.getLocal(LEGACY_H_ID + eActivation.getCommandId());
if (handlerActivations == null) {
Expand All @@ -194,7 +192,6 @@ static void addHandlerActivation(HandlerActivation eActivation) {
}

static void removeHandlerActivation(HandlerActivation eActivation) {
@SuppressWarnings("unchecked")
List<HandlerActivation> handlerActivations = (List<HandlerActivation>) eActivation.context
.getLocal(LEGACY_H_ID + eActivation.getCommandId());
if (handlerActivations == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ static public MKeyBinding createOrUpdateMKeyBinding(MApplication application, MB
keyBinding.setKeySequence(binding.getTriggerSequence().toString());

for (Object obj : parmCmd.getParameterMap().entrySet()) {
@SuppressWarnings({ "unchecked" })
Map.Entry<String, String> entry = (Map.Entry<String, String>) obj;

String paramID = entry.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,6 @@ public FileEditorMapping get(String key) {
* @return the mappings
*/
public FileEditorMapping[] allMappings() {
@SuppressWarnings("unchecked")
HashMap<String, FileEditorMapping> merge = (HashMap<String, FileEditorMapping>) defaultMap.clone();
merge.putAll(map);
Collection<FileEditorMapping> values = merge.values();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ public void addEditor(EditorDescriptor editor) {
/**
* Clone the receiver.
*/
@SuppressWarnings("unchecked")
@Override
public Object clone() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ public Map getDialogState() {
*
* @return Collection of StatusAdapters
*/
@SuppressWarnings("unchecked")
private Collection<StatusAdapter> getErrors() {
return (Collection<StatusAdapter>) dialogState.get(IStatusDialogConstants.STATUS_ADAPTERS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public RGB createColor() {
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
throws CoreException {
if (data instanceof Hashtable) {
@SuppressWarnings("unchecked")
Hashtable<String, String> table = (Hashtable<String, String>) data;
fg = table.get("foreground"); //$NON-NLS-1$
bg = table.get("background"); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ public void dispose() {
removePage(defaultPageRec, false);
defaultPageRec = null;
}
@SuppressWarnings("unchecked")
Map<IWorkbenchPart, PageRec> clone = (Map<IWorkbenchPart, PageRec>) ((HashMap<IWorkbenchPart, PageRec>) mapPartToRec)
.clone();
clone.values().forEach(rec -> removePage(rec, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ protected String getEngineURI() {
return "bundleclass://org.eclipse.e4.ui.tests/org.eclipse.e4.ui.tests.application.HeadlessContextPresentationEngine"; //$NON-NLS-1$
}

@SuppressWarnings("unchecked")
private void processPartContributions(IEclipseContext context,
Resource resource) {
IExtensionRegistry registry = context.get(IExtensionRegistry.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static void checkRef(ReferenceQueue<?> queue, Reference<?> ref)
assertTrue("Reference not enqueued", flag);
}

@SuppressWarnings("unchecked")
private Reference createReference(ReferenceQueue queue, Object object) {
return new PhantomReference<>(object, queue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ class DirtyObservableMap extends ComputedObservableMap<Object, Object> {
Diffs.createMapDiffSingleChange(
writableValueToElement.get(event.getSource()), event.diff.getOldValue(), event.diff.getNewValue()));

@SuppressWarnings("unchecked")
public DirtyObservableMap(IObservableSet knownElements) {
super(knownElements);
init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class LabelProviderWrapperTest {
private LabelProviderWrapper wrapper;
private Map<Object, Object> dialogState = new HashMap<>();

@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
dialogState = new HashMap<>();
Expand Down Expand Up @@ -118,6 +119,7 @@ public void testImages(){
/*
* StatusAdapter contains all information necessary to display the dialog.
*/
@SuppressWarnings("unchecked")
@Test
public void testProvidedText_1(){
final String title = "title";
Expand Down

0 comments on commit 6e19205

Please sign in to comment.