JDK-8154714 : jshell tool: add exports support
  • Type: Bug
  • Component: tools
  • Sub-Component: jshell
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-04-20
  • Updated: 2017-05-17
  • Resolved: 2016-09-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b139Fixed
Related Reports
Blocks :  
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
> On Apr 13, 2016, at 10:43 PM, Ben Evans  wrote:
>
> Hi Max,
>
> This is being stopped by the Java 9 module system, as sun.* is an
> internal package.

That's why I added -J-XaddExports:java.base/sun.security.provider=ALL-UNNAMED but it doesn't work.

>
> Is there a flag that can be used to override this in jshell? Do we
> think such a feature would even be desirable?

Personally I find it useful if I am either authoring those internal classes or using them when implementing a public API.

Thanks
Max

>
> Thanks,
>
> Ben
>
>
> On Wed, Apr 13, 2016 at 10:22 AM, Wang Weijun  wrote:
>>
>> $ jshell -J-XaddExports:java.base/sun.security.provider=ALL-UNNAMED
>> |  Welcome to JShell -- Version 9-internal
>> |  Type /help for help
>>
>> -> import sun.security.provider.SecureRandom
>> |  Error:
>> |  package sun.security.provider does not exist
>> |  import sun.security.provider.SecureRandom;
>> |         ^--------------------------------^
>>
>> Thanks
>> Max
>>


Comments
The first attempt at implementing this functionality was JShell API and jshell tool commands allowing dynamic addition of exports. However there are significant issues with this approach. The current approach being pursued is command-line flags using existing JShell.Builder API.
26-09-2016

Jon, created JDK-8166649
23-09-2016

There should be "add modules" support as well as "add exports" and "module path", to allow people to explore their own modular code.
21-09-2016