groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Nimick (JIRA)" <>
Subject [jira] [Commented] (GROOVY-7541) GroovyBugError in TypeTransformer.addTransformer
Date Wed, 05 Aug 2015 18:03:05 GMT


Dan Nimick commented on GROOVY-7541:

Another developer had time to delve into this some more and discovered that the error occurs
when the setIndexes method is not public (it's protected, currently).

So we have an obvious fix, and it makes sense that there might be an error invoking something
that isn't public, but perhaps a better error message is in order?

> GroovyBugError in TypeTransformer.addTransformer
> ------------------------------------------------
>                 Key: GROOVY-7541
>                 URL:
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 2.4.4
>         Environment: Java web app on either Apache on Linux or Windows,  or WebSphere
on AIX. Java 7.1. Groovy via ScriptEngineManager.getEngineByName("groovy")
>            Reporter: Dan Nimick
>             Fix For: 2.3.7
> Just updated from Groovy 2.3.6 to 2.4.4 and this code no longer works when dynamic invocation
is used (works fine when indy not used):
> d1.setIndexes(new HashMap<List<String>,DatasetIndex>());
> where d1 is one of the Java classes imported to the Groovy script. setIndexes is just
a plain setter of a field on the class. The error is
> BUG! Unknown transformation for argument <... stuff from toString of d1 here...>
at position 0 with class for parameter of type class org.codehaus.groovy.vmplugin.v7.IndyInterface
> It contains no stack trace, but by searching for sources of "Unknown transformation for
argument", I found it to be in TypeTransformer.addTransformer. If I put a breakpoint there,
this is the call stack:
> TypeTransformers.addTransformer(MethodHandle, int, Object, Class) line: 124	
> Selector$MethodSelector.correctCoerce() line: 793	
> Selector$MethodSelector.setCallSiteTarget() line: 958	
> IndyInterface.selectMethod(MutableCallSite, Class, String, int, Boolean, Boolean, Boolean,
Object, Object[]) line: 214	
> line: 2	
> GroovyScriptEngineImpl.eval(Class, ScriptContext) line: 323	
> GroovyScriptEngineImpl.eval(String, ScriptContext) line: 124	
> GroovyScriptEngineImpl(AbstractScriptEngine).eval(String) line: 276	
> Looks like TypeTransformer was introduced via org.codehaus.groovy.vmplugin.v7 in version
2.3.8, but I don't see anything in the 2.3.8 change log about it (at least not under an obvious
> FWIW, we turn on dynamic invocation via:
>     CompilerConfiguration configuration = new CompilerConfiguration();     configuration.setTargetBytecode(System.getProperty("java.specification.version"));

>     configuration.getOptimizationOptions().put("indy", true); 
>     configuration.getOptimizationOptions().put("int", false); 
>    configuration.addCompilationCustomizers(importCustomizer,secureCustomizer); 
>     GroovyClassLoader gcl = new GroovyClassLoader(this.getClass().getClassLoader(), configuration);
>       ((GroovyScriptEngineImpl) engine).setClassLoader(gcl);
> Please let me know if any more info is needed, or if there is a work around (other than
not using indy).

This message was sent by Atlassian JIRA

View raw message