From 71e9ac5a85c9712452f639b5f4708ebb86d7b76a Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Fri, 30 Apr 2021 15:29:38 +0800 Subject: [PATCH] Fix the broken due to the changes from the upstream JDI impl class ConnectorImpl$StringArgumentImpl (#374) --- com.microsoft.java.debug.core/pom.xml | 2 +- com.microsoft.java.debug.plugin/.classpath | 2 +- .../META-INF/MANIFEST.MF | 4 +- com.microsoft.java.debug.plugin/pom.xml | 4 +- .../internal/AdvancedLaunchingConnector.java | 80 +++++++++++++++++-- .../category.xml | 2 +- com.microsoft.java.debug.repository/pom.xml | 2 +- pom.xml | 2 +- 8 files changed, 83 insertions(+), 15 deletions(-) diff --git a/com.microsoft.java.debug.core/pom.xml b/com.microsoft.java.debug.core/pom.xml index 04099cf90..e0260e727 100644 --- a/com.microsoft.java.debug.core/pom.xml +++ b/com.microsoft.java.debug.core/pom.xml @@ -5,7 +5,7 @@ com.microsoft.java java-debug-parent - 0.31.0 + 0.31.1 com.microsoft.java.debug.core jar diff --git a/com.microsoft.java.debug.plugin/.classpath b/com.microsoft.java.debug.plugin/.classpath index 3fd9659f9..c00d65ed3 100644 --- a/com.microsoft.java.debug.plugin/.classpath +++ b/com.microsoft.java.debug.plugin/.classpath @@ -6,6 +6,6 @@ - + diff --git a/com.microsoft.java.debug.plugin/META-INF/MANIFEST.MF b/com.microsoft.java.debug.plugin/META-INF/MANIFEST.MF index be9168b0c..84bd01f8f 100644 --- a/com.microsoft.java.debug.plugin/META-INF/MANIFEST.MF +++ b/com.microsoft.java.debug.plugin/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Java Debug Server Plugin Bundle-SymbolicName: com.microsoft.java.debug.plugin;singleton:=true -Bundle-Version: 0.31.0 +Bundle-Version: 0.31.1 Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Activator: com.microsoft.java.debug.plugin.internal.JavaDebuggerServerPlugin @@ -25,4 +25,4 @@ Bundle-ClassPath: lib/commons-io-2.5.jar, ., lib/rxjava-2.1.1.jar, lib/reactive-streams-1.0.0.jar, - lib/com.microsoft.java.debug.core-0.31.0.jar + lib/com.microsoft.java.debug.core-0.31.1.jar diff --git a/com.microsoft.java.debug.plugin/pom.xml b/com.microsoft.java.debug.plugin/pom.xml index 0fefc2fea..f9a19badc 100644 --- a/com.microsoft.java.debug.plugin/pom.xml +++ b/com.microsoft.java.debug.plugin/pom.xml @@ -5,7 +5,7 @@ com.microsoft.java java-debug-parent - 0.31.0 + 0.31.1 com.microsoft.java.debug.plugin eclipse-plugin @@ -45,7 +45,7 @@ com.microsoft.java com.microsoft.java.debug.core - 0.31.0 + 0.31.1 diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/AdvancedLaunchingConnector.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/AdvancedLaunchingConnector.java index d025c9c1d..607d26a4e 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/AdvancedLaunchingConnector.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/AdvancedLaunchingConnector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Microsoft Corporation and others. + * Copyright (c) 2017-2021 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 @@ -44,11 +44,11 @@ public AdvancedLaunchingConnector(VirtualMachineManagerImpl virtualMachineManage public Map defaultArguments() { Map defaultArgs = super.defaultArguments(); - Argument cwdArg = new AdvancedStringArgumentImpl(DebugUtility.CWD, "Current working directory", DebugUtility.CWD, false); + Argument cwdArg = new JDIStringArgumentImpl(DebugUtility.CWD, "Current working directory", DebugUtility.CWD, false); cwdArg.setValue(null); defaultArgs.put(DebugUtility.CWD, cwdArg); - Argument envArg = new AdvancedStringArgumentImpl(DebugUtility.ENV, "Environment variables", DebugUtility.ENV, false); + Argument envArg = new JDIStringArgumentImpl(DebugUtility.ENV, "Environment variables", DebugUtility.ENV, false); envArg.setValue(null); defaultArgs.put(DebugUtility.ENV, envArg); @@ -117,11 +117,79 @@ private static String[] constructLaunchCommand(Map l return DebugUtility.parseArguments(execString.toString()).toArray(new String[0]); } - class AdvancedStringArgumentImpl extends StringArgumentImpl implements StringArgument { - private static final long serialVersionUID = 1L; + abstract class JDIArgumentImpl implements Argument { + private static final long serialVersionUID = 8850533280769854833L; + private String name; + private String description; + private String label; + private boolean mustSpecify; + + protected JDIArgumentImpl(String name, String description, String label, boolean mustSpecify) { + this.name = name; + this.description = description; + this.label = label; + this.mustSpecify = mustSpecify; + } + + @Override + public String name() { + return name; + } + + @Override + public String description() { + return description; + } + + @Override + public String label() { + return label; + } + + @Override + public boolean mustSpecify() { + return mustSpecify; + } + + @Override + public abstract String value(); + + @Override + public abstract void setValue(String value); + + @Override + public abstract boolean isValid(String value); - protected AdvancedStringArgumentImpl(String name, String description, String label, boolean mustSpecify) { + @Override + public abstract String toString(); + } + + class JDIStringArgumentImpl extends JDIArgumentImpl implements StringArgument { + private static final long serialVersionUID = 6009335074727417445L; + private String value; + + protected JDIStringArgumentImpl(String name, String description, String label, boolean mustSpecify) { super(name, description, label, mustSpecify); } + + @Override + public String value() { + return value; + } + + @Override + public void setValue(String value) { + this.value = value; + } + + @Override + public boolean isValid(String value) { + return true; + } + + @Override + public String toString() { + return value; + } } } diff --git a/com.microsoft.java.debug.repository/category.xml b/com.microsoft.java.debug.repository/category.xml index 9a33da2cf..3520fec6d 100644 --- a/com.microsoft.java.debug.repository/category.xml +++ b/com.microsoft.java.debug.repository/category.xml @@ -1,6 +1,6 @@ - + diff --git a/com.microsoft.java.debug.repository/pom.xml b/com.microsoft.java.debug.repository/pom.xml index 1d0b490e9..f3ee87766 100644 --- a/com.microsoft.java.debug.repository/pom.xml +++ b/com.microsoft.java.debug.repository/pom.xml @@ -4,7 +4,7 @@ com.microsoft.java java-debug-parent - 0.31.0 + 0.31.1 com.microsoft.java.debug.repository eclipse-repository diff --git a/pom.xml b/pom.xml index a27138fb9..4e5d368b8 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ${base.name} :: Parent 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.31.0 + 0.31.1 pom Java Debug Server for Visual Studio Code