How to hide Java object type using Groovy or another JVM language

My problem is that I am trying to interact with a Java application whose jar file contains obfuscated bytecode. An application releases updates every month or so, and when they release, most class names and methods change.

So the method proposed here is:

http://rickyclarkson.blogspot.com/2006/07/duck-typing-in-java-and-no-reflection.html

or

Imitation of duck input in Java

will not work in my solution, because I will have to update the interfaces manually each time.

However, I do have an automatic creation (for the most part) of matching from the name of the deobfuscated class name ↔ obfuscated name of the class by parsing class files for calls to debug log calls in the form:

logger.log(severity, "ClassName", "MethodName() has some error")

What I create is something like this:

public final static String MyRealName = "someObfuscatedName".
public final static String MyRealName_myCoolMethod = "someMethodName".

I have a pretty decent solution for interacting with "myRealName" objects through the reflection API and just proxy objects that implement a subset of the functionality of the object that it proxies. Like that:

class MyRealName {
    private Object backingObject;

    public MyRealName(Object o) { backingObject = o;}

    public void myCoolMethod() { 
        return getFieldValue(backingObject
        , DeobNames.MyRealName_myCoolMethod);
    }
}

However, the problem arises when I want to test my code in the absence of a running application from launch - the launch and installation time may take several minutes, while checking the verification for a couple of seconds.

What I'm looking for is a way to easily adapt my tests to accommodate the frequently changing class names that my code depends on.

, JMockit .., , , , - mocks, , , .

+4
1

All Articles