Emanuele Tagliaferri created TINKERPOP-3117:
-----------------------------------------------

             Summary: gremlin groovy tests fail with `Unsupported class file 
major version 65` with JDKs 21 forward
                 Key: TINKERPOP-3117
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3117
             Project: TinkerPop
          Issue Type: Bug
          Components: language
    Affects Versions: 3.7.2
            Reporter: Emanuele Tagliaferri


Running tests with java version cause exceptions with error: `Unsupported class 
file major version 65` I did investigate this error myself and I could identify 
the reason in some analyzer of the groovy language, so I could work around the 
problem disabling the analyzer with some groovy compiler settings.

I've done it both from code:

{code:java}
GremlinGroovyScriptEngineFactory factory = new 
GremlinGroovyScriptEngineFactory();
CachedGremlinScriptEngineManager customizationManager = new 
CachedGremlinScriptEngineManager();
Map<String, Object> compilerConfigs = new HashMap<>();
Map<String, Object> optimizationConfigs = new HashMap<>();
optimizationConfigs.put("asmResolving", false);
compilerConfigs.put("OptimizationOptions", optimizationConfigs);
customizationManager.addPlugin(GroovyCompilerGremlinPlugin.build().compilerConfigurationOptions(compilerConfigs).create());
factory.setCustomizerManager(customizationManager);
{code}


and from configuration:

{code:yaml}
scriptEngines: {
  gremlin-groovy: {
    plugins: { 
       # ... other configs       

org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyCompilerGremlinPlugin: 
{compilerConfigurationOptions: { OptimizationOptions: { asmResolving: false}}}
   }
 }
}
{code}


this could be done directly in a generic way for all the implementations adding 
the setting here:
https://github.com/apache/tinkerpop/blob/master/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java#L756


This is a follow up of a conversation in the discord channel








--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to