问题
Are there any solutions or tools that transform java 5 code that uses all the new java 5 features(generics, autoboxing, varargs, static imports) into code that can run on a J2ME device? I am particularly interested in handling generics - the other features are nice to have but not mandatory.
I need source code as the result of this conversion as this will be compiled using a custom compiler. (I cannot use bytecode manipulation(ala retroweaver))
回答1:
Compiling with the regular javac and targeting an older JVM will give you proper bytecode for generics at least.
If you really need source it's probably possible, though strange, to compile to bytecode and then decompile back to source.
来源:https://stackoverflow.com/questions/436847/convert-java-5-code-using-generics-to-code-that-can-run-on-a-j2me-device