Java code transform at compile time

前端 未结 4 1888
太阳男子
太阳男子 2020-12-24 13:10

I would like to transform java source code at compile time just before passing the source code to the compiler. In other word I would like

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 13:25

    There is someone who already wrote a small C-like preprocessor ant plugin in python/jython. You can find it here. Note that I have never used it, but perhaps it can be a good starting point for your needs.

    There is also a java-comment-preprocessor maven plugin (similar style) in google code that might also be a helpful starting point.

    Good luck. Sounds like a fun challenge. Of course, keep in mind that obfuscation is just making it a little more challenging to extract the string, but still not impossible. If you really want to make it significantly more difficult, then you might want to look at encrypting your strings and/or using AOP.

提交回复
热议问题