简体   繁体   English

Kotlin 用于 Java 卡?

[英]Kotlin for Java Card?

Is it possible to use Kotlin language to develop Java Card applets?是否可以使用Kotlin语言开发Java卡小程序?

I know Kotlin produces JVM compatible byte code, but I am not sure Kotlin compilers can produce Java Card compatible byte code. I know Kotlin produces JVM compatible byte code, but I am not sure Kotlin compilers can produce Java Card compatible byte code. Google knows nothing about this..谷歌对此一无所知..

You might think that this should be possible as byte code is byte code.您可能认为这应该是可能的,因为字节码就是字节码。 However, Java Card is a limited subset of Java both when it comes to the runtime as well as the API.然而,Java 卡是 Java 的有限子集,无论是运行时还是 API。 As there has been no similar subset of Kotlin defined it would be next to impossible to use Kotlin for this.由于没有定义 Kotlin 的类似子集,因此几乎不可能使用 Kotlin 。

As far as I understood, Kotlin uses some tricks to implement certain features, eg generated bytecode that may use other objects.据我了解,Kotlin 使用一些技巧来实现某些功能,例如生成的字节码可能会使用其他对象。 If these tricks use any Java that is not included in Java Card then a direct translation from Kotlin code to Java Card compliant code would fail. If these tricks use any Java that is not included in Java Card then a direct translation from Kotlin code to Java Card compliant code would fail. Note that Java Card even misses features such as strings, that int is optional and that new objects are created in persistent memory, the Kotlin specific bytecode almost certainly won't take such restrictions into account.请注意,Java 卡甚至错过了诸如字符串之类的功能, int是可选的,并且新对象是在持久性 memory 中创建的,Kotlin 几乎肯定会考虑到特定字节码的限制。

In short, you'll have to familiarize yourself with Java and Java Card to develop for it.简而言之,您必须熟悉 Java 和 Java 卡才能为其开发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM