Well, I'm getting MissingMethodException even after inserting a method into a metaclass. It's strange that its says there's no signature applicable for a String, but there's for java.lang.Object
Some obs:
-
- yeah, the
List<Class> classes
that I'm iterating contains the class I'm trying to use
-
- please don't suggest me to use @Log4j or any other, it's not working with any method I try to insert (even though I can manipulate the same class fields with reflections)
-
- as I said, the stackstrace says that there isn't signature
(java.lang.String)
but there's to (java.lang.Object)
classes.each { clazz ->
clazz.metaClass.log = { instance.simpleLogger.log(it) }
clazz.metaClass.debug = { instance.simpleLogger.debug(it) }
@Override
void enable() {
debug("eae meu bom")
}
groovy.lang.MissingMethodException: No signature of method: com.dont.testplugin.Terminal.debug() is applicable for argument types: (java.lang.String) values: [eae meu bom]
Possible solutions: debug(), debug(java.lang.Object), getAt(java.lang.String), log(), dump(), log(java.lang.Object)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:56) ~[?:?]
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:78) ~[?:?]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49) ~[?:?]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) ~[?:?]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) ~[?:?]
question from:
https://stackoverflow.com/questions/65866095/groovy-no-signature-of-method-after-inserting-a-method 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…