mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 20:35:38 +02:00
autotools: Additional generification.
Properly generify now that o.e.text is generified. This alows removing a number of suppressed warnings. In a few places it is better to use wildcard than suppressing warnings. Also remove DefaultNoDependencyCalculator as it was suppressing warnings but better to remove directly as it's not use anywhere. Change-Id: I70c4ac073ce5b6c2a45443372037fa61b7c36c76 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
af49d7701a
commit
34281a96e0
18 changed files with 46 additions and 108 deletions
|
@ -47,7 +47,7 @@ public class AutotoolsConfigurationBuilder extends ACBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
|
||||
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor)
|
||||
throws CoreException {
|
||||
IProject project = getProject();
|
||||
if(!isCdtProjectCreated(project))
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.autotools.core;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
/**
|
||||
* This is the dependency calculator used by the makefile generation system when
|
||||
* nothing is defined for a tool.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DefaultNoDependencyCalculator implements IManagedDependencyGenerator {
|
||||
|
||||
@Override
|
||||
public IResource[] findDependencies(IResource resource, IProject project) {
|
||||
// Never answers any dependencies
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCalculatorType() {
|
||||
return TYPE_NODEPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDependencyCommand(IResource resource, IManagedBuildInfo info) {
|
||||
// Never answers this call with an actual value
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -29,11 +29,10 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
|
|||
this.value = name;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private FlagConfigureOption(String name, AutotoolsConfiguration cfg, String value, ArrayList<String> children) {
|
||||
super(name, cfg);
|
||||
this.value = value;
|
||||
this.children = (ArrayList<String>) children.clone();
|
||||
this.children = new ArrayList<>(children);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,8 +75,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
|||
List<Annotation> exact= new ArrayList<>();
|
||||
List<Annotation> including= new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= model.getAnnotationIterator();
|
||||
Iterator<?> e = model.getAnnotationIterator();
|
||||
while (e.hasNext()) {
|
||||
Object o= e.next();
|
||||
if (o instanceof Annotation) {
|
||||
|
|
|
@ -18,8 +18,7 @@ import org.eclipse.ui.editors.text.TextFileDocumentProvider;
|
|||
public class AutoconfDocumentProvider extends TextFileDocumentProvider {
|
||||
|
||||
public void shutdown() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= getConnectedElementsIterator();
|
||||
Iterator<?> e = getConnectedElementsIterator();
|
||||
while (e.hasNext())
|
||||
disconnect(e.next());
|
||||
}
|
||||
|
|
|
@ -185,18 +185,18 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public Object getAdapter(Class required) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getAdapter(Class<T> required) {
|
||||
if (ProjectionAnnotationModel.class.equals(required)) {
|
||||
if (fProjectionSupport != null) {
|
||||
Object result = fProjectionSupport.getAdapter(getSourceViewer(), required);
|
||||
if (result != null) {
|
||||
return result;
|
||||
return (T) result;
|
||||
}
|
||||
}
|
||||
} else if (IContentOutlinePage.class.equals(required)) {
|
||||
return getOutlinePage();
|
||||
return (T) getOutlinePage();
|
||||
}
|
||||
return super.getAdapter(required);
|
||||
}
|
||||
|
|
|
@ -87,10 +87,9 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
|
|||
|
||||
public void removeExistingMarkers(int offset, int length)
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator i = fAnnotationModel.getAnnotationIterator();
|
||||
Iterator<Annotation> i = fAnnotationModel.getAnnotationIterator();
|
||||
while (i.hasNext()) {
|
||||
Annotation annotation = (Annotation)i.next();
|
||||
Annotation annotation = i.next();
|
||||
Position p = fAnnotationModel.getPosition(annotation);
|
||||
int pStart = p.getOffset();
|
||||
if (pStart >= offset && pStart < (offset + length)) {
|
||||
|
|
|
@ -49,8 +49,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
|||
protected ISelection updateSelection(ISelection sel) {
|
||||
ArrayList<AutoconfElement> newSelection= new ArrayList<>();
|
||||
if (sel instanceof IStructuredSelection) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator iter= ((IStructuredSelection)sel).iterator();
|
||||
Iterator<?> iter = ((IStructuredSelection) sel).iterator();
|
||||
for (;iter.hasNext();) {
|
||||
//ICElement elem= fInput.findEqualMember((ICElement)iter.next());
|
||||
Object o = iter.next();
|
||||
|
|
|
@ -49,11 +49,10 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation
|
|||
|
||||
int yoursStart= offset;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= presentation.getAllStyleRangeIterator();
|
||||
Iterator<StyleRange> e = presentation.getAllStyleRangeIterator();
|
||||
while (e.hasNext()) {
|
||||
|
||||
StyleRange range= (StyleRange) e.next();
|
||||
StyleRange range= e.next();
|
||||
|
||||
int myStart= range.start;
|
||||
int myEnd= range.start + range.length -1;
|
||||
|
|
|
@ -157,7 +157,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
|||
AutoconfElement fInput= fEditor.getRootElement();
|
||||
|
||||
if (fInput != null) {
|
||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
if (model != null) {
|
||||
Map<AutoconfProjectionAnnotation, Position> additions= computeAdditions(fInput);
|
||||
model.removeAllAnnotations();
|
||||
|
@ -262,7 +262,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
|||
if (!isInstalled())
|
||||
return;
|
||||
|
||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
ProjectionAnnotationModel model= fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
if (model == null)
|
||||
return;
|
||||
|
||||
|
@ -398,10 +398,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
|||
|
||||
private Map<AutoconfElement, List<AutoconfProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
|
||||
Map<AutoconfElement, List<AutoconfProjectionAnnotation>> map= new HashMap<>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= model.getAnnotationIterator();
|
||||
Iterator<Annotation> e = model.getAnnotationIterator();
|
||||
while (e.hasNext()) {
|
||||
Object annotation= e.next();
|
||||
Annotation annotation = e.next();
|
||||
if (annotation instanceof AutoconfProjectionAnnotation) {
|
||||
AutoconfProjectionAnnotation directive= (AutoconfProjectionAnnotation) annotation;
|
||||
List<AutoconfProjectionAnnotation> list= map.get(directive.getElement());
|
||||
|
|
|
@ -89,8 +89,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
|||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= getConnectedElementsIterator();
|
||||
Iterator<?> e = getConnectedElementsIterator();
|
||||
while (e.hasNext())
|
||||
disconnect(e.next());
|
||||
}
|
||||
|
|
|
@ -90,10 +90,11 @@ public class AutomakeEditor extends MakefileEditor {
|
|||
return ampage;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
|
||||
public <T> T getAdapter(Class<T> key) {
|
||||
if (key.equals(IContentOutlinePage.class)) {
|
||||
return getAutomakeOutlinePage();
|
||||
return (T) getAutomakeOutlinePage();
|
||||
}
|
||||
return super.getAdapter(key);
|
||||
}
|
||||
|
|
|
@ -92,29 +92,22 @@ public class MakefileAnnotationHover implements IAnnotationHover, IAnnotationHov
|
|||
List<Annotation> exact= new ArrayList<>();
|
||||
List<Annotation> including= new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= model.getAnnotationIterator();
|
||||
Iterator<Annotation> e = model.getAnnotationIterator();
|
||||
while (e.hasNext()) {
|
||||
Object o= e.next();
|
||||
if (o instanceof Annotation) {
|
||||
Annotation a= (Annotation) o;
|
||||
switch (compareRulerLine(model.getPosition(a), document, line)) {
|
||||
case 1:
|
||||
exact.add(a);
|
||||
break;
|
||||
case 2:
|
||||
including.add(a);
|
||||
break;
|
||||
}
|
||||
Annotation a = e.next();
|
||||
switch (compareRulerLine(model.getPosition(a), document, line)) {
|
||||
case 1:
|
||||
exact.add(a);
|
||||
break;
|
||||
case 2:
|
||||
including.add(a);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return select(exact, including);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int)
|
||||
*/
|
||||
@Override
|
||||
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
|
||||
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
|
||||
|
|
|
@ -125,8 +125,7 @@ public class MakefileDocumentProvider extends TextFileDocumentProvider implement
|
|||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= getConnectedElementsIterator();
|
||||
Iterator<?> e = getConnectedElementsIterator();
|
||||
while (e.hasNext())
|
||||
disconnect(e.next());
|
||||
}
|
||||
|
|
|
@ -158,17 +158,18 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
return viewer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
|
||||
public <T> T getAdapter(Class<T> key) {
|
||||
if (ProjectionAnnotationModel.class.equals(key)) {
|
||||
if (projectionSupport != null) {
|
||||
Object result = projectionSupport.getAdapter(getSourceViewer(), key);
|
||||
if (result != null) {
|
||||
return result;
|
||||
return (T) result;
|
||||
}
|
||||
}
|
||||
} else if (key.equals(IContentOutlinePage.class)) {
|
||||
return getOutlinePage();
|
||||
return (T) getOutlinePage();
|
||||
}
|
||||
return super.getAdapter(key);
|
||||
}
|
||||
|
|
|
@ -269,8 +269,7 @@ public class OpenIncludeAction extends Action {
|
|||
|
||||
private static IInclude getIncludeStatement(ISelection sel) {
|
||||
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list= ((IStructuredSelection)sel).toList();
|
||||
List<?> list = ((IStructuredSelection) sel).toList();
|
||||
if (list.size() == 1) {
|
||||
Object element= list.get(0);
|
||||
if (element instanceof IInclude) {
|
||||
|
|
|
@ -149,10 +149,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
fInput= manager.getWorkingCopy(fEditor.getEditorInput());
|
||||
|
||||
if (fInput != null) {
|
||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
if (model != null) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Map additions= computeAdditions((IParent) fInput);
|
||||
Map<MakefileProjectionAnnotation, Position> additions = computeAdditions((IParent) fInput);
|
||||
model.removeAllAnnotations();
|
||||
model.replaceAnnotations(null, additions);
|
||||
}
|
||||
|
@ -235,7 +234,7 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
if (!isInstalled())
|
||||
return;
|
||||
|
||||
ProjectionAnnotationModel model= (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
ProjectionAnnotationModel model= fEditor.getAdapter(ProjectionAnnotationModel.class);
|
||||
if (model == null)
|
||||
return;
|
||||
|
||||
|
@ -371,10 +370,9 @@ public class ProjectionMakefileUpdater implements IProjectionListener {
|
|||
|
||||
private Map<IDirective, List<MakefileProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
|
||||
Map<IDirective, List<MakefileProjectionAnnotation>> map= new HashMap<>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
Iterator e= model.getAnnotationIterator();
|
||||
Iterator<Annotation> e = model.getAnnotationIterator();
|
||||
while (e.hasNext()) {
|
||||
Object annotation= e.next();
|
||||
Annotation annotation = e.next();
|
||||
if (annotation instanceof MakefileProjectionAnnotation) {
|
||||
MakefileProjectionAnnotation directive= (MakefileProjectionAnnotation) annotation;
|
||||
List<MakefileProjectionAnnotation> list= map.get(directive.getElement());
|
||||
|
|
|
@ -83,9 +83,8 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
|
|||
* if there isn't any initial selection.
|
||||
* @return the first element of the initial selection.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
protected Object getPrimaryInitialSelection() {
|
||||
List result= getInitialElementSelections();
|
||||
List<?> result = getInitialElementSelections();
|
||||
if (result == null || result.size() == 0)
|
||||
return null;
|
||||
return result.get(0);
|
||||
|
@ -120,9 +119,10 @@ public abstract class SelectionStatusDialog extends SelectionDialog {
|
|||
public void setImage(Image image) {
|
||||
fImage= image;
|
||||
}
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void setInitialSelection(int position, Object element) {
|
||||
List l= getInitialElementSelections();
|
||||
List<Object> l = getInitialElementSelections();
|
||||
l.set(position, element);
|
||||
fInitialSelectionSet= true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue