RFR: 8159855: Create an SPI for tools

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Oct 7 21:40:11 UTC 2016


Updated webrev with feedback from comments:

* use doPrivileged within ToolProvider.findFIrst  (includes adding new test)
* improve whitespace in doc comments

Webrev: http://cr.openjdk.java.net/~jjg/8159855/webrev.05/

-- Jon



On 10/04/2016 09:19 PM, Mandy Chung wrote:
> This SPI is useful and provides as a replacement to existing use of internal APIs to launch some of our tools.  We will get jar, jmod, jlink and possibly other tools to convert to this SPI.
>
> ToolProvider::findFirst(String name) can find tool providers on classpath.  I think it needs to wrap the for-loop (specifically iterating on providers) with doPrivileged due to the stack-based permission check.
>
> Otherwise, looks good.
>
> Mandy
>
>> On Oct 4, 2016, at 4:46 PM, Jonathan Gibbons <jonathan.gibbons at oracle.com> wrote:
>>
>> Resend with non-mostly-empty subject line!
>>
>> -- Jon
>>
>> On 10/04/2016 04:39 PM, Jonathan Gibbons wrote:
>>> Core-libs folk,
>>>
>>> Please review the following change to add a new service provider class
>>>     java.util.spi.ToolProvider
>>>
>>> which can be used provide simple "command-line" access to select JDK
>>> tools, without starting a new JVM.
>>>
>>> The following tools are updated to provide access through the new SPI:
>>>     javac, javadoc, javap, jdeps
>>>
>>> It is expected that additional tools will also be updated to provide access,
>>> but that will be done separately.
>>>
>>> Compiler-dev folk may wish to review the changes to the langtools repository.
>>>
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8159855
>>> Webrev: http://cr.openjdk.java.net/~jjg/8159855/webrev.03/
>>> API: http://cr.openjdk.java.net/~jjg/8159855/api.02/java/util/spi/ToolProvider.html
>>>
>>> -- Jon



More information about the compiler-dev mailing list