Bug 565510 - Use lambdas and method references cleanup on JDT debug code

For debug and internal package

Change-Id: I2e057643980f0e264c11907d41b6e65b886a750d
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
index 97aadd6..a5fc75d 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/debug/core/JDIDebugModel.java
@@ -21,7 +21,6 @@
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -228,13 +227,8 @@
 			final boolean allowTerminate, final boolean allowDisconnect,
 			final boolean resume) {
 		final IJavaDebugTarget[] target = new IJavaDebugTarget[1];
-		IWorkspaceRunnable r = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor m) {
-				target[0] = new JDIDebugTarget(launch, vm, name,
-						allowTerminate, allowDisconnect, process, resume);
-			}
-		};
+		IWorkspaceRunnable r = m -> target[0] = new JDIDebugTarget(launch, vm, name,
+				allowTerminate, allowDisconnect, process, resume);
 		try {
 			ResourcesPlugin.getWorkspace().run(r, null, 0, null);
 		} catch (CoreException e) {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaClassPrepareBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaClassPrepareBreakpoint.java
index 2fad0c3..d5c66ee 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaClassPrepareBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaClassPrepareBreakpoint.java
@@ -20,7 +20,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.DebugException;
@@ -91,27 +90,22 @@
 			final String typeName, final int memberType, final int charStart,
 			final int charEnd, final boolean add, final Map<String, Object> attributes)
 			throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+		IWorkspaceRunnable wr = monitor -> {
+			// create the marker
+			setMarker(resource.createMarker(JAVA_CLASS_PREPARE_BREAKPOINT));
 
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
-				// create the marker
-				setMarker(resource.createMarker(JAVA_CLASS_PREPARE_BREAKPOINT));
+			// add attributes
+			attributes.put(IBreakpoint.ID, getModelIdentifier());
+			attributes.put(IMarker.CHAR_START, Integer.valueOf(charStart));
+			attributes.put(IMarker.CHAR_END, Integer.valueOf(charEnd));
+			attributes.put(TYPE_NAME, typeName);
+			attributes.put(MEMBER_TYPE, Integer.valueOf(memberType));
+			attributes.put(ENABLED, Boolean.TRUE);
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
 
-				// add attributes
-				attributes.put(IBreakpoint.ID, getModelIdentifier());
-				attributes.put(IMarker.CHAR_START, Integer.valueOf(charStart));
-				attributes.put(IMarker.CHAR_END, Integer.valueOf(charEnd));
-				attributes.put(TYPE_NAME, typeName);
-				attributes.put(MEMBER_TYPE, Integer.valueOf(memberType));
-				attributes.put(ENABLED, Boolean.TRUE);
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			ensureMarker().setAttributes(attributes);
 
-				ensureMarker().setAttributes(attributes);
-
-				register(add);
-			}
-
+			register(add);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
index 3dca9ae..cfc639d 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaExceptionBreakpoint.java
@@ -24,7 +24,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
@@ -169,27 +168,22 @@
 			final String exceptionName, final boolean caught,
 			final boolean uncaught, final boolean checked, final boolean add,
 			final Map<String, Object> attributes) throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+		IWorkspaceRunnable wr = monitor -> {
+			// create the marker
+			setMarker(resource.createMarker(JAVA_EXCEPTION_BREAKPOINT));
 
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
-				// create the marker
-				setMarker(resource.createMarker(JAVA_EXCEPTION_BREAKPOINT));
+			// add attributes
+			attributes.put(IBreakpoint.ID, getModelIdentifier());
+			attributes.put(TYPE_NAME, exceptionName);
+			attributes.put(ENABLED, Boolean.TRUE);
+			attributes.put(CAUGHT, Boolean.valueOf(caught));
+			attributes.put(UNCAUGHT, Boolean.valueOf(uncaught));
+			attributes.put(CHECKED, Boolean.valueOf(checked));
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
 
-				// add attributes
-				attributes.put(IBreakpoint.ID, getModelIdentifier());
-				attributes.put(TYPE_NAME, exceptionName);
-				attributes.put(ENABLED, Boolean.TRUE);
-				attributes.put(CAUGHT, Boolean.valueOf(caught));
-				attributes.put(UNCAUGHT, Boolean.valueOf(uncaught));
-				attributes.put(CHECKED, Boolean.valueOf(checked));
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			ensureMarker().setAttributes(attributes);
 
-				ensureMarker().setAttributes(attributes);
-
-				register(add);
-			}
-
+			register(add);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
index 35d98aa..782809c 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaLineBreakpoint.java
@@ -27,7 +27,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.DebugException;
@@ -144,24 +143,21 @@
 			final int charEnd, final int hitCount, final boolean add,
 			final Map<String, Object> attributes, final String markerType)
 			throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
+		IWorkspaceRunnable wr = monitor -> {
 
-				// create the marker
-				setMarker(resource.createMarker(markerType));
+			// create the marker
+			setMarker(resource.createMarker(markerType));
 
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addTypeNameAndHitCount(attributes, typeName, hitCount);
-				// set attributes
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				ensureMarker().setAttributes(attributes);
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addTypeNameAndHitCount(attributes, typeName, hitCount);
+			// set attributes
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			ensureMarker().setAttributes(attributes);
 
-				// add to breakpoint manager if requested
-				register(add);
-			}
+			// add to breakpoint manager if requested
+			register(add);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
index b2c7fdd..c8ac555 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodBreakpoint.java
@@ -22,7 +22,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.model.IDebugTarget;
@@ -147,27 +146,23 @@
 			final boolean exit, final boolean nativeOnly, final int lineNumber,
 			final int charStart, final int charEnd, final int hitCount,
 			final boolean register, final Map<String, Object> attributes) throws CoreException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
-				// create the marker
-				setMarker(resource.createMarker(JAVA_METHOD_BREAKPOINT));
+		IWorkspaceRunnable wr = monitor -> {
+			// create the marker
+			setMarker(resource.createMarker(JAVA_METHOD_BREAKPOINT));
 
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addMethodNameAndSignature(attributes, methodName,
-						methodSignature);
-				addTypeNameAndHitCount(attributes, typePattern, hitCount);
-				attributes.put(ENTRY, Boolean.valueOf(entry));
-				attributes.put(EXIT, Boolean.valueOf(exit));
-				attributes.put(NATIVE, Boolean.valueOf(nativeOnly));
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				// set attributes
-				ensureMarker().setAttributes(attributes);
-				register(register);
-			}
-
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addMethodNameAndSignature(attributes, methodName,
+					methodSignature);
+			addTypeNameAndHitCount(attributes, typePattern, hitCount);
+			attributes.put(ENTRY, Boolean.valueOf(entry));
+			attributes.put(EXIT, Boolean.valueOf(exit));
+			attributes.put(NATIVE, Boolean.valueOf(nativeOnly));
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			// set attributes
+			ensureMarker().setAttributes(attributes);
+			register(register);
 		};
 		run(getMarkerRule(resource), wr);
 		if (typePattern != null) {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java
index ffaf758..c1e4760 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaMethodEntryBreakpoint.java
@@ -19,7 +19,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.debug.core.model.IBreakpoint;
 import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
 import org.eclipse.jdt.debug.core.IJavaMethodEntryBreakpoint;
@@ -77,25 +76,21 @@
 			final String methodSignature, final int lineNumber,
 			final int charStart, final int charEnd, final int hitCount,
 			final boolean register, final Map<String, Object> attributes) throws CoreException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
-				// create the marker
-				setMarker(resource.createMarker(JAVA_METHOD_ENTRY_BREAKPOINT));
+		IWorkspaceRunnable wr = monitor -> {
+			// create the marker
+			setMarker(resource.createMarker(JAVA_METHOD_ENTRY_BREAKPOINT));
 
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addMethodNameAndSignature(attributes, methodName,
-						methodSignature);
-				addTypeNameAndHitCount(attributes, typeName, hitCount);
-				// set attributes
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				ensureMarker().setAttributes(attributes);
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addMethodNameAndSignature(attributes, methodName,
+					methodSignature);
+			addTypeNameAndHitCount(attributes, typeName, hitCount);
+			// set attributes
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			ensureMarker().setAttributes(attributes);
 
-				register(register);
-			}
-
+			register(register);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaPatternBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaPatternBreakpoint.java
index 8e711b3..077c4d5 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaPatternBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaPatternBreakpoint.java
@@ -21,7 +21,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.jdt.debug.core.IJavaPatternBreakpoint;
 import org.eclipse.jdt.debug.core.JDIDebugModel;
@@ -66,23 +65,20 @@
 			final int lineNumber, final int charStart, final int charEnd,
 			final int hitCount, final boolean add, final Map<String, Object> attributes,
 			final String markerType) throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
+		IWorkspaceRunnable wr = monitor -> {
 
-				// create the marker
-				setMarker(resource.createMarker(markerType));
+			// create the marker
+			setMarker(resource.createMarker(markerType));
 
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addPatternAndHitCount(attributes, sourceName, pattern, hitCount);
-				// set attributes
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				ensureMarker().setAttributes(attributes);
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addPatternAndHitCount(attributes, sourceName, pattern, hitCount);
+			// set attributes
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			ensureMarker().setAttributes(attributes);
 
-				register(add);
-			}
+			register(add);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java
index 20137de..de63d19 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaStratumLineBreakpoint.java
@@ -20,7 +20,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.debug.core.DebugException;
@@ -141,30 +140,27 @@
 			final int lineNumber, final int charStart, final int charEnd,
 			final int hitCount, final boolean register, final Map<String, Object> attributes,
 			final String markerType) throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
+		IWorkspaceRunnable wr = monitor -> {
 
-				// create the marker
-				setMarker(resource.createMarker(markerType));
+			// create the marker
+			setMarker(resource.createMarker(markerType));
 
-				// modify pattern
-				String pattern = classNamePattern;
-				if (pattern != null && pattern.length() == 0) {
-					pattern = null;
-				}
-
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addStratumPatternAndHitCount(attributes, stratum, sourceName,
-						sourcePath, pattern, hitCount);
-				// set attributes
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				ensureMarker().setAttributes(attributes);
-
-				register(register);
+			// modify pattern
+			String pattern = classNamePattern;
+			if (pattern != null && pattern.length() == 0) {
+				pattern = null;
 			}
+
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addStratumPatternAndHitCount(attributes, stratum, sourceName,
+					sourcePath, pattern, hitCount);
+			// set attributes
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			ensureMarker().setAttributes(attributes);
+
+			register(register);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaTargetPatternBreakpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaTargetPatternBreakpoint.java
index d0c0944..fea4972 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaTargetPatternBreakpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaTargetPatternBreakpoint.java
@@ -21,7 +21,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.jdt.debug.core.IJavaDebugTarget;
 import org.eclipse.jdt.debug.core.IJavaTargetPatternBreakpoint;
@@ -63,23 +62,20 @@
 			final int charEnd, final int hitCount, final boolean add,
 			final Map<String, Object> attributes, final String markerType)
 			throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
+		IWorkspaceRunnable wr = monitor -> {
 
-				// create the marker
-				setMarker(resource.createMarker(markerType));
+			// create the marker
+			setMarker(resource.createMarker(markerType));
 
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addSourceNameAndHitCount(attributes, sourceName, hitCount);
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				// set attributes
-				ensureMarker().setAttributes(attributes);
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addSourceNameAndHitCount(attributes, sourceName, hitCount);
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			// set attributes
+			ensureMarker().setAttributes(attributes);
 
-				register(add);
-			}
+			register(add);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java
index f84253a..24433a9 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/JavaWatchpoint.java
@@ -19,7 +19,6 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspaceRunnable;
 import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.Status;
@@ -111,26 +110,23 @@
 			final String fieldName, final int lineNumber, final int charStart,
 			final int charEnd, final int hitCount, final boolean add,
 			final Map<String, Object> attributes) throws DebugException {
-		IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-			@Override
-			public void run(IProgressMonitor monitor) throws CoreException {
-				setMarker(resource.createMarker(JAVA_WATCHPOINT));
+		IWorkspaceRunnable wr = monitor -> {
+			setMarker(resource.createMarker(JAVA_WATCHPOINT));
 
-				// add attributes
-				addLineBreakpointAttributes(attributes, getModelIdentifier(),
-						true, lineNumber, charStart, charEnd);
-				addTypeNameAndHitCount(attributes, typeName, hitCount);
-				attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
-				// configure the field handle
-				addFieldName(attributes, fieldName);
-				// configure the access and modification flags to defaults
-				addDefaultAccessAndModification(attributes);
+			// add attributes
+			addLineBreakpointAttributes(attributes, getModelIdentifier(),
+					true, lineNumber, charStart, charEnd);
+			addTypeNameAndHitCount(attributes, typeName, hitCount);
+			attributes.put(SUSPEND_POLICY, Integer.valueOf(getDefaultSuspendPolicy()));
+			// configure the field handle
+			addFieldName(attributes, fieldName);
+			// configure the access and modification flags to defaults
+			addDefaultAccessAndModification(attributes);
 
-				// set attributes
-				ensureMarker().setAttributes(attributes);
+			// set attributes
+			ensureMarker().setAttributes(attributes);
 
-				register(add);
-			}
+			register(add);
 		};
 		run(getMarkerRule(resource), wr);
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java
index 76a4d13..4fa9a29 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/hcr/JavaHotCodeReplaceManager.java
@@ -314,22 +314,12 @@
 		final List<JDIDebugTarget> hotSwapTargets = getHotSwapTargets();
 		final List<JDIDebugTarget> noHotSwapTargets = getNoHotSwapTargets();
 		if (!hotSwapTargets.isEmpty()) {
-			Runnable runnable = new Runnable() {
-				@Override
-				public void run() {
-					doHotCodeReplace(hotSwapTargets, resources, qualifiedNames);
-				}
-			};
+			Runnable runnable = () -> doHotCodeReplace(hotSwapTargets, resources, qualifiedNames);
 			DebugPlugin.getDefault().asyncExec(runnable);
 		}
 		if (!noHotSwapTargets.isEmpty()) {
-			Runnable runnable = new Runnable() {
-				@Override
-				public void run() {
-					notifyUnsupportedHCR(noHotSwapTargets, resources,
-							qualifiedNames);
-				}
-			};
+			Runnable runnable = () -> notifyUnsupportedHCR(noHotSwapTargets, resources,
+					qualifiedNames);
 			DebugPlugin.getDefault().asyncExec(runnable);
 		}
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
index 3ac7c71..d6c0016 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java
@@ -556,18 +556,15 @@
 		fireCreationEvent();
 		// begin handling/dispatching events after the creation event is handled
 		// by all listeners
-		plugin.asyncExec(new Runnable() {
-			@Override
-			public void run() {
-				EventDispatcher dispatcher = getEventDispatcher();
-				if (dispatcher != null) {
-					Thread t = new Thread(
-							dispatcher,
-							JDIDebugModel.getPluginIdentifier()
-									+ JDIDebugModelMessages.JDIDebugTarget_JDI_Event_Dispatcher);
-					t.setDaemon(true);
-					t.start();
-				}
+		plugin.asyncExec(() -> {
+			EventDispatcher dispatcher = getEventDispatcher();
+			if (dispatcher != null) {
+				Thread t = new Thread(
+						dispatcher,
+						JDIDebugModel.getPluginIdentifier()
+								+ JDIDebugModelMessages.JDIDebugTarget_JDI_Event_Dispatcher);
+				t.setDaemon(true);
+				t.start();
 			}
 		});
 	}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
index 4c51147..7dff265 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
@@ -17,7 +17,6 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
@@ -352,19 +351,16 @@
 							}
 						}
 						Collections.sort(fVariables,
-								new Comparator<IJavaVariable>() {
-									@Override
-									public int compare(IJavaVariable a, IJavaVariable b) {
-										JDIFieldVariable v1 = (JDIFieldVariable) a;
-										JDIFieldVariable v2 = (JDIFieldVariable) b;
-										try {
-											return v1.getName()
-													.compareToIgnoreCase(
-															v2.getName());
-										} catch (DebugException de) {
-											logError(de);
-											return -1;
-										}
+								(a, b) -> {
+									JDIFieldVariable v1 = (JDIFieldVariable) a;
+									JDIFieldVariable v2 = (JDIFieldVariable) b;
+									try {
+										return v1.getName()
+												.compareToIgnoreCase(
+														v2.getName());
+									} catch (DebugException de) {
+										logError(de);
+										return -1;
 									}
 								});
 					}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
index 982bd78..e495b02 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
@@ -2050,50 +2050,47 @@
 			return;
 		}
 		fIsSuspending = true;
-		Thread thread = new Thread(new Runnable() {
-			@Override
-			public void run() {
-				try {
-					fThread.suspend();
-					int timeout = Platform.getPreferencesService().getInt(
-							JDIDebugPlugin.getUniqueIdentifier(),
-							JDIDebugModel.PREF_REQUEST_TIMEOUT,
-							JDIDebugModel.DEF_REQUEST_TIMEOUT,
-							null);
-					long stop = System.currentTimeMillis() + timeout;
-					boolean suspended = isUnderlyingThreadSuspended();
-					while (System.currentTimeMillis() < stop && !suspended) {
-						try {
-							Thread.sleep(50);
-						} catch (InterruptedException e) {
-						}
-						suspended = isUnderlyingThreadSuspended();
-						if (suspended) {
-							break;
-						}
+		Thread thread = new Thread(() -> {
+			try {
+				fThread.suspend();
+				int timeout = Platform.getPreferencesService().getInt(
+						JDIDebugPlugin.getUniqueIdentifier(),
+						JDIDebugModel.PREF_REQUEST_TIMEOUT,
+						JDIDebugModel.DEF_REQUEST_TIMEOUT,
+						null);
+				long stop = System.currentTimeMillis() + timeout;
+				boolean suspended = isUnderlyingThreadSuspended();
+				while (System.currentTimeMillis() < stop && !suspended) {
+					try {
+						Thread.sleep(50);
+					} catch (InterruptedException e1) {
 					}
-					if (!suspended) {
-						IStatus status = new Status(
-								IStatus.ERROR,
-								JDIDebugPlugin.getUniqueIdentifier(),
-								SUSPEND_TIMEOUT,
-								MessageFormat.format(JDIDebugModelMessages.JDIThread_suspend_timeout, Integer.valueOf(timeout).toString()),
-								null);
-						IStatusHandler handler = DebugPlugin.getDefault()
-								.getStatusHandler(status);
-						if (handler != null) {
-							try {
-								handler.handleStatus(status, JDIThread.this);
-							} catch (CoreException e) {
-							}
-						}
+					suspended = isUnderlyingThreadSuspended();
+					if (suspended) {
+						break;
 					}
-					setRunning(false);
-					fireSuspendEvent(DebugEvent.CLIENT_REQUEST);
-				} catch (RuntimeException exception) {
-				} finally {
-					fIsSuspending = false;
 				}
+				if (!suspended) {
+					IStatus status = new Status(
+							IStatus.ERROR,
+							JDIDebugPlugin.getUniqueIdentifier(),
+							SUSPEND_TIMEOUT,
+							MessageFormat.format(JDIDebugModelMessages.JDIThread_suspend_timeout, Integer.valueOf(timeout).toString()),
+							null);
+					IStatusHandler handler = DebugPlugin.getDefault()
+							.getStatusHandler(status);
+					if (handler != null) {
+						try {
+							handler.handleStatus(status, JDIThread.this);
+						} catch (CoreException e2) {
+						}
+					}
+				}
+				setRunning(false);
+				fireSuspendEvent(DebugEvent.CLIENT_REQUEST);
+			} catch (RuntimeException exception) {
+			} finally {
+				fIsSuspending = false;
 			}
 		});
 		thread.setDaemon(true);
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIValue.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIValue.java
index 9e5ccbe..791e84c 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIValue.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIValue.java
@@ -16,7 +16,6 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 
@@ -283,12 +282,7 @@
 							(JDIDebugTarget) getDebugTarget(), field, object,
 							fLogicalParent));
 				}
-				Collections.sort(fVariables, new Comparator<IJavaVariable>() {
-					@Override
-					public int compare(IJavaVariable a, IJavaVariable b) {
-						return sortChildren(a, b);
-					}
-				});
+				Collections.sort(fVariables, (a, b) -> sortChildren(a, b));
 			}
 
 			return fVariables;
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java
index cfdc709..fce9869 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/Timer.java
@@ -51,23 +51,20 @@
 	 */
 	public Timer() {
 		setTimeout(Integer.MAX_VALUE);
-		Runnable r = new Runnable() {
-			@Override
-			public void run() {
-				while (isAlive()) {
-					boolean interrupted = false;
-					try {
-						Thread.sleep(getTimeout());
-					} catch (InterruptedException e) {
-						interrupted = true;
-					}
-					if (!interrupted) {
-						if (getListener() != null) {
-							setStarted(false);
-							setTimeout(Integer.MAX_VALUE);
-							getListener().timeout();
-							setListener(null);
-						}
+		Runnable r = () -> {
+			while (isAlive()) {
+				boolean interrupted = false;
+				try {
+					Thread.sleep(getTimeout());
+				} catch (InterruptedException e) {
+					interrupted = true;
+				}
+				if (!interrupted) {
+					if (getListener() != null) {
+						setStarted(false);
+						setTimeout(Integer.MAX_VALUE);
+						getListener().timeout();
+						setListener(null);
 					}
 				}
 			}