This is an automated email from the ASF dual-hosted git repository.

andreac pushed a commit to branch 3.7-dev
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/3.7-dev by this push:
     new b1967c4a7d Fixed empty-sample-secure.groovy to work with 
COMPILE_STATIC (#3262)
b1967c4a7d is described below

commit b1967c4a7d693c7d69ed7ea19b3ca18e8dce515e
Author: andreachild <[email protected]>
AuthorDate: Tue Nov 4 13:18:20 2025 -0800

    Fixed empty-sample-secure.groovy to work with COMPILE_STATIC (#3262)
    
    Fixed empty-sample-secure.groovy script to work with 
GroovyCompilerGremlinPlugin Compilation.COMPILE_STATIC which has stricter type 
checking by using explicit map type declaration and casting of map entry 
values. Otherwise the server will fail to start when using 
gremlin-server-secure.yaml config sample.
---
 CHANGELOG.asciidoc                                | 1 +
 gremlin-server/scripts/empty-sample-secure.groovy | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 1edce1b78b..61093b81df 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -31,6 +31,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Improved GLV examples reliability and documentation with step-by-step 
instructions.
 * Added root-level GLV examples in `gremlin-examples/` directory that use 
published driver versions for easy out-of-the-box usage, separate from 
module-level examples that use local development code.
 * Bump netty to 4.1.125.Final
+* Fixed `empty-sample-secure.groovy` to work with `Compilation.COMPILE_STATIC`
 
 [[release-3-7-4]]
 === TinkerPop 3.7.4 (Release Date: August 1, 2025)
diff --git a/gremlin-server/scripts/empty-sample-secure.groovy 
b/gremlin-server/scripts/empty-sample-secure.groovy
index 0f05847060..786e261761 100644
--- a/gremlin-server/scripts/empty-sample-secure.groovy
+++ b/gremlin-server/scripts/empty-sample-secure.groovy
@@ -31,20 +31,20 @@
 def addItUp(int x, int y) { x + y }
 
 // an init script that returns a Map allows explicit setting of global 
bindings.
-def globals = [:]
+def Map<Object, Object> globals = [:]
 
 // defines a sample LifeCycleHook that prints some output to the Gremlin 
Server console.
 // note that the name of the key in the "global" map is unimportant. As this 
script,
 // runs as part of a sandbox configuration, type-checking is enabled and thus 
the
 // LifeCycleHook type needs to be defined for the "ctx" variable.
-globals << [hook : [
+globals << ([hook : [
   onStartUp: { LifeCycleHook.Context ctx ->
     ctx.logger.info("Executed once at startup of Gremlin Server.")
   },
   onShutDown: { LifeCycleHook.Context ctx ->
     ctx.logger.info("Executed once at shutdown of Gremlin Server.")
   }
-] as LifeCycleHook]
+] as LifeCycleHook] as Map<Object, Object>)
 
 // define the default TraversalSource to bind queries to - this one will be 
named "g".
 // ReferenceElementStrategy converts all graph elements (vertices/edges/vertex 
properties)
@@ -55,4 +55,4 @@ globals << [hook : [
 //
 // must use an instance of ReferenceElementStrategy as Groovy shorthands won't 
work with
 // secure script execution.
-globals << [g : 
traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy.instance())]
\ No newline at end of file
+globals << ([g : 
traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy.instance())]
 as Map<Object, Object>)
\ No newline at end of file

Reply via email to