diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java index 08c0c77fc35..aafaf6cbb40 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/MIBreakpointsManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2014 Wind River and others. + * Copyright (c) 2007, 2015 Wind River 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 @@ -158,8 +158,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // - Augmented on breakpointAdded() // - Modified on breakpointChanged() // - Diminished on breakpointRemoved() - private Map>> fPlatformBPs = - new HashMap>>(); + private Map>> fPlatformBPs = new HashMap<>(); // Holds the set of target breakpoints, per execution context, and their // mapping to the corresponding platform breakpoint. In a given execution @@ -170,8 +169,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // - We start/stop tracking an execution context // - A platform breakpoint is added/removed // - A thread filter is applied/removed - private Map> fTargetBPs = - new HashMap>(); + private Map> fTargetBPs = new HashMap<>(); // Holds the mapping from platform breakpoint to the corresponding target // breakpoint(s), per context. There can be multiple back-end BPs for a @@ -181,8 +179,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // - We start/stop tracking an execution context // - A platform breakpoint is added/removed // - A thread filter is applied/removed - private Map>> fBreakpointIDs = - new HashMap>>(); + private Map>> fBreakpointIDs = new HashMap<>(); // Holds the mapping from platform breakpoint to the corresponding target // breakpoint threads, per context. @@ -190,17 +187,15 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // - We start/stop tracking an execution context // - A platform breakpoint is added/removed // - A thread filter is applied/removed - private Map>> fBreakpointThreads = - new HashMap>>(); + private Map>> fBreakpointThreads = new HashMap<>(); // Due to the very asynchronous nature of DSF, a new breakpoint request can // pop up at any time before an ongoing one is completed. The following set // is used to store requests until the ongoing operation completes. - private Set fPendingRequests = new HashSet(); - private Set fPendingBreakpoints = new HashSet(); + private Set fPendingRequests = new HashSet<>(); + private Set fPendingBreakpoints = new HashSet<>(); - private Map fBreakpointMarkerProblems = - new HashMap(); + private Map fBreakpointMarkerProblems = new HashMap<>(); private ListenerList fTrackingListeners = new ListenerList(); @@ -324,7 +319,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo } }; - List targetBPKeys = new ArrayList(fTargetBPs.size()); + List targetBPKeys = new ArrayList<>(fTargetBPs.size()); targetBPKeys.addAll(0, fTargetBPs.keySet()); for (IBreakpointsTargetDMContext dmc : targetBPKeys) { stopTrackingBreakpoints(dmc, countingRm); @@ -625,8 +620,8 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo protected void handleSuccess() { // Add the new back-end breakpoint to the map Vector list = breakpointIDs.get(breakpoint); - if (list == null) - list = new Vector(); + if (list == null) list = new Vector<>(); + IBreakpointDMContext targetBP = getData(); list.add(targetBP); breakpointIDs.put(breakpoint, list); @@ -636,8 +631,8 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // And update the corresponding thread list Set thrds = threadsIDs.get(breakpoint); - if (thrds == null) - thrds = new HashSet(); + if (thrds == null) thrds = new HashSet<>(); + thrds.add(thread); threadsIDs.put(breakpoint, thrds); @@ -939,17 +934,17 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo } // Determine the attributes delta - final Map oldAttributes = new HashMap(original_attributes); + final Map oldAttributes = new HashMap<>(original_attributes); oldAttributes.put(ATTR_THREAD_FILTER, threadsIDs.get(breakpoint)); final Set newThreads = extractThreads(dmc, breakpoint); - Map newAttributes = new HashMap(attributes); + Map newAttributes = new HashMap<>(attributes); newAttributes.put(ATTR_THREAD_FILTER, newThreads); final Map attributesDelta = determineAttributesDelta(oldAttributes, newAttributes); // Get the list of back-end breakpoints - final Vector oldTargetBPs = new Vector(breakpointIDs.get(breakpoint)); + final Vector oldTargetBPs = new Vector<>(breakpointIDs.get(breakpoint)); if (oldTargetBPs.isEmpty()) { rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, INVALID_BREAKPOINT, null)); rm.done(); @@ -998,7 +993,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo }; // Everything OK: remove the old back-end breakpoints - final Vector newTargetBPs = new Vector(); + final Vector newTargetBPs = new Vector<>(); final CountingRequestMonitor removeRM = new CountingRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { @@ -1080,7 +1075,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo final Map attributes, Set threads, final DataRequestMonitor> drm) { // Our new list of back-end breakpoints. Built as we go. - final Vector breakpointList = new Vector(); + final Vector breakpointList = new Vector<>(); // Counting monitor for the new back-end breakpoints to install // Once we're done, return the new list of back-end breakpoints contexts @@ -1167,7 +1162,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo if (!(breakpoint instanceof ICTracepoint) && !(breakpoint instanceof ICDynamicPrintf) && breakpoint.isEnabled()) { for (IBreakpointDMContext ref : fBreakpointIDs.get(context).get(breakpoint)) { - Map delta = new HashMap(); + Map delta = new HashMap<>(); delta.put(MIBreakpoints.IS_ENABLED, enabled); fBreakpoints.updateBreakpoint(ref, delta, new RequestMonitor(getExecutor(), null)); } @@ -1618,7 +1613,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo // Create the scheduling rule to clear all bp planted. ISchedulingRule rule = null; - List markerRules = new ArrayList(); + List markerRules = new ArrayList<>(); for (ICBreakpoint bp : bps) { IMarker marker = bp.getMarker(); if (marker != null) { @@ -1751,14 +1746,14 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo */ private Map determineAttributesDelta(Map oldAttributes, Map newAttributes) { - Map delta = new HashMap(); + Map delta = new HashMap<>(); Set oldKeySet = oldAttributes.keySet(); Set newKeySet = newAttributes.keySet(); - Set commonKeys = new HashSet(newKeySet); commonKeys.retainAll(oldKeySet); - Set addedKeys = new HashSet(newKeySet); addedKeys.removeAll(oldKeySet); - Set removedKeys = new HashSet(oldKeySet); removedKeys.removeAll(newKeySet); + Set commonKeys = new HashSet<>(newKeySet); commonKeys.retainAll(oldKeySet); + Set addedKeys = new HashSet<>(newKeySet); addedKeys.removeAll(oldKeySet); + Set removedKeys = new HashSet<>(oldKeySet); removedKeys.removeAll(newKeySet); // Add the modified attributes for (String key : commonKeys) { @@ -1855,7 +1850,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo private Set getThreads(Map attributes) { Set threads = (Set) attributes.get(ATTR_THREAD_FILTER); if (threads == null) { - threads = new HashSet(); + threads = new HashSet<>(); threads.add("0"); // Thread 0 means all threads //$NON-NLS-1$ } return threads; @@ -1868,10 +1863,10 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo * @return */ private Set extractThreads(IBreakpointsTargetDMContext bpTargetDmc, ICBreakpoint breakpoint) { - Set results = new HashSet(); + Set results = new HashSet<>(); if (supportsThreads(breakpoint)) { - List threads = new ArrayList(1); + List threads = new ArrayList<>(1); try { // Retrieve all existing targets. @@ -1961,7 +1956,7 @@ public class MIBreakpointsManager extends AbstractDsfService implements IBreakpo */ protected Map convertToTargetBreakpoint(ICBreakpoint breakpoint, Map attributes) { - Map properties = new HashMap(); + Map properties = new HashMap<>(); if (breakpoint instanceof ICWatchpoint) { properties.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.WATCHPOINT);