RFR 8085937: add autoimports sample script to easily explore Java classes in interactive mode

Michael Haupt michael.haupt at oracle.com
Mon Jun 8 07:07:05 UTC 2015

Hi Sundar,

note there's no capital R in my review.

> Am 08.06.2015 um 05:03 schrieb A. Sundararajan <sundararajan.athijegannathan at oracle.com>:
> Please review http://cr.openjdk.java.net/~sundar/8085937/ for https://bugs.openjdk.java.net/browse/JDK-8085937

autoimports.js: There are some nits in the comment at the beginning of the file; here's an edit of the entire comment:

It is tedious to import Java classes used in a script. Sometimes it is easier use simple names of java classes and have a script auto import Java classes. You can load this script at the start of an interactive jjs session or at the start of your script. This script defines a __noSuchProperty__ hook to auto import Java classes as
needed and when they are referred to for the first time in your script. You can also call the "autoimports" function to print script statements that you need to use in your script, i.e., have the function generate a script to import Java classes used by your script so far. After running your script, you can call autoimports to get the exact Java imports you need and replace the autoimports load with the generated import statements (to avoid costly init of the autoimports script).

autoimports.js, lines 136, 140: use === rather than ==?

Other than that, no remarks!




Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Java Platform Group | HotSpot Compiler Team 
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany
 <http://www.oracle.com/commitment>	Oracle is committed to developing practices and products that help protect the environment

More information about the nashorn-dev mailing list