How to use java annotations to modify source code before final compilation?
问题 I've read from the apt tool page that one can create AnnotationProcessors to generate new derived files (source files, class files, deployment descriptors, etc.). I am looking for example to do so. My need is to encode all annotated strings at compile time, so that reading the class file does not allow reading the static strings: Base code: String message = (@Obfuscated "a string that should not be readable in class file"); Should be reworked as: String message = new ObfuscatedString(new long