diff --git a/com.microsoft.java.debug.core/pom.xml b/com.microsoft.java.debug.core/pom.xml
index 73bd361dd..fada08a60 100644
--- a/com.microsoft.java.debug.core/pom.xml
+++ b/com.microsoft.java.debug.core/pom.xml
@@ -3,12 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
ch.epfl.scala
- com-microsoft-java-debug-core
+ com.microsoft.java.debug.core
jar
${base.name} :: Debugger Core
The Java Debug Server is an implementation of Visual Studio Code (VSCode) Debug Protocol. It can be used in Visual Studio Code to debug Java programs.
- https://github.com/Microsoft/java-debug
- 0.34.0+1-SNAPSHOT
+ https://github.com/scalacenter/java-debug
+ 0.38.0
Java Debug Server for Visual Studio Code
UTF-8
@@ -33,7 +33,7 @@
- ch.epfl.scaal
+ ch.epfl.scala
https://scala.epfl.ch/
diff --git a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/IStepFilterProvider.java b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/IStepFilterProvider.java
new file mode 100644
index 000000000..faa92f7b8
--- /dev/null
+++ b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/IStepFilterProvider.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Microsoft 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:
+ * Microsoft Corporation - initial API and implementation
+ *******************************************************************************/
+
+package com.microsoft.java.debug.core.adapter;
+
+import com.microsoft.java.debug.core.protocol.Requests;
+import com.sun.jdi.Method;
+
+public interface IStepFilterProvider extends IProvider {
+ boolean skip(Method method, Requests.StepFilters filters);
+}
diff --git a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/StepFilterProvider.java b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/StepFilterProvider.java
new file mode 100644
index 000000000..f55b85fff
--- /dev/null
+++ b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/StepFilterProvider.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Microsoft 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:
+ * Microsoft Corporation - initial API and implementation
+ *******************************************************************************/
+
+package com.microsoft.java.debug.core.adapter;
+
+import com.microsoft.java.debug.core.protocol.Requests;
+import com.sun.jdi.Method;
+import org.apache.commons.lang3.ArrayUtils;
+
+public class StepFilterProvider implements IStepFilterProvider {
+ @Override
+ public boolean skip(Method method, Requests.StepFilters filters) {
+ if (!isConfigured(filters)) {
+ return false;
+ }
+ return (filters.skipStaticInitializers && method.isStaticInitializer())
+ || (filters.skipSynthetics && method.isSynthetic())
+ || (filters.skipConstructors && method.isConstructor());
+ }
+
+ private boolean isConfigured(Requests.StepFilters filters) {
+ if (filters == null) {
+ return false;
+ }
+ return ArrayUtils.isNotEmpty(filters.allowClasses) || ArrayUtils.isNotEmpty(filters.skipClasses)
+ || ArrayUtils.isNotEmpty(filters.classNameFilters) || filters.skipConstructors
+ || filters.skipStaticInitializers || filters.skipSynthetics;
+ }
+}
diff --git a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StepRequestHandler.java b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StepRequestHandler.java
index 72d14eb5d..dc200fe38 100644
--- a/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StepRequestHandler.java
+++ b/com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/StepRequestHandler.java
@@ -15,8 +15,6 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;
-import org.apache.commons.lang3.ArrayUtils;
-
import com.microsoft.java.debug.core.DebugEvent;
import com.microsoft.java.debug.core.DebugUtility;
import com.microsoft.java.debug.core.IDebugSession;
@@ -26,12 +24,12 @@
import com.microsoft.java.debug.core.adapter.ErrorCode;
import com.microsoft.java.debug.core.adapter.IDebugAdapterContext;
import com.microsoft.java.debug.core.adapter.IDebugRequestHandler;
+import com.microsoft.java.debug.core.adapter.IStepFilterProvider;
import com.microsoft.java.debug.core.protocol.Events;
import com.microsoft.java.debug.core.protocol.Messages.Response;
import com.microsoft.java.debug.core.protocol.Requests.Arguments;
import com.microsoft.java.debug.core.protocol.Requests.Command;
import com.microsoft.java.debug.core.protocol.Requests.StepArguments;
-import com.microsoft.java.debug.core.protocol.Requests.StepFilters;
import com.sun.jdi.IncompatibleThreadStateException;
import com.sun.jdi.Location;
import com.sun.jdi.Method;
@@ -161,27 +159,26 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
} else if (event instanceof StepEvent) {
ThreadReference thread = ((StepEvent) event).thread();
threadState.deleteStepRequest(eventRequestManager);
- if (isStepFiltersConfigured(context.getStepFilters())) {
- try {
- if (threadState.pendingStepType == Command.STEPIN) {
- int currentStackDepth = thread.frameCount();
- Location currentStepLocation = getTopFrame(thread).location();
+ IStepFilterProvider stepFilter = context.getProvider(IStepFilterProvider.class);
+ try {
+ if (threadState.pendingStepType == Command.STEPIN) {
+ int currentStackDepth = thread.frameCount();
+ Location currentStepLocation = getTopFrame(thread).location();
- // If the ending step location is filtered, or same as the original location where the step into operation is originated,
- // do another step of the same kind.
- if (shouldFilterLocation(threadState.stepLocation, currentStepLocation, context)
- || shouldDoExtraStepInto(threadState.stackDepth, threadState.stepLocation, currentStackDepth, currentStepLocation)) {
- threadState.pendingStepRequest = DebugUtility.createStepIntoRequest(thread,
- context.getStepFilters().allowClasses,
- context.getStepFilters().skipClasses);
- threadState.pendingStepRequest.enable();
- debugEvent.shouldResume = true;
- return;
- }
+ // If the ending step location is filtered, or same as the original location where the step into operation is originated,
+ // do another step of the same kind.
+ if (shouldFilterLocation(threadState.stepLocation, currentStepLocation, stepFilter, context)
+ || shouldDoExtraStepInto(threadState.stackDepth, threadState.stepLocation, currentStackDepth, currentStepLocation)) {
+ threadState.pendingStepRequest = DebugUtility.createStepIntoRequest(thread,
+ context.getStepFilters().allowClasses,
+ context.getStepFilters().skipClasses);
+ threadState.pendingStepRequest.enable();
+ debugEvent.shouldResume = true;
+ return;
}
- } catch (IncompatibleThreadStateException | IndexOutOfBoundsException ex) {
- // ignore.
}
+ } catch (IncompatibleThreadStateException | IndexOutOfBoundsException ex) {
+ // ignore.
}
threadState.deleteMethodExitRequest(eventRequestManager);
if (threadState.eventSubscription != null) {
@@ -205,33 +202,19 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
}
}
- private boolean isStepFiltersConfigured(StepFilters filters) {
- if (filters == null) {
- return false;
- }
- return ArrayUtils.isNotEmpty(filters.allowClasses) || ArrayUtils.isNotEmpty(filters.skipClasses)
- || ArrayUtils.isNotEmpty(filters.classNameFilters) || filters.skipConstructors
- || filters.skipStaticInitializers || filters.skipSynthetics;
- }
-
/**
* Return true if the StepEvent's location is a Method that the user has indicated to filter.
*
* @throws IncompatibleThreadStateException
* if the thread is not suspended in the target VM.
*/
- private boolean shouldFilterLocation(Location originalLocation, Location currentLocation, IDebugAdapterContext context)
+ private boolean shouldFilterLocation(Location originalLocation, Location currentLocation, IStepFilterProvider stepFilter, IDebugAdapterContext context)
throws IncompatibleThreadStateException {
if (originalLocation == null || currentLocation == null) {
return false;
}
- return !shouldFilterMethod(originalLocation.method(), context) && shouldFilterMethod(currentLocation.method(), context);
- }
-
- private boolean shouldFilterMethod(Method method, IDebugAdapterContext context) {
- return (context.getStepFilters().skipStaticInitializers && method.isStaticInitializer())
- || (context.getStepFilters().skipSynthetics && method.isSynthetic())
- || (context.getStepFilters().skipConstructors && method.isConstructor());
+ return !stepFilter.skip(originalLocation.method(), context.getStepFilters())
+ && stepFilter.skip(currentLocation.method(), context.getStepFilters());
}
/**
diff --git a/com.microsoft.java.debug.plugin/pom.xml b/com.microsoft.java.debug.plugin/pom.xml
index 8a65029aa..7fe6167aa 100644
--- a/com.microsoft.java.debug.plugin/pom.xml
+++ b/com.microsoft.java.debug.plugin/pom.xml
@@ -54,7 +54,7 @@
2.11.0
- com.microsoft.java
+ ch.epfl.scala
com.microsoft.java.debug.core
0.38.0
diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtProviderContextFactory.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtProviderContextFactory.java
index 7213f8e9a..37ebc2dae 100644
--- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtProviderContextFactory.java
+++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtProviderContextFactory.java
@@ -16,8 +16,10 @@
import com.microsoft.java.debug.core.adapter.IHotCodeReplaceProvider;
import com.microsoft.java.debug.core.adapter.IProviderContext;
import com.microsoft.java.debug.core.adapter.ISourceLookUpProvider;
+import com.microsoft.java.debug.core.adapter.IStepFilterProvider;
import com.microsoft.java.debug.core.adapter.IVirtualMachineManagerProvider;
import com.microsoft.java.debug.core.adapter.ProviderContext;
+import com.microsoft.java.debug.core.adapter.StepFilterProvider;
import com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider;
/**
@@ -35,6 +37,7 @@ public static IProviderContext createProviderContext() {
context.registerProvider(IHotCodeReplaceProvider.class, new JavaHotCodeReplaceProvider());
context.registerProvider(IEvaluationProvider.class, new JdtEvaluationProvider());
context.registerProvider(ICompletionsProvider.class, new CompletionsProvider());
+ context.registerProvider(IStepFilterProvider.class, new StepFilterProvider());
return context;
}