fixed compile warnings from bug 478673
diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java
index 9b5bf1e..887da7e 100644
--- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java
+++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditor.java
@@ -249,8 +249,9 @@
}
private boolean isCanceled() {
- return fCanceled || fProgressMonitor.isCanceled() || fPostSelectionValidator != null
- && !(fPostSelectionValidator.isValid(fSelection) || fForcedMarkOccurrencesSelection == fSelection)
+ return fCanceled || fProgressMonitor.isCanceled()
+ || fPostSelectionValidator != null
+ && !(fPostSelectionValidator.isValid(fSelection) || fForcedMarkOccurrencesSelection == fSelection)
|| LinkedModeModel.hasInstalledModel(fDocument);
}
@@ -283,7 +284,7 @@
// Add occurrence annotations
int length = fPositions.size();
- Map<Annotation, Position> annotationMap = new HashMap<Annotation, Position>(length);
+ Map<Annotation, Position> annotationMap = new HashMap<>(length);
for (int i = 0; i < length; i++) {
if (isCanceled())
@@ -301,7 +302,7 @@
continue;
}
annotationMap.put(new Annotation("org.eclipse.jdt.ui.occurrences", false, message), //$NON-NLS-1$
- position);
+ position);
}
if (isCanceled()) {
@@ -578,21 +579,22 @@
*
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class key) {
+ public <T> T getAdapter(Class<T> key) {
if (key.equals(IContentOutlinePage.class)) {
- return getOutlinePage();
+ return (T) getOutlinePage();
}
if (fProjectionSupport != null) {
- Object adapter = fProjectionSupport.getAdapter(getSourceViewer(), key);
+ T adapter = fProjectionSupport.getAdapter(getSourceViewer(), key);
if (adapter != null) {
return adapter;
}
}
if (key == IShowInTargetList.class) {
- return new IShowInTargetList() {
+ return (T) new IShowInTargetList() {
@Override
public String[] getShowInTargetIds() {
return new String[] { JavaUI.ID_PACKAGES, IPageLayout.ID_PROJECT_EXPLORER };
@@ -601,11 +603,11 @@
}
if (key == IToggleBreakpointsTarget.class) {
- return new ToggleLineBreakpointAction();
+ return (T) new ToggleLineBreakpointAction();
}
if (key == IRunToLineTarget.class) {
- return new RunToLineAdapter();
+ return (T) new RunToLineAdapter();
}
return super.getAdapter(key);
@@ -839,7 +841,7 @@
*/
@Override
protected void setStatusLineErrorMessage(String msg) {
- IEditorStatusLine statusLine = (IEditorStatusLine) getAdapter(IEditorStatusLine.class);
+ IEditorStatusLine statusLine = getAdapter(IEditorStatusLine.class);
if (statusLine != null)
statusLine.setMessage(true, msg, null);
}
diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditorSourceViewerConfiguration.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditorSourceViewerConfiguration.java
index f425bba..bb44850 100644
--- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditorSourceViewerConfiguration.java
+++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/AntEditorSourceViewerConfiguration.java
@@ -252,7 +252,7 @@
*/
@Override
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
// prefix[0] is either '\t' or ' ' x tabWidth, depending on useSpaces
@@ -305,7 +305,7 @@
* @see org.eclipse.ui.editors.text.TextSourceViewerConfiguration#getHyperlinkDetectorTargets(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
- protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
+ protected Map<String, IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer) {
Map<String, IAdaptable> targets = super.getHyperlinkDetectorTargets(sourceViewer);
targets.put("org.eclipse.ant.ui.buildFiles", fEditor); //$NON-NLS-1$
return targets;
diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntFoldingStructureProvider.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntFoldingStructureProvider.java
index 3bce995..80d2858 100644
--- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntFoldingStructureProvider.java
+++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/text/AntFoldingStructureProvider.java
@@ -80,7 +80,7 @@
public void updateFoldingRegions(AntModel antModel) {
fPositionToElement = new HashMap<Position, IAntElement>();
try {
- ProjectionAnnotationModel model = (ProjectionAnnotationModel) fEditor.getAdapter(ProjectionAnnotationModel.class);
+ ProjectionAnnotationModel model = fEditor.getAdapter(ProjectionAnnotationModel.class);
if (model == null) {
return;
}