使用泛型将 java 5 代码转换为可以在 J2ME 设备上运行的代码?

发布于 2024-07-12 08:22:59 字数 197 浏览 3 评论 0原文

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

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

家住魔仙堡 2024-07-19 08:22:59

使用常规 javac 进行编译并针对较旧的 JVM 至少将为您提供适合泛型的字节码。

如果您确实需要源代码,尽管很奇怪,但可能可以编译为字节码,然后反编译回源代码。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文