bensku / java-ts-bind

TypeScript bindings for Java with GraalJS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Record types don't exist

Yu-Vitaqua-fer-Chronos opened this issue · comments

Heya, @bensku is there any plans to add support for record types?

Also, is it possible to emit JSON? I want to use this project to create 'bindings' for another language I'm working on to interface with Java, and this would really be useful

See #10 for workaround that just skips records. I haven't looked too closely to it, but according to PR author it is a limitation of JavaParser. A better workaround that actually emits records might be possible, but I'm unlikely to work on it anytime soon.

JSON output is already available, but the format is neither documented or stable (see https://github.com/bensku/java-ts-bind/blob/master/src/main/java/io/github/bensku/tsbind/cli/Args.java for command-line option). I would not recommend using this for your own language as-is, but maybe this could serve as a starting point.

Hm fair enough, thanks! I've actually decided to use reflection to map out Java arguments and types, parameter names are included in bytecode if you specify it in javac so it's not too much of an issue thankfully

For record, I built this to avoid loading classes (potentially with side effects in static initializers) and to convert Javadoc to JSDoc. If you don't need the latter, it is probably much easier to parse bytecode or (as you do), use reflection.