Groovy is great!

It is not only great mix of useful and convenient language constructs of Python, Ruby and other languages but it also turned out that it is a very good code obfuscator 🙂 Here is an example, code below:

    public static IDfSession getSession(String user,
        String password, String docbase) throws DfException {

        IDfClientX clientx = new DfClientX();
        IDfClient client = clientx.getLocalClient();
        IDfLoginInfo li = new DfLoginInfo();
        return client.newSession(docbase, li);

was translated to:

    public static IDfSession getSession(String user, String password, String docbase)
        throws DfException
        CallSite acallsite[] = $getCallSiteArray(); clientx = (( (acallsite[0].callConstructor($get$$class$com$documentum$com$DfClientX())));
        IDfClient client = (IDfClient)ScriptBytecodeAdapter.castToType(acallsite[1].call(clientx), $get$$class$com$documentum$fc$client$IDfClient());
        com.documentum.fc.common.IDfLoginInfo li = ((com.documentum.fc.common.IDfLoginInfo) (acallsite[2].callConstructor($get$$class$com$documentum$fc$common$DfLoginInfo())));
        acallsite[3].call(li, user);
        acallsite[4].call(li, password);
        return (IDfSession)ScriptBytecodeAdapter.castToType(acallsite[5].call(client, docbase, li), $get$$class$com$documentum$fc$client$IDfSession());

Awesome 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *