This changelog summarizes major changes between Graal SDK versions. The main focus is on APIs exported by Graal SDK.
- Added FileSystem.setCurrentWorkingDirectory method to set a current working directory for relative paths resolution in the polyglot FileSystem.
- Added a Context.Builder.logHandler and Engine.Builder.logHandler methods to install a logging handler writing into a given
OutputStream
Value.asValue(Object)
now also works if no currently entered context is available.- Primitives, host and
Proxy
values can now be shared between multiple context and engine instances. They no longer throw anIllegalArgumentException
when shared. Primitive types areBoolean
,Byte
,Short
,Integer
,Long
,Float
,Double
,Character
andString
of thejava.lang
package. Non primitive values originating from guest languages are not sharable.
- Added
MessageTransport
andMessageEndpoint
to virtualize transport of messages to a peer URI. - Added
Value.canInvokeMember()
andValue.invokeMember()
to invoke a member of an object value.
- Graal SDK was relicensed from GPLv2 with CPE to Universal Permissive License (UPL).
- Added new
ByteSequence
utility to the IO package that is intended to be used as immutable byte sequence representation. - Added support for byte based sources:
- Byte based sources may be constructed using a
ByteSequence
or from aFile
orURL
. Whether sources are interpreted as character or byte based sources depends on the specified language. Source.hasBytes()
andSource.hasCharacters()
may be used to find out whether a source is character or byte based.- Byte based sources throw an
UnsupportedOperationException
if methods that access characters, line numbers or column numbers. - Added
Source.getBytes()
to access the contents of byte based sources.
- Byte based sources may be constructed using a
- Added support for MIME types to sources:
- MIME types can now be assigned using
Source.Builder.mimeType(String)
to sources in addition to the target language. - The MIME type of a source allows languages support different kinds of input.
Language
instances allow access to the default and supported MIME types usingLanguage.getMimeTypes()
andLanguage.getDefaultMimeType()
.- MIME types are automatically detected if the source is constructed from a
File
orURL
if it is not specified explicitly. - Deprecated
Source.getInputStream()
. UseSource.getCharacters()
orSource.getBytes()
instead.
- MIME types can now be assigned using
- Context methods now consistently throw
IllegalArgumentException
instead ofIllegalStateException
for unsupported sources or missing / inaccessible languages. - Added
Engine.findHome()
to find the GraalVM home folder.
PolyglotException.getGuestObject()
now returnsnull
to indicate that no exception object is available instead of returning aValue
instance that returnstrue
forisNull()
.- Added new execution listener API that allows for simple, efficient and fine grained introspection of executed code.
- Added support for logging in Truffle languages and instruments.
- Added
Value.asValue(Object)
to convert a Java object into its value representation using the currently entered context. - Added
Context.getCurrent()
to lookup the current context to allow Java methods called by a Graal guest language to evaluate additional code in the current context. - Removed deprecated
Context.exportSymbol
andContext.importSymbol
. - Removed deprecated
Source.getCode
. - The code cache for sources is now weak. Code can be garbage collected if a source is no longer referenced but the Context or Engine is still active.
- Added
Source.Builder.cached(boolean)
to configure caching behavior by source.
- Added Context.Builder#allowHostClassLoading to allow loading of new classes by the guest language.
- Added
Value.getSourceLocation()
to find a functionSourceSection
.
- Expose Runtime name as Engine#getImplementationName();
- Deprecate Context#exportSymbol, Context#importSymbol, Context#lookup use Context#getBindings, Context#getPolyglotBindings instead.
- Remove deprecated API Engine#getLanguage, Engine#getInstrument.
- Remove deprecated Language#isHost.
- Deprecate ProxyPrimitive without replacement.
- Added Context.Builder#allAccess that allows to declare that a context has all access by default, also for new access rights.
- Added Value#as(Class) and Value.as(TypeLiteral) to convert to Java types.
- Added Context#asValue(Object) to convert Java values back to the polyglot Value representation.
- Added Value#isProxyObject() and Value#asProxyObject().
- Introduced Context.enter() and Context.leave() that allows explicitly entering and leaving the context to improve performance of performing many simple operations.
- Introduced Value.executeVoid to allow execution of functions more efficiently if not return value is expected.
- Initial revision of the polyglot API introduced.
- Initial revision of the native image API introduced.
- Initial revision of the options API introduced.