Status: Open (View Workflow)
The ProcessUtils in lib-process-utils allows getting PID from a process using reflection. As part of the general Java 9/10/11 hackathon all setAccessible reflection use was being reviewed.
This issue is to remove the reflection use, and as a nice side effect the code will work on Windows too. However, this requires upgrading to Java 9+, so I don't really expect it to happen anytime soon. For now I wanted to preserve the little bit of work I did.
It works in Java9+ so far, just gives the standard warning:
WARNING: Illegal reflective access by org.jenkinsci.utils.process.ProcessUtils (file:/scratch/jenkins/git/lib-process-utils/target/classes/) to field java.lang.ProcessImpl.pid
Maven Compile r3.8.0 supports Multi-release JARs, so maybe we need another PR
As far as I can tell, the process-utils package that is provided by the lib-process-utils GitHub repository is only used in the acceptance test harness and in the docker-fixtures library. Once we've switched to require Java 11, the library can use the Java 11 ProcessHandle class to return the process ID of the current process.
There is no reference to the process-utils package in Jenkins core or in any of the 1500+ plugins that I searched.
It seems the current code is not going to work on Java 9+, right?