Groovy脚本和Groovy类反编译文件

Groovy类

package preload_groovy

class GroovyKlass {
    static void main(String[] args) {
        println "Hello"
    }
}
package preload_groovy;

import org.codehaus.groovy.reflection.*;
import groovy.lang.*;
import java.lang.ref.*;
import org.codehaus.groovy.runtime.*;
import org.codehaus.groovy.runtime.callsite.*;

public class GroovyKlass implements GroovyObject
{
    private static /* synthetic */ ClassInfo $staticClassInfo;
    private transient /* synthetic */ MetaClass metaClass;
    private static /* synthetic */ SoftReference $callSiteArray;
    
    public GroovyKlass() {
        $getCallSiteArray();
        this.metaClass = this.$getStaticMetaClass();
    }
    
    public static void main(final String... args) {
        $getCallSiteArray()[0].callStatic((Class)GroovyKlass.class, (Object)"Hello");
    }
    
    protected /* synthetic */ MetaClass $getStaticMetaClass() {
        if (this.getClass() != GroovyKlass.class) {
            return ScriptBytecodeAdapter.initMetaClass((Object)this);
        }
        ClassInfo $staticClassInfo = GroovyKlass.$staticClassInfo;
        if ($staticClassInfo == null) {
            $staticClassInfo = (GroovyKlass.$staticClassInfo = ClassInfo.getClassInfo((Class)this.getClass()));
        }
        return $staticClassInfo.getMetaClass();
    }
    
    private static /* synthetic */ CallSiteArray $createCallSiteArray() {
        final String[] array = { null };
        $createCallSiteArray_1(array);
        return new CallSiteArray((Class)GroovyKlass.class, array);
    }
    
    private static /* synthetic */ CallSite[] $getCallSiteArray() {
        CallSiteArray $createCallSiteArray;
        if (GroovyKlass.$callSiteArray == null || ($createCallSiteArray = GroovyKlass.$callSiteArray.get()) == null) {
            $createCallSiteArray = $createCallSiteArray();
            GroovyKlass.$callSiteArray = new SoftReference($createCallSiteArray);
        }
        return $createCallSiteArray.array;
    }
}

Groovy脚本

package preload_groovy

println 'Hello'

package preload_groovy;

import org.codehaus.groovy.reflection.*;
import java.lang.ref.*;
import groovy.lang.*;
import org.codehaus.groovy.runtime.*;
import org.codehaus.groovy.runtime.callsite.*;

public class GroovyScript extends Script
{
    private static /* synthetic */ SoftReference $callSiteArray;
    
    public GroovyScript() {
        $getCallSiteArray();
    }
    
    public GroovyScript(final Binding context) {
        $getCallSiteArray();
        super(context);
    }
    
    public static void main(final String... args) {
        $getCallSiteArray()[0].call((Object)InvokerHelper.class, (Object)GroovyScript.class, (Object)args);
    }
    
    public Object run() {
        return $getCallSiteArray()[1].callCurrent((GroovyObject)this, (Object)"Hello");
    }
    
    private static /* synthetic */ CallSiteArray $createCallSiteArray() {
        final String[] array = new String[2];
        $createCallSiteArray_1(array);
        return new CallSiteArray((Class)GroovyScript.class, array);
    }
    
    private static /* synthetic */ CallSite[] $getCallSiteArray() {
        CallSiteArray $createCallSiteArray;
        if (GroovyScript.$callSiteArray == null || ($createCallSiteArray = GroovyScript.$callSiteArray.get()) == null) {
            $createCallSiteArray = $createCallSiteArray();
            GroovyScript.$callSiteArray = new SoftReference($createCallSiteArray);
        }
        return $createCallSiteArray.array;
    }
}

posted @ 2020-12-31 09:46  JXY_Super  阅读(726)  评论(0编辑  收藏  举报