diff --git a/ide/extexecution.process.jdk9/manifest.mf b/ide/extexecution.process.jdk9/manifest.mf deleted file mode 100644 index cab129ffdd62..000000000000 --- a/ide/extexecution.process.jdk9/manifest.mf +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -AutoUpdate-Show-In-Client: false -OpenIDE-Module: org.netbeans.modules.extexecution.process.jdk9 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/extexecution/process/jdk9/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.26 -OpenIDE-Module-Java-Dependencies: Java > 9 -OpenIDE-Module-Provides: org.netbeans.spi.extexecution.base.ProcessesImplementation diff --git a/ide/extexecution.process.jdk9/nbproject/project.properties b/ide/extexecution.process.jdk9/nbproject/project.properties deleted file mode 100644 index 0f73a1153601..000000000000 --- a/ide/extexecution.process.jdk9/nbproject/project.properties +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -is.autoload=true -javac.source=1.8 -javac.compilerargs=-Xlint -Xlint:-serial diff --git a/ide/extexecution.process.jdk9/nbproject/project.xml b/ide/extexecution.process.jdk9/nbproject/project.xml deleted file mode 100644 index f6fe666d5a4d..000000000000 --- a/ide/extexecution.process.jdk9/nbproject/project.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - org.netbeans.modules.apisupport.project - - - org.netbeans.modules.extexecution.process.jdk9 - - - org.netbeans.modules.extexecution.base - - - - 2 - 1.0 - - - - org.openide.util - - - - 9.3 - - - - org.openide.util.lookup - - - - 8.0 - - - - - - - diff --git a/ide/extexecution.process.jdk9/src/org/netbeans/modules/extexecution/process/jdk9/ProcessesImpl.java b/ide/extexecution.process.jdk9/src/org/netbeans/modules/extexecution/process/jdk9/ProcessesImpl.java deleted file mode 100644 index 11774a340e5e..000000000000 --- a/ide/extexecution.process.jdk9/src/org/netbeans/modules/extexecution/process/jdk9/ProcessesImpl.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.extexecution.process.jdk9; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Stream; -import org.netbeans.spi.extexecution.base.ProcessesImplementation; -import org.openide.util.lookup.ServiceProvider; - -/** - * - * @author phejl - */ -@ServiceProvider(service=ProcessesImplementation.class, position = 1000) -public class ProcessesImpl implements ProcessesImplementation { - - private static final Logger LOGGER = Logger.getLogger(ProcessesImpl.class.getName()); - - private static final boolean ENABLED; - - private static final Method PROCESS_TO_HANDLE; - - private static final Method PROCESS_HANDLE_DESCENDANTS; - - private static final Method PROCESS_HANDLE_DESTROY; - - static { - Method toHandle = null; - Method descendants = null; - Method destroy = null; - try { - toHandle = Process.class.getDeclaredMethod("toHandle", new Class[]{}); // NOI18N - if (toHandle != null) { - Class processHandle = Class.forName("java.lang.ProcessHandle"); // NOI18N - descendants = processHandle.getDeclaredMethod("descendants", new Class[]{}); // NOI18N - destroy = processHandle.getDeclaredMethod("destroy", new Class[]{}); // NOI18N - } - } catch (NoClassDefFoundError | Exception ex) { - LOGGER.log(Level.WARNING, null, ex); - } - - ENABLED = toHandle != null && descendants != null && destroy != null; - PROCESS_TO_HANDLE = toHandle; - PROCESS_HANDLE_DESCENDANTS = descendants; - PROCESS_HANDLE_DESTROY = destroy; - } - - @Override - public void killTree(Process process, Map environment) { - if (!ENABLED) { - throw new UnsupportedOperationException("The JDK 9 way of killing process tree is not supported"); // NOI18N - } - - try { - Object handle = PROCESS_TO_HANDLE.invoke(process, (Object[]) null); - try (Stream s = (Stream) PROCESS_HANDLE_DESCENDANTS.invoke(handle, (Object[]) null)) { - destroy(handle); - s.forEach(ch -> destroy(ch)); - } - } catch (IllegalAccessException | IllegalArgumentException |InvocationTargetException ex) { - throw new UnsupportedOperationException("The JDK 9 way of killing process tree has failed", ex); // NOI18N - } - } - - private static void destroy(Object handle) { - try { - PROCESS_HANDLE_DESTROY.invoke(handle, (Object[]) null); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { - LOGGER.log(Level.INFO, null, ex); - } - } - -} diff --git a/ide/extexecution.process.jdk9/src/org/netbeans/modules/extexecution/process/jdk9/resources/Bundle.properties b/ide/extexecution.process.jdk9/src/org/netbeans/modules/extexecution/process/jdk9/resources/Bundle.properties deleted file mode 100644 index 9cc28f88a164..000000000000 --- a/ide/extexecution.process.jdk9/src/org/netbeans/modules/extexecution/process/jdk9/resources/Bundle.properties +++ /dev/null @@ -1,17 +0,0 @@ -# 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. -OpenIDE-Module-Name=External Execution Process JDK 9 diff --git a/ide/extexecution.process/external/binaries-list b/ide/extexecution.process/external/binaries-list deleted file mode 100644 index cd654a1a600c..000000000000 --- a/ide/extexecution.process/external/binaries-list +++ /dev/null @@ -1,19 +0,0 @@ -# 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. -# -8DCFCC7214E73A906786B80704784D90FB593E75 org.jvnet.winp:winp:1.28 -93A5E6FC4B7E18B78B68EEC0212CBD0B253F15AE eu.doppel-helix.netbeans.lib:processtreekiller:2.0.1 diff --git a/ide/extexecution.process/external/processtreekiller-2.0.1-license.txt b/ide/extexecution.process/external/processtreekiller-2.0.1-license.txt deleted file mode 100644 index 9a2e7adfcc95..000000000000 --- a/ide/extexecution.process/external/processtreekiller-2.0.1-license.txt +++ /dev/null @@ -1,28 +0,0 @@ -Name: NetBeans processtreekiller -Version: 2.0.1 -License: MIT-processtreekiller -Origin: https://github.com/matthiasblaesing/netbeans-processtreekiller -Source: https://github.com/matthiasblaesing/netbeans-processtreekiller -Description: Library allowing to kill external process trees. - -The MIT License - -Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/ide/extexecution.process/external/winp-1.28-license.txt b/ide/extexecution.process/external/winp-1.28-license.txt deleted file mode 100644 index 7d4e80196044..000000000000 --- a/ide/extexecution.process/external/winp-1.28-license.txt +++ /dev/null @@ -1,28 +0,0 @@ -Name: winp -Version: 1.28 -License: MIT-winp -Origin: https://github.com/kohsuke/winp -Source: https://github.com/kohsuke/winp -Description: Library allowing to control windows processes. - -MIT License - -Copyright (c) 2008-, Kohsuke Kawaguchi, Sun Microsystems, Inc., and a number of other of contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/ide/extexecution.process/manifest.mf b/ide/extexecution.process/manifest.mf index b07be329ef36..1a031e71e982 100644 --- a/ide/extexecution.process/manifest.mf +++ b/ide/extexecution.process/manifest.mf @@ -2,5 +2,5 @@ Manifest-Version: 1.0 AutoUpdate-Show-In-Client: false OpenIDE-Module: org.netbeans.modules.extexecution.process OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/extexecution/process/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.53 +OpenIDE-Module-Specification-Version: 1.54 OpenIDE-Module-Provides: org.netbeans.spi.extexecution.base.ProcessesImplementation diff --git a/ide/extexecution.process.jdk9/build.xml b/ide/extexecution.process/module-auto-deps.xml similarity index 51% rename from ide/extexecution.process.jdk9/build.xml rename to ide/extexecution.process/module-auto-deps.xml index cd4184f34901..cd0562681aa3 100644 --- a/ide/extexecution.process.jdk9/build.xml +++ b/ide/extexecution.process/module-auto-deps.xml @@ -19,7 +19,21 @@ under the License. --> - - Builds, tests, and runs the project org.netbeans.modules.extexecution.process.jdk9 - - + + + + + + Merged o.n.m.extexecution.process.jdk9 into o.n.m.extexecution.process + + + + + + + + + + + + diff --git a/ide/extexecution.process/nbproject/project.properties b/ide/extexecution.process/nbproject/project.properties index b5fd1b488211..c8282a2b27ae 100644 --- a/ide/extexecution.process/nbproject/project.properties +++ b/ide/extexecution.process/nbproject/project.properties @@ -15,7 +15,5 @@ # specific language governing permissions and limitations # under the License. is.autoload=true -javac.source=1.8 -javac.compilerargs=-Xlint -Xlint:-serial -release.external/winp-1.28.jar=modules/ext/winp-1.28.jar -release.external/processtreekiller-2.0.1.jar=modules/ext/processtreekiller-2.0.1.jar \ No newline at end of file +javac.release=11 +javac.compilerargs=-Xlint -Xlint:-serial \ No newline at end of file diff --git a/ide/extexecution.process/nbproject/project.xml b/ide/extexecution.process/nbproject/project.xml index 5038f36b37f7..7a36e86ff7a3 100644 --- a/ide/extexecution.process/nbproject/project.xml +++ b/ide/extexecution.process/nbproject/project.xml @@ -25,15 +25,6 @@ org.netbeans.modules.extexecution.process - - org.netbeans.libs.jna - - - - 2 - 2.1 - - org.netbeans.modules.extexecution.base @@ -61,14 +52,6 @@ - - ext/winp-1.28.jar - external/winp-1.28.jar - - - ext/processtreekiller-2.0.1.jar - external/processtreekiller-2.0.1.jar - diff --git a/ide/extexecution.process/src/org/netbeans/modules/extexecution/process/ProcessesImpl.java b/ide/extexecution.process/src/org/netbeans/modules/extexecution/process/ProcessesImpl.java index 132a3ff6e35f..d19f195f77dc 100644 --- a/ide/extexecution.process/src/org/netbeans/modules/extexecution/process/ProcessesImpl.java +++ b/ide/extexecution.process/src/org/netbeans/modules/extexecution/process/ProcessesImpl.java @@ -20,7 +20,9 @@ package org.netbeans.modules.extexecution.process; import java.util.Map; -import org.netbeans.processtreekiller.ProcessTreeKiller; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Stream; import org.netbeans.spi.extexecution.base.ProcessesImplementation; import org.openide.util.lookup.ServiceProvider; @@ -28,16 +30,25 @@ * * @author mkleint */ -@ServiceProvider(service=ProcessesImplementation.class) +@ServiceProvider(service=ProcessesImplementation.class, position = 1000) public class ProcessesImpl implements ProcessesImplementation { + private static final Logger LOGGER = Logger.getLogger(ProcessesImpl.class.getName()); + @Override public void killTree(Process process, Map environment) { - try { - ProcessTreeKiller.get().kill(process, environment); - } catch (LinkageError e) { - throw new UnsupportedOperationException(null, e); + ProcessHandle handle = process.toHandle(); + try (Stream tree = handle.descendants()) { + destroy("proc", handle); + tree.forEach(ch -> destroy("child", ch)); + } + } + + private static void destroy(String kind, ProcessHandle handle) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "destroying {0}: {1}; info: {2}", new Object[]{kind, handle, handle.info()}); } + handle.destroy(); } } diff --git a/java/java.lsp.server/nbproject/project.xml b/java/java.lsp.server/nbproject/project.xml index cea7ea966aae..b84a5f3b4c7d 100644 --- a/java/java.lsp.server/nbproject/project.xml +++ b/java/java.lsp.server/nbproject/project.xml @@ -756,10 +756,6 @@ org.netbeans.modules.extexecution.process - - org.netbeans.modules.extexecution.process.jdk9 - - org.netbeans.modules.java.hints.declarative diff --git a/nbbuild/cluster.properties b/nbbuild/cluster.properties index 9d607cb83e30..78d6f751969b 100644 --- a/nbbuild/cluster.properties +++ b/nbbuild/cluster.properties @@ -346,7 +346,6 @@ nb.cluster.ide=\ extexecution.base,\ extexecution.impl,\ extexecution.process,\ - extexecution.process.jdk9,\ git,\ go.lang,\ gototest,\