8161928: Dynalink documentation updates

Reviewed-by: hannesw, sundar
This commit is contained in:
Attila Szegedi 2016-07-25 10:58:58 +02:00
parent 2eadf97c78
commit 66aefdf36e
4 changed files with 21 additions and 15 deletions

View File

@ -108,15 +108,19 @@ public interface GuardingTypeConverterFactory {
* language's objects to Java interfaces and classes by generating adapters
* for them.
* <p>
* The type of the invocation is {@code targetType(sourceType)}, while the
* type of the guard is {@code boolean(sourceType)}. You are allowed to
* The type of the invocation is <tt>(sourceType)&rarr;targetType</tt>, while the
* type of the guard is <tt>(sourceType)&rarr;boolean</tt>. You are allowed to
* return unconditional invocations (with no guard) if the source type is
* specific to your runtime and your runtime only.
* <p>Note that this method will never be invoked for type conversions
* allowed by the JLS 5.3 "Method Invocation Conversion", see
* {@link TypeUtilities#isMethodInvocationConvertible(Class, Class)} for
* details. An implementation can assume it is never requested to produce a
* converter for these conversions.
* <p>Note that this method will never be invoked for
* {@link TypeUtilities#isMethodInvocationConvertible(Class, Class) method
* invocation conversions} as those can be automatically applied by
* {@link java.lang.invoke.MethodHandle#asType(MethodType)}.
* An implementation can assume it is never requested to produce a
* converter for those conversions. If a language runtime needs to customize
* method invocation conversions, it should
* {@link jdk.dynalink.DynamicLinkerFactory#setAutoConversionStrategy(MethodTypeConversionStrategy)
* set an autoconversion strategy in the dynamic linker factory} instead.
* <p>Dynalink is at liberty to either cache some of the returned converters
* or to repeatedly request the converter factory to create the same
* conversion.
@ -127,6 +131,9 @@ public interface GuardingTypeConverterFactory {
* on whose behalf a type converter is requested. When a converter is
* requested as part of linking an {@code invokedynamic} instruction the
* supplier will return the lookup passed to the bootstrap method, otherwise
* if the method is invoked from within a
* {@link LinkerServices#getWithLookup(Supplier, jdk.dynalink.SecureLookupSupplier)}
* it will delegate to the secure lookup supplier. In any other case,
* it will return the public lookup. A typical case where the lookup might
* be needed is when the converter creates a Java adapter class on the fly
* (e.g. to convert some object from the dynamic language into a Java

View File

@ -96,10 +96,8 @@
* language-specific manner if no other linker managed to handle the operation.)
* </p><p>
* A language runtime that wishes to make at least some of its linkers available
* to other language runtimes for interoperability will need to declare the
* class names of those linkers in
* {@code /META-INF/services/jdk.dynalink.linker.GuardingDynamicLinker} file in
* its distribution (typically, JAR file).
* to other language runtimes for interoperability will need to use a
* {@link jdk.dynalink.linker.GuardingDynamicLinkerExporter}.
* </p><p>
* Most language runtimes will be able to implement their own linking logic by
* implementing {@link jdk.dynalink.linker.TypeBasedGuardingDynamicLinker}

View File

@ -138,7 +138,7 @@ public final class TypeUtilities {
* Determines whether one type can be converted to another type using a method invocation conversion, as per JLS 5.3
* "Method Invocation Conversion". This is basically all conversions allowed by subtyping (see
* {@link #isSubtype(Class, Class)}) as well as boxing conversion (JLS 5.1.7) optionally followed by widening
* reference conversion and unboxing conversion (JLS 5.1.8) optionally followed by widening primitive conversion.
* reference conversion, and unboxing conversion (JLS 5.1.8) optionally followed by widening primitive conversion.
*
* @param sourceType the type being converted from (call site type for parameter types, method type for return types)
* @param targetType the parameter type being converted to (method type for parameter types, call site type for return types)

View File

@ -90,9 +90,10 @@ import jdk.dynalink.linker.GuardedInvocation;
/**
* A relinkable call site that implements monomorphic inline caching strategy,
* only being linked to a single {@link GuardedInvocation}. If that invocation
* is invalidated, it will throw it away and ask its associated
* {@link DynamicLinker} to relink it.
* only being linked to a single {@link GuardedInvocation} at any given time.
* If the guard of that single invocation fails, or it has an invalidated
* switch point, or its invalidating exception triggered, then the call site
* will throw it away and ask its associated {@link DynamicLinker} to relink it.
*/
public class SimpleRelinkableCallSite extends AbstractRelinkableCallSite {
/**