dimanche 18 décembre 2016

Generate stub classes and method signatures for a huge code base using reflection

I am attempting to build a development environment from a huge application. I can access it by running Java directly, but do not have the source code.

In order to develop against it, I would like to stub out everything I can use, along with super classes, interfaces, fields, etc.

I have done a lot of this via reflection, but I am having trouble figuring out how to convert the data from enums and generics.

The rest has been ok, get the package, then the modifiers of the class, the class name, the super class, and any interfaces if they exist, results in

package x;

public class Test() Extends Temp implements Thing
{
}

etc, looping over fields, constructors, methods, inner classes. But I don't really understand enums, the are prefaced by $SWITCH_TABLE$ and I don't want to hard code a replacement, I'd rather understand how to operate on this data correctly.

I also have no clue how to generate code for generic types.

Any help would be greatly appreciated!

Thanks! Greg

Enum,





Aucun commentaire:

Enregistrer un commentaire