Skip to content

Commit b1967c4

Browse files
authored
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.
1 parent e754180 commit b1967c4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
3131
* Improved GLV examples reliability and documentation with step-by-step instructions.
3232
* 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.
3333
* Bump netty to 4.1.125.Final
34+
* Fixed `empty-sample-secure.groovy` to work with `Compilation.COMPILE_STATIC`
3435
3536
[[release-3-7-4]]
3637
=== TinkerPop 3.7.4 (Release Date: August 1, 2025)

gremlin-server/scripts/empty-sample-secure.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@
3131
def addItUp(int x, int y) { x + y }
3232

3333
// an init script that returns a Map allows explicit setting of global bindings.
34-
def globals = [:]
34+
def Map<Object, Object> globals = [:]
3535

3636
// defines a sample LifeCycleHook that prints some output to the Gremlin Server console.
3737
// note that the name of the key in the "global" map is unimportant. As this script,
3838
// runs as part of a sandbox configuration, type-checking is enabled and thus the
3939
// LifeCycleHook type needs to be defined for the "ctx" variable.
40-
globals << [hook : [
40+
globals << ([hook : [
4141
onStartUp: { LifeCycleHook.Context ctx ->
4242
ctx.logger.info("Executed once at startup of Gremlin Server.")
4343
},
4444
onShutDown: { LifeCycleHook.Context ctx ->
4545
ctx.logger.info("Executed once at shutdown of Gremlin Server.")
4646
}
47-
] as LifeCycleHook]
47+
] as LifeCycleHook] as Map<Object, Object>)
4848

4949
// define the default TraversalSource to bind queries to - this one will be named "g".
5050
// ReferenceElementStrategy converts all graph elements (vertices/edges/vertex properties)
@@ -55,4 +55,4 @@ globals << [hook : [
5555
//
5656
// must use an instance of ReferenceElementStrategy as Groovy shorthands won't work with
5757
// secure script execution.
58-
globals << [g : traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy.instance())]
58+
globals << ([g : traversal().withEmbedded(graph).withStrategies(ReferenceElementStrategy.instance())] as Map<Object, Object>)

0 commit comments

Comments
 (0)