* Java code is treated as ''focus-independent''. If a function accesses the current context item, position or size, it should be annotated as {{Code|@FocusDependent}}
Since {{Version|8.0}}, the [https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/QueryResource.java QueryResource] interface can be implemented to finalize opened connections or resources in a module. Its {{Code|close()}} method will be called after the query has been fully evaluated.
The following XQuery code invokes two Java methods. The first Java function retrieves information from the static query context, and the second one throws a query exception:
=Changelog=
; Version 8.0
* Added: {{Code|QueryResource}} interface, called after a query has been fully evaluated.
; Version 7.8