You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/01/10 12:48:27 UTC

[GitHub] [netbeans] arusinha opened a new pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

arusinha opened a new pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857
 
 
   …ion in Java Single Source File
   
   
   Jira Link : https://issues.apache.org/jira/browse/NETBEANS-3616

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] ebarboni commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
ebarboni commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-579155448
 
 
   unclear status, I guess for 12.0

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-579157494
 
 
   hi @ebarboni , I am working on the review comments. Once done will it be possible to accommodate the PR in 11.3? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-573999722
 
 
   Q: -why parse the target address from the output, and not let the IDE listen and pass the port on 
   which the IDE is listening to the debugee
   Ans: My initial approach was adding a specific port for debug, but later changed it to dynamic port as I wanted to avoid this extra configuration in file properties.
   
   Q:  Moreover - if the compilation fails, will the user see the compilation error messages from javac? I see External Execution only supports a single Process, so this is obviously tricky.
   
   Ans:  In output window compilation/run errors are getting captured.
   
   e.g.,
   
    Error on Compilation. Please verify Source code and Compiler VM Options:
   /scratch/arusinha/JEP-330-trial/NewCla.java:26: error: not a statement
           aaa
           ^
   /scratch/arusinha/JEP-330-trial/NewCla.java:26: error: ';' expected
           aaa
              ^
   Note: /scratch/arusinha/JEP-330-trial/NewCla.java uses preview language features.
   Note: Recompile with -Xlint:preview for details.
   2 errors
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#discussion_r373373903
 
 

 ##########
 File path: java/java.api.common/src/org/netbeans/modules/java/api/common/singlesourcefile/CompileProcess.java
 ##########
 @@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.api.common.singlesourcefile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.openide.filesystems.FileObject;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Arunava Sinha
+ */
+class CompileProcess  {
+
+    private static final Logger LOG = Logger.getLogger(CompileProcess.class.getName());
+    FileObject fileObject;
+
+    
+    public CompileProcess(FileObject fileObject) {
+        this.fileObject = fileObject;
+    }
+
+    public Process setupProcess() {
+        File javaBinPath = new File(new File(System.getProperty("java.home")), "bin");  //NOI18N
+        String javaPath = javaBinPath.getAbsolutePath() + "//java";  //NOI18N
 
 Review comment:
   I wonder what is the point of "//"?
   
   Anyway, a better way may be JavaPlatformManager.getDefaultPlatform().findTool("java").

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#discussion_r373375335
 
 

 ##########
 File path: java/java.api.common/src/org/netbeans/modules/java/api/common/singlesourcefile/DebugProcess.java
 ##########
 @@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.api.common.singlesourcefile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openide.filesystems.FileObject;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Arunava Sinha
+ */
+class DebugProcess {
+
+    private static final Logger LOG = Logger.getLogger(DebugProcess.class.getName());
+    private final Pattern JVM_ARGS_PATTERN = Pattern.compile("(.*) (--source[ ]* [0-9]*)(.*)");  //NOI18N
+
+    public Process setupProcess(FileObject fileObject, String port) {
+        try {
+
+            List<String> commandsList = new ArrayList<>();
+            if (Utilities.isUnix()) {
 
 Review comment:
   (Similar comments as above.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] jlahoda commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
jlahoda commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-573912869
 
 
   I guess two questions for now:
   -why parse the target address from the output, and not let the IDE listen and pass the port on which the IDE is listening to the debugee? Many if not all (Java) projects are doing that - see the JPDAStart classes.
   -the handling of Processes feels suspicious - it is not clear why there are subclasses of Process. Moreover - if the compilation fails, will the user see the compilation error messages from javac? I see External Execution only supports a single Process, so this is obviously tricky.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#discussion_r373374693
 
 

 ##########
 File path: java/java.api.common/src/org/netbeans/modules/java/api/common/singlesourcefile/CompileProcess.java
 ##########
 @@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.api.common.singlesourcefile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.openide.filesystems.FileObject;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Arunava Sinha
+ */
+class CompileProcess  {
+
+    private static final Logger LOG = Logger.getLogger(CompileProcess.class.getName());
+    FileObject fileObject;
+
+    
+    public CompileProcess(FileObject fileObject) {
+        this.fileObject = fileObject;
+    }
+
+    public Process setupProcess() {
+        File javaBinPath = new File(new File(System.getProperty("java.home")), "bin");  //NOI18N
+        String javaPath = javaBinPath.getAbsolutePath() + "//java";  //NOI18N
+
+        String javacPath = javaBinPath.getAbsolutePath() + "//javac";  //NOI18N
+        List<String> compileCommandList = new ArrayList<>();
+        if (Utilities.isUnix()) {
+            compileCommandList.add("bash"); //NOI18N
+            compileCommandList.add("-c"); //NOI18N
+        }
+
+        Object compilerVmOptionsObj = fileObject.getAttribute(SingleSourceFileUtil.FILE_VM_OPTIONS);
+        String vmOptions = compilerVmOptionsObj != null ? (String) compilerVmOptionsObj : "";
+
+        compileCommandList.add(javacPath + " -g" + " " + vmOptions + " " + fileObject.getPath());
 
 Review comment:
   FWIW - I suspect this will not work very well for paths with spaces. Doing things like:
   compileCommandList.add(javacPath);
   compileCommandList.add("-g");
   ...
   
   might work better in multiple ways.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] ebarboni merged pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
ebarboni merged pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-580697234
 
 
   @ebarboni ,As suggested i will create a separate PR addressing the reviews

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#discussion_r373375158
 
 

 ##########
 File path: java/java.api.common/src/org/netbeans/modules/java/api/common/singlesourcefile/CompileProcess.java
 ##########
 @@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.api.common.singlesourcefile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.openide.filesystems.FileObject;
+import org.openide.util.Utilities;
+
+/**
+ *
+ * @author Arunava Sinha
+ */
+class CompileProcess  {
+
+    private static final Logger LOG = Logger.getLogger(CompileProcess.class.getName());
+    FileObject fileObject;
+
+    
+    public CompileProcess(FileObject fileObject) {
+        this.fileObject = fileObject;
+    }
+
+    public Process setupProcess() {
+        File javaBinPath = new File(new File(System.getProperty("java.home")), "bin");  //NOI18N
+        String javaPath = javaBinPath.getAbsolutePath() + "//java";  //NOI18N
+
+        String javacPath = javaBinPath.getAbsolutePath() + "//javac";  //NOI18N
+        List<String> compileCommandList = new ArrayList<>();
+        if (Utilities.isUnix()) {
+            compileCommandList.add("bash"); //NOI18N
 
 Review comment:
   I wonder why use bash here - is that to split the whitespace-deliminated command line constructed below to parts? Better would be to avoid bash and have a single entry in the list per command/argument.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
arusinha commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-579606249
 
 
   @jlahoda , I had incorporated all the review comments in last commit

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
lahodaj commented on a change in pull request #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#discussion_r373375675
 
 

 ##########
 File path: java/java.api.common/src/org/netbeans/modules/java/api/common/singlesourcefile/JPDAStart.java
 ##########
 @@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.api.common.singlesourcefile;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sun.jdi.Bootstrap;
+import com.sun.jdi.connect.ListeningConnector;
+import com.sun.jdi.connect.Transport;
+import com.sun.jdi.connect.Connector;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.netbeans.api.debugger.jpda.DebuggerStartException;
+
+import org.openide.util.RequestProcessor;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.api.debugger.jpda.JPDADebugger;
+import org.netbeans.spi.java.classpath.support.ClassPathSupport;
+import org.openide.util.Exceptions;
+import org.openide.windows.InputOutput;
+
+/**
+ * Start the JPDA debugger.
+ *
+ * @author Arunava Sinha
+ */
+public class JPDAStart implements Runnable {
+
+    private static final RequestProcessor RP = new RequestProcessor(JPDAStart.class);
+    private static final String TRANSPORT = "dt_socket"; //NOI18N
+    private static final Logger LOG = Logger.getLogger(JPDAStart.class.getName());
+
+    private final Object[] lock = new Object[2];
+    private final InputOutput io;
+    private final FileObject fileObject;
+
+    JPDAStart(InputOutput inputOutput, FileObject fileObject) {
+        io = inputOutput;
+        this.fileObject = fileObject;
+    }
+
+    /**
+     * returns the port that the debugger listens to..
+     */
+    public String execute() throws Throwable {
+        LOG.log(Level.INFO, "JPDA Listening Start"); //NOI18N
+        synchronized (lock) {
+            RP.post(this);
+            lock.wait();
+            if (lock[1] != null) {
+                throw ((Throwable) lock[1]); //NOI18N
+            }
+        }
+        return (String) lock[0];
+    }
+
+    @Override
+    public void run() {
+        synchronized (lock) {
+
+            try {
+
+                ListeningConnector lc = null;
+                Iterator i = Bootstrap.virtualMachineManager().
+                        listeningConnectors().iterator();
+                for (; i.hasNext();) {
+                    lc = (ListeningConnector) i.next();
+                    Transport t = lc.transport();
+                    if (t != null && t.name().equals(getTransport())) {
+                        break;
+                    }
+                }
+                if (lc == null) {
+                    throw new RuntimeException("No trasports named " + getTransport() + " found!"); //NOI18N
+                }
+
+                final Map args = lc.defaultArguments();
+                String address = lc.startListening(args);
+                try {
+                    int port = Integer.parseInt(address.substring(address.indexOf(':') + 1));
+                    Connector.IntegerArgument portArg = (Connector.IntegerArgument) args.get("port"); //NOI18N
+                    portArg.setValue(port);
+                    lock[0] = Integer.toString(port);
+                } catch (NumberFormatException e) {
+                    lock[0] = address;
+                }
+                LOG.log(Level.INFO, "Debug Port:{0}", lock[0]);  //NOI18N
+
+                final Map properties = new HashMap();
+
+                ClassPath sourcePath = ClassPathSupport.createClassPath(fileObject.getParent());
+                ClassPath jdkPath = ClassPathSupport.createClassPath(System.getProperty("java.class.path"));
+
+                properties.put("sourcepath", sourcePath); //NOI18N
+                File baseDir = FileUtil.toFile(fileObject.getParent());
+                properties.put("baseDir", baseDir); //NOI18N
+                properties.put("name", fileObject.getName()); //NOI18N
+
+                final ListeningConnector flc = lc;
+                RP.post(() -> {
+                    try {
+                        JPDADebugger.startListening(flc, args,
+                                new Object[]{properties});
+                    } catch (DebuggerStartException ex) {
+                        io.getErr().println("Debugger Start Error."); //NOI18N
+                        LOG.log(Level.SEVERE, "Debugger Start Error.", ex);
+                    }
+                });
+            } catch (java.io.IOException ioex) {
+                io.getErr().println("IO Error:"); //NOI18N
+//                org.openide.ErrorManager.getDefault().notify(ioex);
+                lock[1] = ioex;
+            } catch (com.sun.jdi.connect.IllegalConnectorArgumentsException icaex) {
+                io.getErr().println("Illegal Connector"); //NOI18N
+                lock[1] = icaex;
+            } finally {
+                lock.notify();
+            }
+        }
+
+    }
+
+    public String getTransport() {
+        return TRANSPORT;
+    }
+
+    private static final class CopyReaderWriter implements Runnable {
 
 Review comment:
   This is unused, correct? Could be removed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] ebarboni commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
ebarboni commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-580671144
 
 
   Thks for review @lahodaj. @arusinha can you consider a new pr to adress the remarks. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] ebarboni commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…

Posted by GitBox <gi...@apache.org>.
ebarboni commented on issue #1857: [NETBEANS-3616]:Provided support of enable-preview hint and debug opt…
URL: https://github.com/apache/netbeans/pull/1857#issuecomment-580338290
 
 
   @arusinha it's a bit complicated for me. if @jlahoda can review fast and is ok I will merge.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists