nashorn/samples/dynalink/README
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 34549 412a690d4414
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34549
412a690d4414 8144979: Context.fromClass should catch exception from Class.getClassLoader call
sundar
parents: 34548
diff changeset
     1
This directory contains samples for Dynalink API (http://openjdk.java.net/jeps/276).
412a690d4414 8144979: Context.fromClass should catch exception from Class.getClassLoader call
sundar
parents: 34548
diff changeset
     2
These samples require a jar file to be built and such jars be placed in the
34548
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     3
classpath of the jjs tool. Linker samples are named with the naming pattern
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     4
"xyz_linker.js". These scripts build dynalink linker jar from java code and exec
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     5
another jjs process with appropriate classpath set.
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     6
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     7
Note: you need to build jdk9 forest and put "images/jdk/bin" in your PATH to use
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     8
these scripts. This is because these scripts use javac to build dynalink jar and
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
     9
exec another jjs with classpath set! Alternatively, you can also manually build
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    10
dynalink linker jars and invoke sample scripts by putting linker jar in jjs tool's
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    11
classpath as well.
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    12
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    13
Dynalink samples:
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    14
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    15
* array_stream_linker.js
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    16
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    17
This sample builds ArrayStreamLinkerExporter.java and uses it in a sample script
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    18
called "array_stream.js". This linker adds "stream" property to Java array
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    19
objects. The "stream" property returns appropriate Stream type for the given
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    20
Java array (IntStream, DoubleStream ...).
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    21
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    22
* buffer_indexing_linker.js
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    23
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    24
This sample builds BufferIndexingLinkerExporter.java and uses it in a sample script
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    25
called "buffer_index.js". This linker adds array-like indexed access, indexed assignment
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    26
and "length" property to Java NIO Buffer objects. Script can treat NIO Buffer objects
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    27
as if those are just array objects.
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    28
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    29
* dom_linker.js
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    30
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    31
This sample builds DOMLinkerExporter.java and uses it in a sample script
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    32
called "dom_linker_gutenberg.js". This linker handles DOM Element objects to add
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    33
properties to access child elements of a given element by child element tag name.
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    34
This simplifies script access of parsed XML DOM Documents.
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    35
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    36
* missing_method_linker.js
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    37
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    38
This sample builds MissingMethodLinkerExporter.java and uses it in a sample script
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    39
called "missing_method.js". This linker supports Smalltalk-style "doesNotUnderstand"
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    40
calls on Java objects. i.e., A Java class can implement MissingMethodHandler interface
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    41
with one method named "doesNotUnderstand". When script accesses a method on such
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    42
object and if that method does not exist in the Java class (or any of it's supertypes),
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    43
then "doesNotUnderstand" method is invoked.
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    44
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    45
* underscore_linker.js
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    46
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    47
This sample builds UnderscoreNameLinkerExporter.java and uses it in a sample script
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    48
called "underscore.js". This linker converts underscore separated names to Camel Case
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    49
names (as used in Java APIs). You can call Java APIs using Ruby-like naming convention
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    50
and this linker converts method names to CamelCase!
44779bfb4c13 8144841: Add a sample for pluggable dynalink linker for stream property on arrays and a REAMDE for linker samples
sundar
parents:
diff changeset
    51