jeudi 16 mars 2017

how to work reflection using ASM library in java?

hi guys i have some experience programming but new to use reflectasm in java and have a project to do, wish someone here helping me.

Project description: write a program in java to give a .jar file as input and doing below steps.

1-count the number of existed classes in jar file.

2-for each class list the names of all classes been called by this class and those methods name plus signature (name and signature of just called method of called class)

3-list those methods name and its signature that called a class.

the output must be as below json file.

"ClassCount": 2,
"Classes": [
    {
        "CallerClassName": "Class1",
        "CalledInfo": [
            {
                "CalledClassName": "Class2",
                "CalledFunctionName": "m",
                "CalledFunctionDescription": "(IF)V",
                "CallerFunctionName": "f",
                "CallerFunctionDescription": "()V"
            },
            {
                "CalledClassName": "Class2",
                "CalledFunctionName": "m",
                "CalledFunctionDescription": "(IF)V",
                "CallerFunctionName": "g",
                "CallerFunctionDescription": "(IF)V"
            }
        ]
    },
    {
        "CallerClassName": "Class2",
        "CalledInfo": [
            {
                "CalledClassName": "Class1",
                "CalledFunctionName": "f",
                "CalledFunctionDescription": "()V",
                "CallerFunctionName": "h",
                "CallerFunctionDescription": "()V"
            }
        ]
    }
]

}

i hope someone help me to how write this code for each steps.





Aucun commentaire:

Enregistrer un commentaire