From af49d7701ab719a7176ad941bc91b956931c8133 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Sat, 12 Dec 2015 10:07:48 +0200 Subject: [PATCH] Fix compilation with Neon M4. Change-Id: Ia7f862540b14a2eec37804049d4cfb27e9f028e0 Signed-off-by: Alexander Kurtakov --- .../internal/ui/text/CFormattingStrategy.java | 3 +- .../ui/disassembly/DisassemblyPart.java | 5 +- .../model/BreakpointsAnnotationModel.java | 5 +- .../model/DisassemblyDocument.java | 68 ++++++++++--------- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java index 71a0629d8f1..dde6e38ced3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/CFormattingStrategy.java @@ -65,8 +65,7 @@ public class CFormattingStrategy extends ContextBasedFormattingStrategy { if (document == null || partition == null) return; - @SuppressWarnings("unchecked") - Map preferences = getPreferences(); + Map preferences = getPreferences(); try { TextEdit edit = CodeFormatterUtil.format( diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java index 7815db091c7..b7815a3b83b 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java @@ -2184,12 +2184,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem } int offset= lineRegion.getOffset(); int length= lineRegion.getLength(); - @SuppressWarnings("unchecked") - Iterator it= bpModel.getAnnotationIterator(offset, length, true, true); + Iterator it= bpModel.getAnnotationIterator(offset, length, true, true); List bpList= new ArrayList(5); final IBreakpointManager bpMgr= DebugPlugin.getDefault().getBreakpointManager(); while (it.hasNext()) { - final SimpleMarkerAnnotation annotation= it.next(); + final SimpleMarkerAnnotation annotation= (SimpleMarkerAnnotation) it.next(); IBreakpoint bp= bpMgr.getBreakpoint(annotation.getMarker()); if (bp != null) { bpList.add(bp); diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java index ddd6f77125f..ca67915d7ec 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/BreakpointsAnnotationModel.java @@ -128,10 +128,9 @@ public class BreakpointsAnnotationModel extends DisassemblyAnnotationModel imple } } - @SuppressWarnings("unchecked") private Annotation findAnnotation(IMarker marker) { - for (Iterator it= getAnnotationIterator(false); it.hasNext();) { - SimpleMarkerAnnotation a= it.next(); + for (Iterator it= getAnnotationIterator(false); it.hasNext();) { + SimpleMarkerAnnotation a= (SimpleMarkerAnnotation) it.next(); if (a.getMarker().equals(marker)) { return a; } diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java index 6058144ff69..39f744d249c 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java @@ -188,8 +188,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu } public Iterator getPositionIterator(String category, int offset) throws BadPositionCategoryException { - @SuppressWarnings("unchecked") - List positions = (List) getDocumentManagedPositions().get(category); + List positions = getDocumentManagedPositions().get(category); if (positions == null) { throw new BadPositionCategoryException(); } @@ -198,22 +197,38 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu } public Iterator getPositionIterator(String category, BigInteger address) throws BadPositionCategoryException { - @SuppressWarnings("unchecked") - List positions = (List) getDocumentManagedPositions().get(category); - if (positions == null) { - throw new BadPositionCategoryException(); - } + List positions = getAddressRangePositions(category); int idx = computeIndexInPositionListFirst(positions, address); return positions.listIterator(idx); } - public int computeIndexInCategory(String category, BigInteger address) throws BadPositionCategoryException { - @SuppressWarnings("unchecked") - List c = (List) getDocumentManagedPositions().get(category); - if (c == null) { + private List getAddressRangePositions(String category) throws BadPositionCategoryException { + List tmpPositions = getDocumentManagedPositions().get(category); + if (tmpPositions == null) { throw new BadPositionCategoryException(); } - return computeIndexInPositionListFirst(c, address); + List positions = new ArrayList<>(); + for(Position position: tmpPositions) { + positions.add((AddressRangePosition) position); + } + return positions; + } + + private List getAddressRangePositionsRaw(String category) { + List tmpPositions = getDocumentManagedPositions().get(category); + if (tmpPositions == null) { + return null; + } + List positions = new ArrayList<>(); + for(Position position: tmpPositions) { + positions.add((AddressRangePosition) position); + } + return positions; + } + + public int computeIndexInCategory(String category, BigInteger address) throws BadPositionCategoryException { + List positions = getAddressRangePositions(category); + return computeIndexInPositionListFirst(positions, address); } /** @@ -380,8 +395,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu */ public Position getPositionOfIndex(String category, int index) throws BadPositionCategoryException { if (index >= 0) { - @SuppressWarnings("unchecked") - List positions = (List) getDocumentManagedPositions().get(category); + List positions = getDocumentManagedPositions().get(category); if (positions == null) { throw new BadPositionCategoryException(); } @@ -398,8 +412,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu } public AddressRangePosition getPositionOfAddress(String category, BigInteger address) { - @SuppressWarnings("unchecked") - List positions = (List) getDocumentManagedPositions().get(category); + List positions = getAddressRangePositionsRaw(category); if (positions == null) { return null; } @@ -419,8 +432,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu * @return */ public AddressRangePosition getPositionInAddressRange(String category, AddressRangePosition range) { - @SuppressWarnings("unchecked") - List positions = (List) getDocumentManagedPositions().get(category); + List positions = getAddressRangePositionsRaw(category); if (positions == null) { return null; } @@ -643,8 +655,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu * @throws BadLocationException */ public Position getPosition(String category, int offset, boolean allowZeroLength) throws BadLocationException, BadPositionCategoryException { - @SuppressWarnings("unchecked") - List list = (List) getDocumentManagedPositions().get(category); + List list = getDocumentManagedPositions().get(category); int idx; idx = computeIndexInPositionList(list, offset, true); if (idx > 0) { @@ -681,8 +692,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu * @param pos */ public void addModelPositionFirst(AddressRangePosition pos) { - @SuppressWarnings("unchecked") - List list = (List) getDocumentManagedPositions().get(CATEGORY_MODEL); + List list = getAddressRangePositionsRaw(CATEGORY_MODEL); int idx; idx = computeIndexInPositionListFirst(list, pos.fAddressOffset.add(pos.fAddressLength)); if (idx < list.size()) { @@ -724,11 +734,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu * @throws BadPositionCategoryException */ public void addPositionLast(String category, AddressRangePosition pos) throws BadPositionCategoryException { - @SuppressWarnings("unchecked") - List list = (List) getDocumentManagedPositions().get(category); - if (list == null) { - throw new BadPositionCategoryException(); - } + List list = getAddressRangePositions(category); if (DEBUG) System.out.println("Adding position to category <" + category + "> : " + pos); //$NON-NLS-1$ //$NON-NLS-2$ list.add(computeIndexInPositionListLast(list, pos.fAddressOffset), pos); } @@ -817,7 +823,6 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu } } - @SuppressWarnings("unchecked") public void removePositions(String category, List toRemove) { if (toRemove.isEmpty()) { return; @@ -831,12 +836,12 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu } } - List positions = (List) getDocumentManagedPositions().get(category); + List positions = getDocumentManagedPositions().get(category); if (positions != null) { positions.removeAll(toRemove); } if (!category.equals(CATEGORY_MODEL)) { - positions = (List) getDocumentManagedPositions().get(CATEGORY_MODEL); + positions = getDocumentManagedPositions().get(CATEGORY_MODEL); if (positions != null) { positions.removeAll(toRemove); } @@ -852,8 +857,7 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu if (category == null) throw new BadPositionCategoryException(); - @SuppressWarnings("unchecked") - List list = (List) getDocumentManagedPositions().get(category); + List list = getDocumentManagedPositions().get(category); if (list == null) throw new BadPositionCategoryException();