JavaScript stubs generation and licensing

To call JavaScript functions from Kotlin I need to declare everything I want to use.

Just a few days ago I’ve got good idea: instead of writing stubs by hands I can generate them. Then I unpacked .xml files from IDEA’s JavaScript plugin with complete DOM/DHTML/etc functions and wrote XSL-stylesheet to create Kotlin declarations from it. Of course generated code is not VERY GOOD… but it covers huge part of work.

But, I guess these files I’ve used to generate declarations has some proprietary license so I can’t use or public such Kotlin declarations since prorietary files used to get them, isn’t it?

I've no idea, I'll let someone from JetBrains answer that one - but this sounds very interesting! Having automatically created nice Kotiln APIs for DOM / DHTML stuff would be great! :).

FWIW for w3c DOM I figured we could just reuse (or extend) the org.w3c.dom API thats already part of the JDK?

jstrachan wrote:

FWIW for w3c DOM I figured we could just reuse (or extend) the org.w3c.dom API thats already part of the JDK?

Yes, it is, but…  when the compiler tries to use these classes during JavaScript generation… let’s just say this is not simple to do or I don’t know how. I can see kotlin’s trunk already uses this approach but I’am not sure this is so good as it looks first because of too many hacks (such as Java’s API re-declaration and so on)

Does anybody know about licensing?

What specific files are you asking about?  You're asking about files contained in the javascript IDEA plugin?  I guess this plugin not open source.. it's only in the ultimate edition?  I guess if that's the case someoen at JetBrains would have to answer!

I have asked guys from IDEA team, they said that this needs discussing. We'll post answer as soon as possible.

Hi,

We are discussing this issue with the IDEA management and legal.

In any case, we will provide Kotlin stubs for the API you mentioned ourselves (and pretty soon), so this problem shouldn’t stand long.