JDK-8031715 : Indexed access to java package not working
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-01-14
  • Updated: 2014-07-29
  • Resolved: 2014-01-15
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.
8u20Fixed 9 b02Fixed
The following should work to access java package "java.net":

jjs> java['net']

But it works only after the package has been created, e.g. after calling 

jjs> java.net

One possible solution is to make ScriptObject#invokeNoSuchProperty(String) non-private and override it in NativeJavaImporter and possibly NativeJavaPackage.

This bug was reported @ nashorn-dev alias http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-January/002674.html