Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] [jvm] Add --java-lib-sources argument to support JavaDocs #11375

Open
EliteMasterEric opened this issue Nov 13, 2023 · 3 comments

Comments

@EliteMasterEric
Copy link
Contributor

I"m wondering if it would be possible to add the ability for VSCode to display JavaDocs for extern classes provided by --java-lib-extern in the current build context.

I believe this would have to involve the ability to include and reference a sources JAR. I don"t know if providing a sources JAR could improve the generation of --dumps as well.

Currently, the only way to provide documentation for external classes is to manually create extern classes which @:native to the desired class, and then document those. This is a large amount of work for larger libraries and is mostly redundant when Haxe can generate externs automatically, and when JavaDocs already exist.

@Simn
Copy link
Member

Simn commented Nov 14, 2023

Would this not require a Java source parser? I forget how this works in Java world...

@EliteMasterEric
Copy link
Contributor Author

I rethought this a bit and I think I have a new proposal, which would take less work and be more generically useful.

Maybe an @:docsOnly annotation which would then apply the documentation to the matching type without compiler conflicts. This would allow for documentation to be applied to a class you otherwise couldn"t modify, such as an extern generated from a Java lib automatically by Haxe. Notably this would be different from writing the extern myself, as I would then have to include undocumented fields, make sure all the types are compatible, fix any compiler errors, etc.

I could then make the program to automatically generate the documented modules from documented Java code using the Doclet API

@Simn
Copy link
Member

Simn commented Nov 19, 2023

We actually have a similar situation with our @:coreApi, where target-specific classes such as std/jvm/_std/String.hx receive their documentation from the "core" class std/String.hx. This has always felt pretty hacky though because the compiler has to hide some class paths in order to even locate these files, which are technically shadowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants