# ⬢ polyglot-tck 25.6.0-elide.4
Every page: [llms.txt](llms.txt), or all in one file: [llms-full.txt](llms-full.txt)
API reference for polyglot-tck.
## Packages
- [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md): Provide an implementation of the org.graalvm.polyglot.tck.LanguageProvider to test language inter-operability.
## Types in `org.graalvm.polyglot.tck`
- [`InlineSnippet`](org/graalvm/polyglot/tck/InlineSnippet.md) (class): The unit of execution with an inline source.
- [`InlineSnippet.Builder`](org/graalvm/polyglot/tck/InlineSnippet.Builder.md) (class): The builder of an InlineSnippet.
- [`LanguageProvider`](org/graalvm/polyglot/tck/LanguageProvider.md) (interface): The LanguageProvider provides factory methods for language data types, expressions, statements and scripts used for testing language inter-operability.
- [`ResultVerifier`](org/graalvm/polyglot/tck/ResultVerifier.md) (interface): Allows a custom verification of a result of a snippet execution.
- [`ResultVerifier.SnippetRun`](org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.md) (class): Provides the test execution data.
- [`Snippet`](org/graalvm/polyglot/tck/Snippet.md) (class): The unit of execution with assigned parameters and result types.
- [`Snippet.Builder`](org/graalvm/polyglot/tck/Snippet.Builder.md) (class): The builder of a Snippet.
- [`TypeDescriptor`](org/graalvm/polyglot/tck/TypeDescriptor.md) (class): Represents a type of a polyglot value.
# ▣ org.graalvm.polyglot.tck
[polyglot-tck](index.md) · Every page: [llms.txt](llms.txt)
Package in polyglot-tck. Since 0.30.
Provide an implementation of the [`org.graalvm.polyglot.tck.LanguageProvider`](org/graalvm/polyglot/tck/LanguageProvider.md) to test language inter-operability. See [Test Compatibility Kit](https://github.com/oracle/graal/blob/master/truffle/docs/TCK.md) for details how to add a new language provider and execute tests.
## Interfaces
- [`LanguageProvider`](org/graalvm/polyglot/tck/LanguageProvider.md): The LanguageProvider provides factory methods for language data types, expressions, statements and scripts used for testing language inter-operability.
- [`ResultVerifier`](org/graalvm/polyglot/tck/ResultVerifier.md): Allows a custom verification of a result of a snippet execution.
## Classes
- [`InlineSnippet`](org/graalvm/polyglot/tck/InlineSnippet.md): The unit of execution with an inline source.
- [`Snippet`](org/graalvm/polyglot/tck/Snippet.md): The unit of execution with assigned parameters and result types.
- [`TypeDescriptor`](org/graalvm/polyglot/tck/TypeDescriptor.md): Represents a type of a polyglot value.
# ◆ InlineSnippet
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Class in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.32.
```java
public final class InlineSnippet
```
Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `InlineSnippet`
The unit of execution with an inline source. The [`InlineSnippet`](org/graalvm/polyglot/tck/InlineSnippet.md) represents an execution of a script and an associated inline source code that is to be executed at script's locations.
It's recommended to provide two snippets at least, one with local variables and restricted [`location predicate`](org/graalvm/polyglot/tck/InlineSnippet.Builder.md#locationPredicate%28java.util.function.Predicate%29) and one with globally accessible [`code`](org/graalvm/polyglot/tck/InlineSnippet.md#getCode%28%29) and no location predicate.
## Nested types
- [`InlineSnippet.Builder`](org/graalvm/polyglot/tck/InlineSnippet.Builder.md) (class): The builder of an InlineSnippet.
## Methods
### getScript()
`public Snippet getScript()`. Since 0.32. Returns a script to be executed. The `source code` is executed inlined in this script. Cite: `org/graalvm/polyglot/tck/InlineSnippet.html#getScript()`
### getCode()
`public CharSequence getCode()`. Since 0.32. Returns an inline source code that is to be executed at specific `locations`, or at all statement and call locations if the predicate is `null`. Cite: `org/graalvm/polyglot/tck/InlineSnippet.html#getCode()`
### getLocationPredicate()
`public Predicate getLocationPredicate()`. Since 0.32. Returns a testing predicate for locations at which `source code` is executed. Returns `Predicate`: the predicate that returns `true` for [`SourceSection`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/SourceSection.html)s where the `source code` is to be executed, or `null` if the source code should be executed at all instrumentable statement and call locations. Cite: `org/graalvm/polyglot/tck/InlineSnippet.html#getLocationPredicate()`
### getResultVerifier()
`public ResultVerifier getResultVerifier()`. Since 0.32. Returns the `ResultVerifier` to verify the result of `source code` execution. Returns `ResultVerifier`: either a custom or the default `ResultVerifier`. Cite: `org/graalvm/polyglot/tck/InlineSnippet.html#getResultVerifier()`
### toString()
`public String toString()`. Since 0.32. Overrides `toString()`. Cite: `org/graalvm/polyglot/tck/InlineSnippet.html#toString()`
### newBuilder(Snippet, CharSequence)
`public static InlineSnippet.Builder newBuilder(Snippet script, CharSequence code)`. Since 0.32. Creates a new `InlineSnippet` builder object. Parameters: `script` `Snippet`: the script to execute (use `Snippet.newBuilder(String, Value, TypeDescriptor)` to create one). `code` `CharSequence`: the inline source code that is to be executed inside the script. Returns `InlineSnippet.Builder`: the new `Builder`. Cite: `org/graalvm/polyglot/tck/InlineSnippet.html#newBuilder(org.graalvm.polyglot.tck.Snippet,java.lang.CharSequence)`
## Inherited members
- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)
# ◆ InlineSnippet.Builder
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Class in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.32. Nested in [`InlineSnippet`](org/graalvm/polyglot/tck/InlineSnippet.md).
```java
public static final class InlineSnippet.Builder
```
Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Builder`
The builder of an [`InlineSnippet`](org/graalvm/polyglot/tck/InlineSnippet.md).
## Methods
### locationPredicate(Predicate)
`public InlineSnippet.Builder locationPredicate(Predicate locationPredicate)`. Since 0.32. Sets a testing predicate for locations at which the source is executed. By default, the source is executed at all instrumentable statement and call locations in the script. Returns `InlineSnippet.Builder`: the predicate that returns `true` for [`SourceSection`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/SourceSection.html)s where source is to be executed. Cite: `org/graalvm/polyglot/tck/InlineSnippet.Builder.html#locationPredicate(java.util.function.Predicate)`
### resultVerifier(ResultVerifier)
`public InlineSnippet.Builder resultVerifier(ResultVerifier resultVerifier)`. Since 0.32. Sets a custom verifier of a result of the `inline source` execution. Parameters: `resultVerifier` `ResultVerifier`: the custom `ResultVerifier`. Returns `InlineSnippet.Builder`: this `Builder`. Cite: `org/graalvm/polyglot/tck/InlineSnippet.Builder.html#resultVerifier(org.graalvm.polyglot.tck.ResultVerifier)`
### build()
`public InlineSnippet build()`. Since 0.32. Creates a new `InlineSnippet` configured by this `Builder`. Returns `InlineSnippet`: the `InlineSnippet`. Cite: `org/graalvm/polyglot/tck/InlineSnippet.Builder.html#build()`
## Inherited members
- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)
# ◇ LanguageProvider
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Interface in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.30.
```java
public interface LanguageProvider
```
The [`LanguageProvider`](org/graalvm/polyglot/tck/LanguageProvider.md) provides factory methods for language data types, expressions, statements and scripts used for testing language inter-operability. The [`LanguageProvider`](org/graalvm/polyglot/tck/LanguageProvider.md) implementations are loaded by the [`ServiceLoader`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ServiceLoader.html) and should be registered in the 'META-INF/services/org.graalvm.polyglot.tck.LanguageProvider'. See [Test Compatibility Kit](https://github.com/oracle/graal/blob/master/truffle/docs/TCK.md) for details how to add a new language provider and execute tests.
## Methods
### getId()
`String getId()`. Since 0.30. Returns an identification of a provider. The common pattern is to use the identification of the tested language. Returns `String`: the language identification. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#getId()`
### additionalOptions()
`default Map additionalOptions()`. Since 22.3. Allows language providers to provide language options during the creation of the test context. `LanguageProviders` are only allowed to set options of the language they represent (Options starting with `getId()`). Attempts to set options other than their own language will throw [`IllegalArgumentException`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IllegalArgumentException.html) on test context creation. Returns `Map`: The `(key, value)` pairs of language option to add to the context. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#additionalOptions()`
### createIdentityFunction(Context)
`Value createIdentityFunction(Context context)`. Since 0.30. Creates an identity function. The identity function just returns its argument. The JavaScript sample implementation: The R sample implementation: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Value`: the [`Value`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html) representing the identity function. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createIdentityFunction(org.graalvm.polyglot.Context)`
```java
@Override
public Value createIdentityFunction(Context context) {
return context.eval("js", "(function (a){ return a; })");
}
```
```java
@Override
public Value createIdentityFunction(Context context) {
return context.eval("R", "function (a){ a }");
}
```
### createIdentityFunctionSnippet(Context)
`default Snippet createIdentityFunctionSnippet(Context context)`. Since 19.1.0. Creates a `Snippet` for an identity function. The identity function just returns its argument. This method allows an implementor to override the default identity function verification. In most cases it's not needed to implement this method and it's enough to implement `createIdentityFunction`. The implementor can delegate to the default identity function verifier obtained by `ResultVerifier.getIdentityFunctionDefaultResultVerifier()`. Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Snippet`: the `Snippet` representing the identity function. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createIdentityFunctionSnippet(org.graalvm.polyglot.Context)`
### createValueConstructors(Context)
`Collection extends Snippet> createValueConstructors(Context context)`. Since 0.30. Creates a collection of functions creating language data types. For each language data type create a function returning a value of given type and assign a correct `TypeDescriptor` to it. The `TypeDescriptor` can be one of the predefined `TypeDescriptor`s, an array with component type, an executable with required parameter types or an intersection type. The JavaScript sample implementation creating a boolean type: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Collection extends Snippet>`: factories creating the language data types. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createValueConstructors(org.graalvm.polyglot.Context)`
```java
```
### createExpressions(Context)
`Collection extends Snippet> createExpressions(Context context)`. Since 0.30. Creates a collection of functions representing language expressions to test. For each language operator create a function performing given operator and assign a correct `TypeDescriptor`s to its parameters and return type. The parameter types and return type can be one of the predefined `TypeDescriptor`s, an array with component type, an executable with required parameter types or an union type. The JavaScript sample implementation creating a plus operator: The R sample implementation creating a plus operator: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Collection extends Snippet>`: factories creating the language expressions. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createExpressions(org.graalvm.polyglot.Context)`
```java
@Override
public Collection extends Snippet> createExpressions(Context context) {
final Collection expressions = new ArrayList<>();
final TypeDescriptor numeric = TypeDescriptor.union(
TypeDescriptor.NUMBER,
TypeDescriptor.BOOLEAN);
final TypeDescriptor nonNumeric = TypeDescriptor.union(
TypeDescriptor.STRING,
TypeDescriptor.OBJECT,
TypeDescriptor.ARRAY,
TypeDescriptor.EXECUTABLE_ANY);
Snippet.Builder builder = Snippet.newBuilder(
"+",
context.eval("js",
"(function (a, b){ return a + b;})"),
TypeDescriptor.NUMBER).parameterTypes(numeric, numeric);
expressions.add(builder.build());
builder = Snippet.newBuilder(
"+",
context.eval("js",
"(function (a, b){ return a + b;})"),
TypeDescriptor.STRING).parameterTypes(nonNumeric, TypeDescriptor.ANY);
expressions.add(builder.build());
builder = Snippet.newBuilder(
"+",
context.eval("js",
"(function (a, b){ return a + b;})"),
TypeDescriptor.STRING).parameterTypes(TypeDescriptor.ANY, nonNumeric);
expressions.add(builder.build());
return expressions;
}
```
```java
@Override
public Collection extends Snippet> createExpressions(Context context) {
final Collection expressions = new ArrayList<>();
final TypeDescriptor numOrBool = TypeDescriptor.union(
TypeDescriptor.NUMBER,
TypeDescriptor.BOOLEAN);
final TypeDescriptor arrNumOrBool = TypeDescriptor.array(
numOrBool);
final TypeDescriptor numeric = TypeDescriptor.union(
numOrBool,
arrNumOrBool);
Snippet.Builder builder = Snippet.newBuilder(
"+",
context.eval("R",
"function (a, b){ a + b}"),
numeric).parameterTypes(numeric, numeric);
expressions.add(builder.build());
return expressions;
}
```
### createStatements(Context)
`Collection extends Snippet> createStatements(Context context)`. Since 0.30. Creates a collection of functions representing language statements to test. For each control flow statement create a function performing given statement and assign a correct `TypeDescriptor`s to its parameters and return type. The parameter types and return type can be one of the predefined `TypeDescriptor`s, an array with component type, an executable with required parameter types or an union type. The JavaScript sample implementation creating the `if` statement: The R sample implementation creating the `if` statement: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Collection extends Snippet>`: factories creating the language statements. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createStatements(org.graalvm.polyglot.Context)`
```java
@Override
public Collection extends Snippet> createStatements(Context context) {
final Collection statements = new ArrayList<>();
Snippet.Builder builder = Snippet.newBuilder(
"if",
context.eval("js",
"(function (p){\n" +
" if (p) return true ; else return false;\n" +
"})"),
TypeDescriptor.BOOLEAN).parameterTypes(
TypeDescriptor.union(
TypeDescriptor.STRING,
TypeDescriptor.OBJECT,
TypeDescriptor.NUMBER,
TypeDescriptor.BOOLEAN));
statements.add(builder.build());
return statements;
}
```
```java
@Override
public Collection extends Snippet> createStatements(Context context) {
final Collection statements = new ArrayList<>();
final TypeDescriptor numberOrBoolean = TypeDescriptor.union(
TypeDescriptor.NUMBER,
TypeDescriptor.BOOLEAN);
final TypeDescriptor arrayNumberOrBoolean = TypeDescriptor.array(
numberOrBoolean);
Snippet.Builder builder = Snippet.newBuilder(
"if",
context.eval("R",
"function(p){\n" +
" if (p) { return (TRUE) } else { return (FALSE) }\n" +
"}"),
TypeDescriptor.BOOLEAN).parameterTypes(
TypeDescriptor.union(
numberOrBoolean,
arrayNumberOrBoolean));
statements.add(builder.build());
return statements;
}
```
### createScripts(Context)
`Collection extends Snippet> createScripts(Context context)`. Since 0.30. Creates a collection of simple scripts used for instrumentation testing. Each script is represented as a function performing the script. The function must have no formal parameters but may return a result which can be asserted by `ResultVerifier`. The JavaScript sample implementation: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Collection extends Snippet>`: the language scripts. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createScripts(org.graalvm.polyglot.Context)`
```java
@Override
public Collection extends Snippet> createScripts(Context context) {
try {
final Collection scripts = new ArrayList<>();
Reader reader = new InputStreamReader(
getClass().getResourceAsStream("sample.js"),
"UTF-8");
Source source = Source.newBuilder(
"js",
reader,
"sample.js").build();
Snippet.Builder builder = Snippet.newBuilder(
source.getName(),
context.eval(source),
TypeDescriptor.NULL);
scripts.add(builder.build());
return scripts;
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
```
### createInvalidSyntaxScripts(Context)
`Collection extends Source> createInvalidSyntaxScripts(Context context)`. Since 0.30. Creates a collection of scripts containing a syntax error. The JavaScript sample implementation: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Collection extends Source>`: the scripts. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createInvalidSyntaxScripts(org.graalvm.polyglot.Context)`
```java
@Override
public Collection extends Source> createInvalidSyntaxScripts(Context ctx) {
try {
final Collection scripts = new ArrayList<>();
Reader reader = new InputStreamReader(
getClass().getResourceAsStream("invalidSyntax.js"),
"UTF-8");
scripts.add(Source.newBuilder(
"js",
reader,
"invalidSyntax.js").build());
return scripts;
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
```
### createInlineScripts(Context)
`default Collection extends InlineSnippet> createInlineScripts(Context context)`. Since 0.32. Creates a collection of inline code snippets. This method is optional, it should be implemented if `TruffleLanguage.parse(InlineParsingRequest)` is implemented. It returns an empty list by default. The JavaScript sample implementation creating inline code snippets: Parameters: `context` `Context`: the context for a guest language code literal evaluation. Returns `Collection extends InlineSnippet>`: A collection of inline code snippets. Cite: `org/graalvm/polyglot/tck/LanguageProvider.html#createInlineScripts(org.graalvm.polyglot.Context)`
```java
@Override
public Collection extends InlineSnippet> createInlineScripts(Context context) {
final Collection inlineScripts = new ArrayList<>();
Snippet.Builder scriptBuilder = Snippet.newBuilder(
"factorial",
context.eval("js",
"(function (){\n" +
" let factorial = function(n) {\n" +
" let f = 1;\n" +
" for (let i = 2; i <= n; i++) {\n" +
" f *= i;\n" +
" }\n" +
" };\n" +
" return factorial(10);\n" +
"})"),
TypeDescriptor.NUMBER);
InlineSnippet.Builder builder = InlineSnippet.newBuilder(
scriptBuilder.build(),
"n * n").locationPredicate((SourceSection section) -> {
int line = section.getStartLine();
return 3 <= line && line <= 6;
});
inlineScripts.add(builder.build());
builder = InlineSnippet.newBuilder(
scriptBuilder.build(),
"Math.sin(Math.PI)");
inlineScripts.add(builder.build());
return inlineScripts;
}
```
# ◇ ResultVerifier
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Interface in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.30.
```java
public interface ResultVerifier extends Consumer
```
Extends: [`Consumer`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/function/Consumer.html)`<`[`ResultVerifier.SnippetRun`](org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.md)`>`
Allows a custom verification of a result of a snippet execution.
## Nested types
- [`ResultVerifier.SnippetRun`](org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.md) (class): Provides the test execution data.
## Methods
### accept(ResultVerifier.SnippetRun)
`void accept(ResultVerifier.SnippetRun snippetRun) throws PolyglotException`. Since 0.30. Performs a verification of a result of a snippet execution. The custom `ResultVerifier` overrides the default snippet execution verification. The default verification tests that the result type is in bounds specified by the `Snippet`. The custom `ResultVerifier` can be used to do additional checking of a result or an execution exception throwing [`AssertionError`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/AssertionError.html) in case of failed assertion. The custom `ResultVerifier` can hide an expected execution exception. For example the division operator snippet may provide a custom `ResultVerifier` hiding the execution exception for division by zero. To propagate the execution exception the `ResultVerifier` should re-throw it. The `ResultVerifier` can be used to resolve problems in the `ErrorTypeTest` by making the `Snippet`'s parameter(s) more generic and restrict the required value in the verifier. Parameters: `snippetRun` `ResultVerifier.SnippetRun`: the snippet execution data. The `SnippetRun` provides the actual snippet parameters, the execution result, or the [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html) thrown by the execution. If the snippet execution throws an [`IllegalArgumentException`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IllegalArgumentException.html), it's converted to [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html). Throws: `PolyglotException`: may propagate the [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html) from the snippetRun. `AssertionError` (unchecked): may throw an [`AssertionError`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/AssertionError.html) as a result of a verification. Overrides `accept(T)`. Cite: `org/graalvm/polyglot/tck/ResultVerifier.html#accept(org.graalvm.polyglot.tck.ResultVerifier.SnippetRun)`
### getDefaultResultVerifier()
`static ResultVerifier getDefaultResultVerifier()`. Since 19.0. Creates a default `ResultVerifier`. The default `ResultVerifier` tests that the result type is in bounds specified by the `Snippet`. Returns `ResultVerifier`: the default `ResultVerifier`. Cite: `org/graalvm/polyglot/tck/ResultVerifier.html#getDefaultResultVerifier()`
### getIdentityFunctionDefaultResultVerifier()
`static ResultVerifier getIdentityFunctionDefaultResultVerifier()`. Since 19.1.0. Creates a default `ResultVerifier` for the `IdentityFunctionTest`. The returned `ResultVerifier` tests that the identity function does not change the parameter type. Returns `ResultVerifier`: the default `ResultVerifier` for `IdentityFunctionTest`. Cite: `org/graalvm/polyglot/tck/ResultVerifier.html#getIdentityFunctionDefaultResultVerifier()`
## Inherited members
- From interface [`Consumer`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/function/Consumer.html): [`andThen`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/function/Consumer.html#andThen%28java.util.function.Consumer%29)
# ◆ ResultVerifier.SnippetRun
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Class in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.30. Nested in [`ResultVerifier`](org/graalvm/polyglot/tck/ResultVerifier.md).
```java
public final class ResultVerifier.SnippetRun
```
Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `SnippetRun`
Provides the test execution data.
## Methods
### getParameters()
`public List extends Value> getParameters()`. Since 0.30. Returns the actual parameters of a snippet execution. Returns `List extends Value>`: the parameters. Cite: `org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.html#getParameters()`
### getResult()
`public Value getResult()`. Since 0.30. Returns the result of a snippet execution. Returns `Value`: the result of a snippet execution or null in case of execution failure. Cite: `org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.html#getResult()`
### getException()
`public PolyglotException getException()`. Since 0.30. Returns the [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html) thrown during snippet execution. If the snippet execution throws an [`IllegalArgumentException`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/IllegalArgumentException.html), this exception is first converted to a [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html), and the resulting [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html) is provided by this method. Returns `PolyglotException`: the [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html) thrown during the execution or null in case of successful execution. Cite: `org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.html#getException()`
### create(Snippet, List, Value)
`public static ResultVerifier.SnippetRun create(Snippet snippet, List extends Value> parameters, Value result)`. Since 0.30. Creates a new `SnippetRun` for successful execution. Parameters: `snippet` `Snippet`: the executed `Snippet`. `parameters` `List extends Value>`: the actual parameters of snippet execution. `result` `Value`: the result of snippet execution. Returns `ResultVerifier.SnippetRun`: the `SnippetRun`. Cite: `org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.html#create(org.graalvm.polyglot.tck.Snippet,java.util.List,org.graalvm.polyglot.Value)`
### create(Snippet, List, PolyglotException)
`public static ResultVerifier.SnippetRun create(Snippet snippet, List extends Value> parameters, PolyglotException exception)`. Since 0.30. Creates a new `SnippetRun` for failed execution. Parameters: `snippet` `Snippet`: the executed `Snippet`. `parameters` `List extends Value>`: the actual parameters of snippet execution. `exception` `PolyglotException`: the [`PolyglotException`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/PolyglotException.html) thrown during snippet execution. Returns `ResultVerifier.SnippetRun`: the `SnippetRun`. Cite: `org/graalvm/polyglot/tck/ResultVerifier.SnippetRun.html#create(org.graalvm.polyglot.tck.Snippet,java.util.List,org.graalvm.polyglot.PolyglotException)`
## Inherited members
- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)
# ◆ Snippet
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Class in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.30.
```java
public final class Snippet
```
Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Snippet`
The unit of execution with assigned parameters and result types. The [`Snippet`](org/graalvm/polyglot/tck/Snippet.md) represents an execution of value constructor, statement, expression and script. The [`Snippet`](org/graalvm/polyglot/tck/Snippet.md) provides parameter(s) and return types used to compose the [`Snippet`](org/graalvm/polyglot/tck/Snippet.md)s.
## Nested types
- [`Snippet.Builder`](org/graalvm/polyglot/tck/Snippet.Builder.md) (class): The builder of a Snippet.
## Methods
### getId()
`public String getId()`. Since 0.30. Returns the identifier of a snippet. The `Snippet`s from a single `LanguageProvider` with the same identifier but different types are treated as overloads. Returns `String`: the `Snippet` identifier. Cite: `org/graalvm/polyglot/tck/Snippet.html#getId()`
### getExecutableValue()
`public Value getExecutableValue()`. Since 0.30. Returns the function executing the `Snippet`. Returns `Value`: the executable [`Value`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html). Cite: `org/graalvm/polyglot/tck/Snippet.html#getExecutableValue()`
### getReturnType()
`public TypeDescriptor getReturnType()`. Since 0.30. Returns the `Snippet` return type. Returns `TypeDescriptor`: the return type. Cite: `org/graalvm/polyglot/tck/Snippet.html#getReturnType()`
### getParameterTypes()
`public List extends TypeDescriptor> getParameterTypes()`. Since 0.30. Returns the types of `Snippet` formal parameters. Returns `List extends TypeDescriptor>`: the parameter types. Cite: `org/graalvm/polyglot/tck/Snippet.html#getParameterTypes()`
### getResultVerifier()
`public ResultVerifier getResultVerifier()`. Since 0.30. Returns the `ResultVerifier` to verify the execution result. Returns `ResultVerifier`: either a custom or the default `ResultVerifier`. Cite: `org/graalvm/polyglot/tck/Snippet.html#getResultVerifier()`
### toString()
`public String toString()`. Since 0.30. Overrides `toString()`. Cite: `org/graalvm/polyglot/tck/Snippet.html#toString()`
### newBuilder(String, Value, TypeDescriptor)
`public static Snippet.Builder newBuilder(String id, Value executableValue, TypeDescriptor executableReturnType)`. Since 0.30. Creates a new `Snippet` builder object. Parameters: `id` `String`: the `Snippet` identifier The `Snippet`s from a single `LanguageProvider` with the same identifier but different types are treated as overloads. `executableValue` `Value`: the executable [`Value`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html) used to execute the `Snippet`. `executableReturnType` `TypeDescriptor`: the `Snippet` return type. Returns `Snippet.Builder`: the new `Builder`. Cite: `org/graalvm/polyglot/tck/Snippet.html#newBuilder(java.lang.String,org.graalvm.polyglot.Value,org.graalvm.polyglot.tck.TypeDescriptor)`
## Inherited members
- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)
# ◆ Snippet.Builder
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Class in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.30. Nested in [`Snippet`](org/graalvm/polyglot/tck/Snippet.md).
```java
public static final class Snippet.Builder
```
Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `Builder`
The builder of a [`Snippet`](org/graalvm/polyglot/tck/Snippet.md).
## Methods
### parameterTypes(TypeDescriptor...)
`public Snippet.Builder parameterTypes(TypeDescriptor... parameterTypes)`. Since 0.30. Sets the `Snippet` formal parameter types. Parameters: `parameterTypes` `TypeDescriptor...`: the types of `Snippet`'s parameters. Returns `Snippet.Builder`: this `Builder`. Cite: `org/graalvm/polyglot/tck/Snippet.Builder.html#parameterTypes(org.graalvm.polyglot.tck.TypeDescriptor...)`
### resultVerifier(ResultVerifier)
`public Snippet.Builder resultVerifier(ResultVerifier resultVerifier)`. Since 0.30. Sets a custom verifier of a result of the `Snippet` execution. Parameters: `resultVerifier` `ResultVerifier`: the custom `ResultVerifier`. Returns `Snippet.Builder`: this `Builder`. Cite: `org/graalvm/polyglot/tck/Snippet.Builder.html#resultVerifier(org.graalvm.polyglot.tck.ResultVerifier)`
### build()
`public Snippet build()`. Since 0.30. Creates a new `Snippet` configured by this `Builder`. Returns `Snippet`: the `Snippet`. Cite: `org/graalvm/polyglot/tck/Snippet.Builder.html#build()`
## Inherited members
- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`equals`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals%28java.lang.Object%29), [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`hashCode`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`toString`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)
# ◆ TypeDescriptor
[polyglot-tck](index.md) › [org.graalvm.polyglot.tck](org/graalvm/polyglot/tck/index.md) · Every page: [llms.txt](llms.txt)
Class in [`org.graalvm.polyglot.tck`](org/graalvm/polyglot/tck/index.md). Since 0.30.
```java
public final class TypeDescriptor
```
Inheritance: [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html) > `TypeDescriptor`
Represents a type of a polyglot value. Types include primitive types, null type, object type, array type with an optional content type and union type.
## Fields
### NULL
`public static final TypeDescriptor NULL`. Since 0.30. The NULL type represents a type of null or undefined value. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#NULL`
### BOOLEAN
`public static final TypeDescriptor BOOLEAN`. Since 0.30. Represents a boolean type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#BOOLEAN`
### NUMBER
`public static final TypeDescriptor NUMBER`. Since 0.30. Represents a numeric type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#NUMBER`
### STRING
`public static final TypeDescriptor STRING`. Since 0.30. Represents a string type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#STRING`
### ITERABLE
`public static final TypeDescriptor ITERABLE`. Since 21.1. Represents an iterable with any content type. Any iterable type, including those with content type, is assignable to this type. This iterable type is not assignable to any iterable type having a content type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#ITERABLE`
### ITERATOR
`public static final TypeDescriptor ITERATOR`. Since 21.1. Represents an iterator with any content type. Any iterator type, including those with content type, is assignable to this type. This iterator type is not assignable to any iterator type having a content type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#ITERATOR`
### HASH
`public static final TypeDescriptor HASH`. Since 21.1. Represents a hash map with any key type and any value type. Any hash map type, including those with specified key and value types, is assignable to this type. This hash map type is not assignable to any hash map type with specified key or value types. See also: [`Value.hasHashEntries()`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html#hasHashEntries%28%29). Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#HASH`
### OBJECT
`public static final TypeDescriptor OBJECT`. Since 0.30. Represents an object created by a guest language. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#OBJECT`
### ARRAY
`public static final TypeDescriptor ARRAY`. Since 0.30. Represents an array with any content type. Any array type, including those with content type, is assignable to this type. This array type is not assignable to any array type having a content type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#ARRAY`
### HOST_OBJECT
`public static final TypeDescriptor HOST_OBJECT`. Since 0.30. Represents a host object. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#HOST_OBJECT`
### NATIVE_POINTER
`public static final TypeDescriptor NATIVE_POINTER`. Since 0.30. Represents a native pointer. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#NATIVE_POINTER`
### DATE
`public static final TypeDescriptor DATE`. Since 20.0. Type descriptor for date. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#DATE`
### TIME
`public static final TypeDescriptor TIME`. Since 20.0. Type descriptor for time. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#TIME`
### TIME_ZONE
`public static final TypeDescriptor TIME_ZONE`. Since 20.0. Type descriptor for time zone. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#TIME_ZONE`
### DURATION
`public static final TypeDescriptor DURATION`. Since 20.0. Type descriptor for duration. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#DURATION`
### META_OBJECT
`public static final TypeDescriptor META_OBJECT`. Since 20.0. Type descriptor for metaobjects. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#META_OBJECT`
### EXCEPTION
`public static final TypeDescriptor EXCEPTION`. Since 19.3. Type descriptor for exception. See also: [`Value.isException()`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html#isException%28%29). Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#EXCEPTION`
### EXECUTABLE
`public static final TypeDescriptor EXECUTABLE`. Since 0.30. Represents an executable type returning any type and accepting any number of parameters of any type. To create an executable type with concrete types use `TypeDescriptor.executable(org.graalvm.polyglot.tck.TypeDescriptor, org.graalvm.polyglot.tck.TypeDescriptor...)` . This type can be used for creating value constructors but should not be used for specifying expressions or statements parameter types as no other executable is assignable to it. The JavaScript sample usage for no argument function constructor: Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#EXECUTABLE`
```java
@Override
public Collection extends Snippet> createValueConstructors(Context context) {
return Collections.singleton(Snippet.newBuilder(
"function",
context.eval("js", "(function(){ return function(){}})"),
TypeDescriptor.EXECUTABLE).build());
}
```
### EXECUTABLE_ANY
`public static final TypeDescriptor EXECUTABLE_ANY`. Since 19.0. Represents a raw executable type. Any executable can be assigned into the raw executable type, but the raw executable type cannot be assigned to any other executable. To create an executable type with concrete types use `TypeDescriptor.executable(org.graalvm.polyglot.tck.TypeDescriptor, org.graalvm.polyglot.tck.TypeDescriptor...)` . This type can be used for specifying expressions or statements parameter types when the passed executable is actually not invoked. See also: `TypeDescriptor.EXECUTABLE`. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#EXECUTABLE_ANY`
```java
@Override
public Collection extends Snippet> createExpressions(Context context) {
final Collection expressions = new ArrayList<>();
final TypeDescriptor numeric = TypeDescriptor.union(
TypeDescriptor.NUMBER,
TypeDescriptor.BOOLEAN);
final TypeDescriptor nonNumeric = TypeDescriptor.union(
TypeDescriptor.STRING,
TypeDescriptor.OBJECT,
TypeDescriptor.ARRAY,
TypeDescriptor.EXECUTABLE_ANY);
Snippet.Builder builder = Snippet.newBuilder(
"+",
context.eval("js",
"(function (a, b){ return a + b;})"),
TypeDescriptor.NUMBER).parameterTypes(numeric, numeric);
expressions.add(builder.build());
builder = Snippet.newBuilder(
"+",
context.eval("js",
"(function (a, b){ return a + b;})"),
TypeDescriptor.STRING).parameterTypes(nonNumeric, TypeDescriptor.ANY);
expressions.add(builder.build());
builder = Snippet.newBuilder(
"+",
context.eval("js",
"(function (a, b){ return a + b;})"),
TypeDescriptor.STRING).parameterTypes(TypeDescriptor.ANY, nonNumeric);
expressions.add(builder.build());
return expressions;
}
```
### INSTANTIABLE
`public static final TypeDescriptor INSTANTIABLE`. Since 19.0. Represents an instantiable type accepting any number of parameters of any type. To create an instantiable type with concrete parameter types use `TypeDescriptor.instantiable(org.graalvm.polyglot.tck.TypeDescriptor, boolean, org.graalvm.polyglot.tck.TypeDescriptor...)` . This type can be used for creating value constructors but should not be used for specifying expressions or statements parameter types as no other instantiable is assignable to it. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#INSTANTIABLE`
### INSTANTIABLE_ANY
`public static final TypeDescriptor INSTANTIABLE_ANY`. Since 19.0. Represents a raw instantiable type. Any instantiable can be assigned into this raw instantiable type, but the raw instantiable type cannot be assigned to any other instantiable. To create an instantiable type with concrete types use `TypeDescriptor.instantiable(org.graalvm.polyglot.tck.TypeDescriptor, boolean, org.graalvm.polyglot.tck.TypeDescriptor...)` . This type can be used for specifying expressions or statements parameter types when the passed instantiable is actually not invoked. See also: `TypeDescriptor.INSTANTIABLE`. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#INSTANTIABLE_ANY`
### ANY
`public static final TypeDescriptor ANY`. Since 0.30. Represents any type. It's a union of all types. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#ANY`
### ALL
`public static final TypeDescriptor ALL`. Since 24.2. Represents all types. It's an intersection of all types. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#ALL`
## Methods
### hashCode()
`public int hashCode()`. Since 0.30. Overrides `hashCode()`. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#hashCode()`
### equals(Object)
`public boolean equals(Object obj)`. Since 0.30. Overrides `equals(java.lang.Object)`. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#equals(java.lang.Object)`
### toString()
`public String toString()`. Since 0.30. Overrides `toString()`. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#toString()`
### isAssignable(TypeDescriptor)
`public boolean isAssignable(TypeDescriptor fromType)`. Since 0.30. Checks if the given type is assignable to this type. The primitive types are assignable only to itself or to an union type containing the given primitive type. The array type with a component type can be assigned to itself, to an array type without a component type and to an union type containing the given array type or an array type without a component type. The union type can be assigned to other union type containing all union elements. The intersection type can be assigned to type having any intersection type. To the target intersection type only an intersection type having all the target intersection elements can be assigned. Parameters: `fromType` `TypeDescriptor`: the type to assign. Returns `boolean`: true if the fromType is assignable to this type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#isAssignable(org.graalvm.polyglot.tck.TypeDescriptor)`
### isUnion()
`public boolean isUnion()`. Since 0.30. Checks if this `TypeDescriptor` represent an union type. Returns `boolean`: true if this type represents an union type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#isUnion()`
### isIntersection()
`public boolean isIntersection()`. Since 0.30. Checks if this `TypeDescriptor` represent an intersection type. Returns `boolean`: true if this type represents an intersection type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#isIntersection()`
### union(TypeDescriptor...)
`public static TypeDescriptor union(TypeDescriptor... types)`. Since 0.30. Creates a new union type. The union type is any of the given types. Parameters: `types` `TypeDescriptor...`: the types to include in the union. Returns `TypeDescriptor`: the union type containing the given types. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#union(org.graalvm.polyglot.tck.TypeDescriptor...)`
### intersection(TypeDescriptor...)
`public static TypeDescriptor intersection(TypeDescriptor... types)`. Since 0.30. Creates a new intersection type. The intersection type is all of the given types. The intersection can be also used to create a no type. The no type is a type which has no other specialized type. The no type can be assigned to `TypeDescriptor.ANY` and itself. The no type is created as an empty intersection, `TypeDescriptor.intersection()`. Parameters: `types` `TypeDescriptor...`: the types to include in the intersection. Returns `TypeDescriptor`: the intersection type containing the given types. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#intersection(org.graalvm.polyglot.tck.TypeDescriptor...)`
### subtract(TypeDescriptor)
`public TypeDescriptor subtract(TypeDescriptor toRemove)`. Since 20.2. Creates a new type by removing the given type from this type. The type subtraction works in the following way: If this type and the `toRemove` type represent the same types then no type is returned.; If this type represents a `union` type the `toRemove` type is removed from the union type. When the `toRemove` type is also a union type then all types in the `toRemove` union type are removed.; If this type represents an `intersection` type the `toRemove` type is removed from the intersection type. When the `toRemove` type is also an intersection type then all types in the `toRemove` intersection type are removed.; If this and `toRemove` types are parameterized types (array, iterable, iterator, hash) of the same kind the type parameter types are subtracted applying the same rules. Examples: NUMBER.subtract(NUMBER) -\> no type; NUMBER.subtract(STRING) -\> NUMBER; UNION\[NUMBER\|STRING\|OBJECT\].subtract(NUMBER) -\> UNION\[STRING\|OBJECT\]; UNION\[NUMBER\|STRING\|OBJECT\].subtract(UNION\[NUMBER\|STRING\]) -\> OBJECT; INTERSECTION\[NUMBER&STRING&OBJECT\].subtract(NUMBER) -\> INTERSECTION\[STRING&OBJECT\]; INTERSECTION\[NUMBER&STRING&OBJECT\].subtract(INTERSECTION\[NUMBER&STRING\]) -\> OBJECT; ARRAY\[UNION\[NUMBER\|STRING\]\].subtract(ARRAY\[NUMBER\]) -\> ARRAY\[STRING\]; ARRAY\[INTERSECTION\[NUMBER\|STRING\]\].subtract(ARRAY\[NUMBER\]) -\> ARRAY\[STRING\]. Parameters: `toRemove` `TypeDescriptor`: the type to remove. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#subtract(org.graalvm.polyglot.tck.TypeDescriptor)`
### array(TypeDescriptor)
`public static TypeDescriptor array(TypeDescriptor componentType)`. Since 0.30. Creates a new array type with given component type. To create a multi-dimensional array use an array type as a component type. Parameters: `componentType` `TypeDescriptor`: the required component type. Returns `TypeDescriptor`: an array type with given component. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#array(org.graalvm.polyglot.tck.TypeDescriptor)`
### iterable(TypeDescriptor)
`public static TypeDescriptor iterable(TypeDescriptor componentType)`. Since 21.1. Creates a new iterable type with given component type. Parameters: `componentType` `TypeDescriptor`: the required component type. Returns `TypeDescriptor`: an iterable type with given component. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#iterable(org.graalvm.polyglot.tck.TypeDescriptor)`
### iterator(TypeDescriptor)
`public static TypeDescriptor iterator(TypeDescriptor componentType)`. Since 21.1. Creates a new iterator type with given component type. Parameters: `componentType` `TypeDescriptor`: the required component type. Returns `TypeDescriptor`: an iterator type with given component. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#iterator(org.graalvm.polyglot.tck.TypeDescriptor)`
### hash(TypeDescriptor, TypeDescriptor)
`public static TypeDescriptor hash(TypeDescriptor keyType, TypeDescriptor valueType)`. Since 21.1. Creates a new hash map type with given key type and value type. Parameters: `keyType` `TypeDescriptor`: the required key type. `valueType` `TypeDescriptor`: the required value type. Returns `TypeDescriptor`: a new hash map type with given key and value types. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#hash(org.graalvm.polyglot.tck.TypeDescriptor,org.graalvm.polyglot.tck.TypeDescriptor)`
### executable(TypeDescriptor, TypeDescriptor...)
`public static TypeDescriptor executable(TypeDescriptor returnType, TypeDescriptor... parameterTypes)`. Since 0.30. Creates a new executable type with a given return type and parameter types. Parameters: `returnType` `TypeDescriptor`: the required return type, use ANY as any type. `parameterTypes` `TypeDescriptor...`: the required parameter types. Returns `TypeDescriptor`: an executable type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#executable(org.graalvm.polyglot.tck.TypeDescriptor,org.graalvm.polyglot.tck.TypeDescriptor...)`
### executable(TypeDescriptor, boolean, TypeDescriptor...)
`public static TypeDescriptor executable(TypeDescriptor returnType, boolean vararg, TypeDescriptor... parameterTypes)`. Since 0.31. Creates a new executable type with a given return type and parameter types. Parameters: `returnType` `TypeDescriptor`: the required return type, use ANY as any type. `vararg` `boolean`: the executable has variable length arguments or ignores additional parameters. For executables created by the `LanguageProvider.createValueConstructors(org.graalvm.polyglot.Context)` set to `false` if the language neither ignores extra parameters nor the executable has variable arguments length. `parameterTypes` `TypeDescriptor...`: the required parameter types. Returns `TypeDescriptor`: an executable type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#executable(org.graalvm.polyglot.tck.TypeDescriptor,boolean,org.graalvm.polyglot.tck.TypeDescriptor...)`
### instantiable(TypeDescriptor, boolean, TypeDescriptor...)
`public static TypeDescriptor instantiable(TypeDescriptor instanceType, boolean vararg, TypeDescriptor... parameterTypes)`. Since 19.0. Creates a new instantiable type with a given parameter types. Parameters: `instanceType` `TypeDescriptor`: the type of an instance, use ANY as any type. `vararg` `boolean`: the instantiable has variable length arguments or ignores additional parameters. For instantiables created by the `LanguageProvider.createValueConstructors(org.graalvm.polyglot.Context)` set to `false` if the language neither ignores extra parameters nor the instantiable has variable arguments length. `parameterTypes` `TypeDescriptor...`: the required parameter types. Returns `TypeDescriptor`: an instantiable type. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#instantiable(org.graalvm.polyglot.tck.TypeDescriptor,boolean,org.graalvm.polyglot.tck.TypeDescriptor...)`
### forValue(Value)
`public static TypeDescriptor forValue(Value value)`. Since 0.30. Creates a type for given [`Value`](https://graalvm.elide.help/25.6.0-elide.4/api/polyglot/org/graalvm/polyglot/Value.html). Parameters: `value` `Value`: the value to create `TypeDescriptor` for. Returns `TypeDescriptor`: the type of value, may by an union type containing more primitive or array types. Cite: `org/graalvm/polyglot/tck/TypeDescriptor.html#forValue(org.graalvm.polyglot.Value)`
## Inherited members
- From class [`Object`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html): [`getClass`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass%28%29), [`notify`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify%28%29), [`notifyAll`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long%29), [`wait`](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait%28long,int%29)