RFR: 8230857: Avoid reflection in sun.tools.common.ProcessHelper
David Holmes
david.holmes at oracle.com
Wed Sep 11 22:29:13 UTC 2019
Hi Christoph,
On 12/09/2019 8:05 am, Langer, Christoph wrote:
> Hi,
>
> please review an enhancement which I’ve identified when working with
> Processhelper for JDK-8230850.
>
> I noticed that ProcessHelper is an interface in common code with a
> static method that would lookup the actual platform implementation via
> reflection. This seems a little cumbersome since we can have a common
> dummy for ProcessHelper and override it with the platform specific
> implementation, leveraging the build system.
I don't see you leveraging the build system. You have two source files
that compile to the same destination class file. What is ensuring the
platform specific version is compiled after the generic one?
Service-provider patterns use reflection to instantiate the service
implementation. I don't see any problem here that needs solving.
David
-----
The only drawback is that
> the test “TestProcessHelper” gets a little more sophisticated when using
> only package private methods in ProcessHelper, because the methods need
> to be made accessible for the test. But I guess that’s ok, given the
> actual tool improvement.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8230857
>
> Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8230857.0/
>
> Thanks
>
> Christoph
>
More information about the serviceability-dev
mailing list