Skip to content

Commit c3a01e2

Browse files
Support debug settings to control how to trigger HCR (#275)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent 24e8f05 commit c3a01e2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/DebugSettings.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.logging.Logger;
1515

1616
import com.google.gson.JsonSyntaxException;
17+
import com.google.gson.annotations.SerializedName;
1718
import com.microsoft.java.debug.core.protocol.JsonUtils;
1819

1920
public final class DebugSettings {
@@ -24,10 +25,10 @@ public final class DebugSettings {
2425
public boolean showStaticVariables = false;
2526
public boolean showQualifiedNames = false;
2627
public boolean showHex = false;
27-
public boolean enableHotCodeReplace = false;
2828
public boolean showLogicalStructure = true;
2929
public String logLevel;
3030
public String javaHome;
31+
public HotCodeReplace hotCodeReplace = HotCodeReplace.MANUAL;
3132

3233
public static DebugSettings getCurrent() {
3334
return current;
@@ -50,4 +51,13 @@ public void updateSettings(String jsonSettings) {
5051
private DebugSettings() {
5152

5253
}
54+
55+
public static enum HotCodeReplace {
56+
@SerializedName("manual")
57+
MANUAL,
58+
@SerializedName("auto")
59+
AUTO,
60+
@SerializedName("never")
61+
NEVER
62+
}
5363
}

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JavaHotCodeReplaceProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Yevgen Kogan - Bug 403475 - Hot Code Replace drops too much frames in some cases
1111
*******************************************************************************/
1212
/*******************************************************************************
13-
* Copyright (c) 2017 Microsoft Corporation and others.
13+
* Copyright (c) 2017-2019 Microsoft Corporation and others.
1414
* All rights reserved. This program and the accompanying materials
1515
* are made available under the terms of the Eclipse Public License v1.0
1616
* which accompanies this distribution, and is available at
@@ -259,7 +259,7 @@ private IResource getSourceFile(IJavaProject project, String qualifiedName, Stri
259259

260260
@Override
261261
public void initialize(IDebugAdapterContext context, Map<String, Object> options) {
262-
if (DebugSettings.getCurrent().enableHotCodeReplace) {
262+
if (DebugSettings.getCurrent().hotCodeReplace != DebugSettings.HotCodeReplace.NEVER) {
263263
// Listen to the built file events.
264264
ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
265265
}

0 commit comments

Comments
 (0)