Groovy generated class name
groovy, groovyshell, java, json
Solution
Yes, it's possible to set custom name for groovy script. You should use `groovy.lang.GroovyClassLoader`. For example:
GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
Class<Script> parsedClass = groovyClassLoader.parseClass(scriptText, name);
Script script = scriptClass.newInstance();
script.run()
Problem
I'm using java + groovy scripts. Is it possible to change this generated by groovy class names (Script1.groovy, Script777.groovy etc.)? It's hard to find correct script in case of exception:/ ``` Caused by: org.json.JSONException: JSONObject["value14"] not found. at org.json.JSONObject.get(JSONObject.java:498) at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.MethodMetaProperty$GetMethodMetaProperty.getProperty(MethodMetaProperty.java:59) at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:61) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227) at Script4.run(Script4.groovy:23) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:346) ... 13 more ```