Hello there,
I've got the following code:
===
println "WTF rtypes '${rtypes.getClass()}'$rtypes key '${key.getClass()}'$key' desc '${desc.getClass()}'$desc'"
rtypes[key]=desc // this is ClassTransformerAgent.groovy:117
println ' success'
===
Note it's part of a class instrumentation; nevertheless _no class is actually changed anyhow_; the ClassFileTransformer.transform method consistently returns null (for testing purposes). This code works many times all right and then crashes in a completely weird way:
===
... ... ... long list of 1500-odd printouts, similar to the few two ones below (sometimes nonempty rtypes, too) ...
WTF rtypes 'class java.util.LinkedHashMap'[:] key 'class java.lang.String'paramString' desc 'class java.lang.String'()Ljava/lang/String;'
success
WTF rtypes 'class java.util.LinkedHashMap'[:] key 'class java.lang.String'paramString' desc 'class java.lang.String'()Ljava/lang/String;'
success
WTF rtypes 'class java.util.LinkedHashMap'[:] key 'class java.lang.String'dictionary' desc 'class java.lang.String'()Lcom/webobjects/foundation/NSDictionary;'
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '()Lcom/webobjects/foundation/NSDictionary;' with class 'java.lang.String' to class 'java.util.Map'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:371)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:2516)
at groovy.lang.ExpandoMetaClass.setProperty(ExpandoMetaClass.java:1170)
at groovy.lang.MetaClassImpl.setProperty(MetaClassImpl.java:3462)
at org.codehaus.groovy.runtime.InvokerHelper.setProperty(InvokerHelper.java:195)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.putAt(DefaultGroovyMethods.java:251)
at org.codehaus.groovy.runtime.dgm$429.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at cz.ocs.javaagent.Accessorizer.visitMethod(ClassTransformerAgent.groovy:117)
at groovyjarjarasm.asm.ClassReader.b(Unknown Source)
...
===
Does not make any sense at all to me (and can't repeat it in a sample code outside of my app, which -- given in there it works perfectly 1500-odd times before it crashes does surprise). Why in the name of all saints should it cast the value being stored into a dictionary to a Map?
Might perhaps someone have any idea what might be the culprit, or at least, how to pursue the problem? Aside of logging out rtypes/key/desc (which I did as seen above, without any clue) I have no idea :( Out of desperation I've tried 'rtypes.putAt(key,desc)', which, as expected, did not change anything at all.
Thanks,
OC
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email