groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jochen Theodorou (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-7541) GroovyBugError in TypeTransformer.addTransformer
Date Thu, 06 Aug 2015 06:56:04 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-7541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659581#comment-14659581
] 

Jochen Theodorou commented on GROOVY-7541:
------------------------------------------

GroovyBugError message are not supposed to appear at all and are not to be seen as messages
informing the user. Instead they show bugs and that something happened that should not have
happened and that a bug fix is required. What addTransformers does is adding transformations
for some transformation cases like GString->String, Object->array, Number->Number.
Any other kind of transformation is not supposed to get to this point. The message 

BUG! Unknown transformation for argument <... stuff from toString of d1 here...> at
position 0 with class com.ibm.cayce.sdv.dataset.Dataset for parameter of type class org.codehaus.groovy.vmplugin.v7.IndyInterface

tells me that the first parameter of the method we want to call got an object of type DataSet,
but the method signature of the method to be called expects at this position an object of
type IndyInterface. This would mean to me, we are talking about the this part: d1.setIndexes(HashMap),
where d1 is a DataSet. This means position 0 is supposed to have DataSet, not IndyInterface.
This would indicate we are talking about a method invokedynamic invocation with IndyInterface
itself, which is not supposed to happen.

What you could do is setting the system property groovy.indy.logging (value does not really
matter, as long as it is not null), and provide me the log from the last method invocation
on. Then I can maybe see the problem, but at least what method was supposed to be called.
Other than that, I see nothing I can do right now.  There is of course always the chance of
actually seeing a JVM bug here, but before I start blaming poor JVM engineers, it would be
better to ensure Groovy is doing things as it is supposed to do. Best would be a test case
of course. 

> GroovyBugError in TypeTransformer.addTransformer
> ------------------------------------------------
>
>                 Key: GROOVY-7541
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7541
>             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 com.ibm.cayce.sdv.dataset.Dataset 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	
> Script2.run() 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
description).
> 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
(v6.3.4#6332)

Mime
View raw message