将使用泛型的java 5代码转换为可以在J2ME设备上运行的代码? [英] Convert java 5 code using generics to code that can run on a J2ME device?

查看:166
本文介绍了将使用泛型的java 5代码转换为可以在J2ME设备上运行的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何解决方案或工具将使用所有新的Java 5功能(泛型,自动装箱,可变参数,静态导入)的Java 5代码转换为可在J2ME设备上运行的代码?我对处理泛型特别感兴趣 - 其他功能很好,但不是强制性的。

我需要使用源代码作为此转换的结果,因为它将使用自定义编译器。 (我不能使用字节码操作(ala retroweaver))

解决方案

使用常规javac编译并针对较旧的JVM会给予适当的至少是泛型的字节码。

如果你真的需要源代码,它可能会很奇怪,但可以编译成字节码,然后反编译回源代码。


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))

解决方案

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.

这篇关于将使用泛型的java 5代码转换为可以在J2ME设备上运行的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆